
COMPREHENSIVE SECURITY HARDENING FOR KALI LINUX
1. Account Security
Changing Default Credentials
Prevent unauthorized access by changing default credentials immediately.
sudo usermod -l new_username old_username # Change username
passwd # Change password
2. Kernel Hardening
Kernel Parameter Configuration
Protect against memory corruption and network attacks.
# /etc/sysctl.conf
kernel.randomize_va_space = 2 # ASLR protection
net.ipv4.conf.all.rp_filter = 1 # Anti-spoofing
3. Firewall Rules
Basic iptables Rules
Essential firewall configuration for network protection:
sudo iptables -P INPUT DROP # Default deny
sudo iptables -A INPUT -i lo -j ACCEPT # Allow localhost
nftables Alternative
Modern firewall alternative to iptables:
sudo nft add chain inet filter input { policy drop; }
sudo nft add rule inet filter input ip saddr 10.0.0.0/8 drop
4. Service Hardening
Disable Unnecessary Services
sudo systemctl disable bluetooth
sudo systemctl stop cups.service
SSH Hardening
# /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
5. Physical Security Measures
# GRUB Protection
sudo grub-mkpasswd-pbkdf2 # Set boot password
# USB Blocking
blacklist usb-storage # /etc/modprobe.d/blacklist.conf
6. Advanced Protections
File Permissions
sudo chmod 600 /etc/shadow
sudo chmod -R go-rwx /etc
Network Protections
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
net.ipv4.ip_forward = 0
Session Policies
export TMOUT=600 # Auto-logout
ClientAliveInterval 300 # SSH timeout