User account security is critical for preventing unauthorized access and ensuring that users have appropriate permissions. This project will guide you through a user account security assessment, focusing on evaluating user permissions and analyzing user activity logs. You will use various tools to audit, analyze, and secure user accounts.
- Basic understanding of user account concepts (usernames, groups, permissions, etc.)
- Familiarity with the Linux command line
- A computer with a Linux operating system (preferably Ubuntu)
- Internet connection to download necessary tools
- Lab Environment: A single Linux machine with sudo access.
- Tools:
- PAM (Pluggable Authentication Modules)
- chkpasswd
- sudo
- usermod
- faillog
Objective: Use PAM to audit user accounts and log authentication attempts.
Steps:
-
Install PAM:
sudo apt-get update sudo apt-get install libpam0g-dev
-
Configure PAM:
- Edit
/etc/pam.d/common-auth
to add the following line:auth required pam_tally2.so onerr=fail audit silent deny=5 unlock_time=900
- This configuration will lock a user account for 15 minutes after 5 failed login attempts.
- Edit
-
View PAM Logs:
sudo tail -f /var/log/auth.log
Expected Output:
- Authentication logs showing login attempts and account locks.
Objective: Use chkpasswd to check the strength of user passwords.
Steps:
-
Install chkpasswd:
sudo apt-get install chkpasswd
-
Check Password Strength:
sudo chkpasswd
-
Review Password Policies:
- Ensure that the password policies meet the organization’s security standards (minimum length, complexity, etc.).
Expected Output:
- Report detailing the strength of user passwords and compliance with password policies.
Objective: Use sudo to audit user permissions and ensure appropriate access controls.
Steps:
-
List Sudoers:
sudo cat /etc/sudoers sudo ls /etc/sudoers.d/
-
Check User Permissions:
sudo -l -U username
- Replace
username
with the user you want to audit.
- Replace
-
Review and Adjust Permissions:
- Edit
/etc/sudoers
or files in/etc/sudoers.d/
to ensure users have the appropriate level of access.
- Edit
Expected Output:
- List of users with sudo privileges and their specific permissions.
Objective: Use usermod to modify user permissions and group memberships.
Steps:
-
Add User to Group:
sudo usermod -aG groupname username
- Replace
groupname
with the group andusername
with the user you want to modify.
- Replace
-
Remove User from Group:
sudo gpasswd -d username groupname
-
Verify Group Memberships:
groups username
Expected Output:
- Confirmation of changes to user group memberships.
Objective: Use faillog to analyze failed login attempts and identify potential security issues.
Steps:
-
View Failed Login Attempts:
sudo faillog
-
Reset Failed Login Count for a User:
sudo faillog -r -u username
- Replace
username
with the user whose failed login count you want to reset.
- Replace
-
Configure Login Failure Limits:
- Edit
/etc/login.defs
to set the maximum number of allowed failed login attempts:FAILLOG_ENAB yes FAIL_DELAY 4 LOGIN_RETRIES 5
- Edit
Expected Output:
- List of failed login attempts and confirmation of any resets or configuration changes.
By completing these exercises, you have learned how to evaluate user permissions and analyze user activity logs to ensure user account security. These skills are essential for preventing unauthorized access and maintaining the integrity of user accounts in your system.