auth: keep track of lastLogon and lastLogonTimestamp
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 23 Oct 2015 03:57:56 +0000 (16:57 +1300)
committerGarming Sam <garming@samba.org>
Mon, 14 Dec 2015 23:08:57 +0000 (00:08 +0100)
commit795f4729ca94029fcee750fbebbe9bc3ea43a214
tree895acbbd6082e4c4c35c8ae33ccaff8c7067ad9a
parent909ebe0191a409c107904df658dc9111dd5de669
auth: keep track of lastLogon and lastLogonTimestamp

lastLogon is supposed to be updated for every interactive or kerberos
login, and (according to testing against Windows2012r2) when the bad
password count is non-zero but the lockout time is zero. It is not
replicated.

lastLogonTimestamp is updated if the old value is more than 14 -
random.choice([0, 1, 2, 3, 4, 5]) days old, and it is replicated. The
14 in this calculation is the default, stored as
"msDS-LogonTimeSyncInterval", which we offer no interface for
changing.

The authsam_zero_bad_pwd_count() function is a convenient place to
update these values, as it is called upon a successful logon however
that logon is performed. That makes the function's name inaccurate, so
we rename it authsam_logon_success_accounting(). It also needs to be
told whet5her the login is interactive.

The password_lockout tests are extended to test lastLogon and
lasLogonTimestamp.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
source4/auth/ntlm/auth_sam.c
source4/auth/sam.c
source4/dsdb/tests/python/password_lockout.py
source4/kdc/hdb-samba4.c