Thursday, December 26, 2024

Advanced Security best practices for Ubuntu Linux

 To enhance the security of an Ubuntu Linux system, it’s crucial to implement advanced security best practices beyond basic configurations. These practices help safeguard against potential attacks, unauthorized access, and data breaches.

Point 1) Install and configure Fail2Ban (IMP)

Fail2Ban is a security tool designed to prevent unauthorized access to a system by monitoring logs for suspicious activity and taking automated actions, such as blocking IP addresses. It's commonly used to protect services like SSH, HTTP, and FTP against brute force attacks, DDoS attempts, and other malicious behaviors.


Point 2) Use a non-default SSH port: 2222 /etc/ssh/sshd_config  (IMP)


Point 3) Disable root login via SSH

  • sudo nano /etc/ssh/sshd_config
  • PermitRootLogin no
  • sudo systemctl restart sshd
 
Point 4) Use SSH key-based authentication instead of User passwords
(IMP)
 
  • sudo nano /etc/ssh/sshd_config
  • PasswordAuthentication no
  • PubkeyAuthentication yes
  • sudo systemctl restart sshd
 
Point 5) Secure logging
(IMP)
   
  • Use tools like `logwatch` to monitor logs and review system events regularly.
  • sudo apt install logwatch
  • sudo logwatch --output stdout --detail High --range today

Point 6) File System Hardening: Enable immutable files for critical configurations.
     
  • sudo chattr +i /etc/fstab
  • sudo chattr +i /etc/ssh/sshd_config

Point 7) Enable Backup and Recovery For The Files and directory.
(IMP)

Point 8) Enable Uncomplicated Firewall (UFW) is a simple way to manage a firewall on Ubuntu.
 

Point 9) Install and configure AIDE (Advanced Intrusion Detection Environment)
     
  • sudo apt install aide
  • sudo aideinit
  • cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db
 
Point 10) Configure AppArmor or SELinux

  • Use AppArmor (which is enabled by default) or SELinux for mandatory access control (MAC).
  • sudo apt install apparmor
  • sudo systemctl enable apparmor
  • sudo systemctl start apparmor
   
Point 11) Configure Disk Encryption with LUKS

  • For sensitive data, enable full disk encryption with LUKS during installation or after the system is set up.
    

Point 12) Advanced Monitoring and Logging
(IMP)

  • Use centralized logging server (ELK Stack).
  • Install tools like `auditd` for in-depth auditing.

   
Point 13) Advanced Networking: Implement VPN tunnels (e.g., OpenVPN, WireGuard) for remote access.
 

Point 14) ClamAV antivirus on Ubuntu for Malware Detection

  • sudo apt install clamav clamav-daemon
  • sudo freshclam
  • clamscan -r --summary /

 

No comments:

Post a Comment

testing