login.conf: passwordtime not enforced?
fernan.aguero at gmail.com
Wed Jul 14 15:16:38 UTC 2010
On Tue, Jul 13, 2010 at 10:19 PM, b. f. <bf1783 at googlemail.com> wrote:
> >after reading some docs about hardening freebsd installations, I
> > decided to enforce password expiration after 90days. I've added the
> > corresponding line to /etc/login.conf and ... after quite some time
> > (way more than 3 months already!) nothing happens ...
> If you want help, you'll have to be more specific.
I'm sorry about that. My apologies. I just assumed that you assumed
that I was doing the right thing(TM). :)
> Exactly what changes did you make to login.conf, in what sections?
I've changed only the default login class, and added and/or changed these lines:
> Did you run 'cap_mkdb /etc/login.conf' afterwards?
Of course I did.
> Did you then reset your account passwords
Of course. Now they all begin with $2a, as expected for blowfish-hashed passwds.
> and check the sixth colon-delimited field in /etc/master.passwd with 'date -r' for each account changed, to see if
> the appropriate expiration date was registered?
I don't quite get what 'date -r' does here ... but yes I've checked
the 6th field in /etc/master.passwd, all accounts (regular users and
system accounts) have a '0' in that field.
> Next time you make a change like this, test it with a short expiration time (a minute or
> two, say) on a non-critical account to see if works instead of waiting
> three months to discover that it does not.
I usually assume that the docs are correct, and don't go about
checking and re-checking that everything works as expected ... unless
not for these trivial config tweaks. Of course I've checked that the
newly created passwords (now using blf instead of md5) worked, but I
just assumed that the rest of the config settings for this login class
didn't require further checking ... if the blf change worked, why not
Do you suggest that I should now go and check if the
'mixpasswordcase', 'minpasswordlen', 'idletime' or the 'umask'
settings are honored? I just hope I don't need to ... :)
> > Any ideas on how to enforce this? Do I have to manually use pw(1) every 90 days?
> No, you shouldn't have to if you use the feature properly. You'll be
> prompted immediately after login for a new password if your old one
> has expired.
I just added a new class in login.conf:
And then added a new user 'testaccount', using adduser(1). I've
verified that its login class was OK in /etc/master.passwd (BTW again
the 6th field is '0'). And I never got any message about the password
being expired, after several succesful login attempts that, obvioulsy,
spanned more than 2 minutes.
Who is responsible for filling in the password expiration time/date in
master.passwd, according to the login class config? passwd(1)?
adduser(1)? Myself, manually?
I guess this is the question I wanted answered in my first email.
After reading, again the man page for master.passwd(5), saying that
"The expire field is the number of seconds from the epoch, UTC, until
the account expires."
It's now clear to me that
i) I can do it manually, eg. by running something like
%date -j -f "%a %b %d %T %Z %Y" "`date -v+90d`" "+%s"
and entering that value into the 6th field of /etc/master.passwd. But
then, I'll have to do this regularly using a script, because,
ii) passwd(1) fails to read the setting in login.conf and then add the
corresponding expiration time (in seconds since the epoch) in
Unless, of course, I'm missing something ... after setting the
expiration time to
%date -j -f "%a %b %d %T %Z %Y" "`date -v+2M`" "+%s"
And then waiting until this time has passed, nothing happens (I'm
logging in remotely using SSH) ... no warning, no refuse to log me in,
Is it at all possible to enforce password expiration times in FreeBSD?
More information about the freebsd-questions