Problem
I want to lock accounts after login attempts have failed.
Repeated unsuccessful login attempts are typically associated with trying to crack an account password.
Solution
There are mechanisms provided to monitor and restrict unsuccessful logins.
To turn these on you must create the loginlog and set other parameters in the default login configuration file.
To do this take these steps as the system administrator, root:
# touch /var/adm/loginlog
# chmod 600 /var/adm/loginlog
# chown root:sys /var/adm/loginlog
# defadm login MAXTRYS=4
# defadm login LOGFAILURES=4
# defadm login DISABLETIME=10
# defadm login TIMEOUT=60
# defadm login LOCKONLOGFAIL=YES
# defadm login MAILONLOGFAIL=rootWith this configuration in place, if any user mistypes their password 4 times consecutively within a login session, the failure will be logged to /var/adm/loginlog and their account will be locked.
A notification email will be sent to root.
NOTE: Due to a parsing error on MAILONLOGFAIL in UnixWare 7.1.4 the last
two characters of the value are truncated. For more details on this
problem and how to work around it see:TA127236 "Notification email not being sent properly when an account becomes locked on UnixWare 7.1.4"
- OpenServer will allow you to control the login failures on a per account basis using /etc/usermod:
# usermod -x "{maxLoginAttempts 4}" account_nameTo set the system default so that all new accounts have this limit use:
# usermod -D -x "{maxLoginAttempts 4}"Setting the value to zero allows unlimited login failures.
Note that there is no email sent when this limit is reached. The
root account can check the number of allowed or failed login attempts
using /etc/userls:# userls -x "{maxLoginAttempts}" -l account_name
# userls -x "{unsuccessfulLoginAttempts}" -l account_nameTo check all accounts, use: # userls -x "{maxLoginAttempts} {unsuccessfulLoginAttempts}"
or
# userls -x "{maxLoginAttempts}"
# userls -x "{unsuccessfulLoginAttempts}"If your OpenServer user has exceeded the maxLoginAttempts value, this can be reset with usermod:
# usermod -x "{unsuccessfulLoginAttempts 0}" account_nameAnd then unlock the account with:# passwd -u account_name- UnixWare DOES NOT support the account modifiers maxLoginAttempts, unsuccessfulLoginAttempts or passwd's -u option.
To unlock a UnixWare account the password needs to be reset using /bin/passwd:
# passwd account_nameUse the -f option if you want the user to create their own password on the next login.
To check the status of accounts for either OpenServer or UnixWare use:
# passwd -s account_nameor to check all accounts:# passwd -saLocked accounts will show a status of LK.
NOTE: For OpenServer 6.0.0 and UnixWare 7.1.4 with MP3 had a problem with
account locking.This problem was fixed in MP4 for UnixWare 7.1.4.
The latest Maintenance Pack is suggested.This issue is reported to SCO Engineering for SCO OpenServer6.
NOTE: Accounts will lock because either they have expired or because too
many bad attempts were made, see above.If you don't wish an account's to be locked because of expiry reasons then change the server's "scoadmin account" -> Expiration settings.
With UnixWare 7.1.4 you can also do this with:
# passwd -x -1 rootThese will get reset to the Default values once a password change has been initiated.
or alternatively set the account to expiry in 9999 days, for example, with:
# passwd -x 9999 rootAn alternate to unlocking an account as root might be to use an alternative System Owner account with tfadmin, see:
TA109663 "How do I allow unprivileged users to run privileged commands on UnixWare?"
TROUBLESHOOTING:
---------------Frequently Asked Questions:- The account locked is the last one attempted in a (single) session, not necessarily one that has accumulated the defined number of failures.
This is expected behaviour. LOCKONLOGFAIL will lock on CONSECUTIVE failed login attempts.
For example, you can attempt LOCKONLOGFAIL-1 times with user a and when attempting to login with user b with an incorrect password, because LOCKONLOGFAIL has been reached then it's user b who will be locked.
- Command usermod (usermod -x "{maxLoginAttempts 4}" account_name) on my system does not have the -x option and returns a syntax error, even though the userls command allows for the -x (extended attributes).
OpenServer will allow you to control the login failures on a per account basis using /etc/usermod:
In other words, UnixWare does not support setting controls on a per user basis.
- When I run (userls -x "(maxLoginAttempts)" account_name) it returns <UX:userls: ERROR: Extended options processing - Cannot find the operator>, because I am unable to set the value through usermod."
Again, this feature is for OpenServer only. UnixWare does not support per account controls of these parameters.
Troubleshooting:Notes: The following is taken directly from the SVR4.1 require- ments relating to the functionality of the MAXTRYS and LOGFAILURES tunables:
1. Users will be allowed LOGFAILURES (will be set to 5)
attempts to successfully log in at each invocation of
login. 2. If the file LOGINLOG (will be defined to be
/var/adm/loginlog) exists, all LOGFAILURES consecutive
unsuccessful login attempts will be logged in
LOGINLOG. After LOGFAILURES unsuccessful attempts,
login will sleep for DISABLETIME before dropping the
line. In other words, if a person tried five times,
unsuccessfully, to log in at a terminal, all five
attempts will be logged in /var/adm/loginlog if it
exists. The login command will then sleep for
DISABLETIME seconds and drop the line. On the other
hand, if a person has one or two unsuccessful
attempts, none of them will be logged. => Note: Since LOGFAILURES can now be set by the
administrator, it may be set to 1 so that any number
of failed login attempts are recorded. When either
MAXTRYS or LOGFAILURES is reached login will exit
and the user will be disconnected from the system.
The difference being that in the case of
LOGFAILURES, a record of bad login attempts are
recorded in the system logs. 3. By default, MAXTRYS and LOGFAILURES will be set to 5. 4. If set, MAXTRYS must be >= 0. If MAXTRYS=0 and
LOGFAILURES is not set, then login will not kick the
user off the system (unlimited attempts will be
allowed). 5. If set, LOGFAILURES must be within the range of 0-20.
If LOGFAILURES is = 0, and MAXTRYS is not set, then
login will not kick off the user (unlimited attempts
will be allowed). 6. If LOGFAILURES or MAXTRYS are not set, then
respectively, the effect will be as if the item were
set to 0. 7. The lowest positive number of MAXTRYS and LOGFAILURES
will be the number of failed login attempts allowed
before the appropriate action is taken (e.g. 1,
MAXTRYS = 3 and LOGFAILURES=6 then the user will be
kicked off the system after 3 bad login attempts and
IN NO CASE shall bad login records end up in the
system log file (var/adm/loginlog). e.g. 2, MAXTRYS=6
and LOGFAILURES=3, then the user will be kicked off
the system after 3 bad login attempts and at that
point in time, 3 records will be recorded in the
system log file). 8. In the case when both values are equal, then the
action of LOGFAILURES will dominate (i.e., a record of
the bad login attempts will be recorded in the log
files). See also
http://uw714doc.xinuos.com/en/man/html.4/login.4.html
http://uw714doc.xinuos.com/en/man/html.4/loginlog.4.html
http://uw714doc.xinuos.com/en/UG_admin/uaT.restfailacct.html
http://uw714doc.xinuos.com/en/SEC_admin/_loginlog.html
http://uw714doc.xinuos.com/en/man/html.1/passwd.1.html
http://uw714doc.xinuos.com/en/HANDBOOK/uaT.loginexpire.html
http://osr600doc.xinuos.com/en/man/html.ADM/useradd.ADM.html
http://osr600doc.xinuos.com/en/man/html.ADM/userls.ADM.htmlTA127236 "Notification email not being sent properly when an account becomes locked on UnixWare 7.1.4"
TA126831 "How can I improve security on my SCO Unix server?"
TA110793 ""passwd -f <user_name>" and the Account Manager Force Password Change at Next Login do not work as documented."
TA109663 "How do I allow unprivileged users to run privileged commands on UnixWare?"