Limit the number of user logins

This commit is contained in:
Bob Mottram 2016-11-29 19:30:36 +00:00
parent c24e7a4d0c
commit 35d789f133
1 changed files with 19 additions and 0 deletions

View File

@ -393,6 +393,22 @@ function set_max_login_tries {
fi
}
function limit_user_logins {
# overall max logins
if ! grep '* hard maxsyslogins' /etc/security/limits.conf; then
echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
else
sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
fi
# Max logins for each user
if ! grep '* hard maxlogins' /etc/security/limits.conf; then
echo '* hard maxlogins 2' >> /etc/security/limits.conf
else
sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
fi
}
function setup_firewall {
function_check create_completion_file
create_completion_file
@ -587,6 +603,9 @@ function setup_utils {
function_check admin_user_sudo
admin_user_sudo
function_check limit_user_logins
limit_user_logins
}
function setup_email {