Authentication and Authorization
Authentication and Authorization
Lab Overview
Objective
Tools Required
1. Kali Linux (for penetration testing tools like Hydra and Metasploit).
2. Ubuntu or any Linux distribution (for setting up the target machine).
3. Metasploitable (a vulnerable machine to test against).
4. Google Authenticator (for setting up Multi-Factor Authentication).
5. Wordlists (e.g., RockYou for brute-forcing passwords).
Pre-Lab Setup
nmap -p 22 <target-ip>
o Explanation:
-l root: Attempts to log in using the root username.
-P /usr/share/wordlists/rockyou.txt: Uses the RockYou
wordlist for password guesses.
ssh://192.168.1.5: The target IP address for the SSH service.
5. Outcome: Hydra will attempt various passwords from the wordlist until it finds a
match. If successful, it will display the correct login credentials:
6. Discussion: Discuss the importance of using strong passwords and the risks of weak
password authentication.
4. Verify: When attempting to log in via SSH, after entering your password, you will be
asked to enter the code from the Google Authenticator app.
yaml
password:
Verification code: 123456
Objective: Ensure that users only have access to resources based on their roles.
2. Create Groups (e.g., admin for privileged users and users for regular users):
o Explanation:
770: Full access to root and admin group, but no access to others.
5. Test Access:
o user1 (admin group) should be able to access the folder:
6. Discussion: Discuss how RBAC helps ensure that users only have access to the
resources they need to perform their job functions, minimizing security risks.
Objective: Use SELinux (Security-Enhanced Linux) for stricter control over what
users can do.
1. Enable SELinux:
sudo setenforce 1
sudo getenforce
sudo ls -Z /secure_folder
The output will show the SELinux security context associated with files and
directories.
1. Edit the sudoers file to limit who can access root privileges:
sudo visudo
3. Verify:
o user1 should now only be able to run the ls and cat commands as root
without needing to type a password.
sudo ls /secure_folder
4. Discussion: Discuss the importance of least privilege and ensuring that users can
only access and perform actions they need.
Conclusion: