Linux AAA
Linux AAA
Authentication
What it means:
Authentication verifies who the user is.
How it works in Linux:
- 
When you log in, Linux checks your credentials (usually username + password) against /etc/passwdand/etc/shadow.
- 
/etc/passwdstores user information (username, UID, GID, shell, home directory).
- 
/etc/shadowstores hashed passwords and password expiration info, readable only by root.
Common authentication methods:
- 
Local authentication: Using /etc/passwdand/etc/shadow.
- 
Remote authentication: Using services like: - 
LDAP (Lightweight Directory Access Protocol) – centralized user management. 
- 
Kerberos – provides secure, ticket-based authentication. 
- 
RADIUS – used in network access (VPNs, Wi-Fi, etc.). 
- 
PAM (Pluggable Authentication Modules) – modular framework used by Linux for integrating different authentication methods. 
 
- 
Example PAM file location:
/etc/pam.d/
Each service (like SSH, sudo, login) has its own PAM configuration file.
Authorization
What it means:
Authorization determines what an authenticated user is allowed to do.
How it works in Linux:
- 
Linux controls access to files and system resources through permissions, ownership, and access control mechanisms. 
Core methods:
- 
File Permissions (rwx): 
 Each file and directory has:- 
Owner permissions 
- 
Group permissions 
- 
Others permissions 
 Example: 
 -rw-r--r-- 1 ozz961 users 1234 Oct 29 file.txt
- 
- 
Sudo / Polkit (PolicyKit): - 
sudolets specific users execute commands as root.
- 
Controlled by /etc/sudoers.
- 
Example rule: 
- 
Polkit provides fine-grained access control for desktop and system-wide services (D-Bus based). 
 
- 
- 
SELinux / AppArmor: 
- 
SELinux (Security-Enhanced Linux) enforces mandatory access control (MAC). 
- 
Defines what processes can do, even if they run as root. 
- 
AppArmor works similarly, using profile-based restrictions. 
Accounting
What it means:
Accounting tracks what users do — actions, commands, system access, and resource usage.
How it works in Linux:
- 
Shell History: Basic command tracking ( ~/.bash_history).
- 
Process accounting: Tracks system resource usage (CPU time, memory, etc.) per process or user. - 
Tools: acct,sa,lastcomm
 
- 
- 
Auditd (Linux Auditing System): - 
Logs all system events and security-relevant actions. 
- 
Configuration: /etc/audit/auditd.conf
- 
Example rule: → Watches for writes/attribute changes to /etc/passwdand tags logs with keypasswd_changes.
 
- 
- 
Syslog / journald: System-wide logging of authentication attempts, command execution, service logs, etc. - 
Files like /var/log/auth.logor/var/log/secure.
 
- 
Demo
When a directory permissions is being altered by a malicious actor, the sort of permissions that is being is the least of their concern. However, the implemented access control has stopped us from changing the permissions of other users, even if that meant to be higher than our current user. All processes regarding authorization and authentication are being logged in details, and this is where we end our demo with accounting. The /var/log directory is the standard logging directory of the linux system.
Comments