hardening

Hardening means making a material, particularly a metal, physically harder, and includes particular cases such as: read more at WikiPedia

  • My mind map you can use as a checklist to secure your Linux server and Joomla has a new home, it is now located at:

    http://joomla-security.waltercedric.com

    I will update it regularly with new tips and how-to. Your feedback is as always welcomed, you can use the comment thread below.

  • CSF: A Stateful Packet Inspection (SPI) firewall, Login/Intrusion Detection and Security application for Linux servers. It easily replace APF and (Advanced policy firewall) and BFD (Brute Force Detection). It is also runing 28 basics but non obvious checks...

     CSF has a loot of functionnalities and has 2 nice features. It can block trafic from well known spammers network
    using the DShield Block List and the Spamhaus DROP List.
    It easily replace APF and (Advanced policy firewall) and BFD (Brute Force Detection).

    • Straight-forward SPI iptables firewall script
    • Daemon process that checks for login authentication failures for:
      • courier imap and pop3
      • ssh
      • non-ssl cpanel / whm / webmail (cPanel servers only)
      • pure-pftd
      • password protected web pages (htpasswd)
      • mod_security failures
    • POP3/IMAP login tracking to enforce logins per hour
    • SSH login notification
    • SU login notification
    • Excessive connection blocking
    • WHM configuration interface (cPanel servers only) or through Webmin
    • WHM iptables report log (cPanel servers only)
    • Easy upgrade between versions from within WHM (cPanel servers only) or through Webmin
    • Easy upgrade between versions from shell
    • A standard Webmin Module to configure csf is included in the distribution ready to install into Webmin - csfwebmin.tgz
    • Pre-configured to work on a cPanel server with all the standard cPanel ports open (cPanel servers only)
    • Auto-configures the SSH port if it's non-standard on installation
    • Block traffic on unused server IP addresses - helps reduce the risk to your server
    • Alert when end-user scripts sending excessive emails per hour - for identifying spamming scripts
    • Suspicious process reporting - reports potential exploits running on the server
    • Excessive user processes reporting
    • Excessive user process usage reporting and optional termination
    • Suspicious file reporting - reports potential exploit files in /tmp and similar directories
    • Directory and file watching - reports if a watched directory or a file changes
    • Block traffic on the DShield Block List and the Spamhaus DROP List
    • Pre-configured settings for Low, Medium or High firewall security (cPanel servers only)
    • Works with multiple ethernet devices
    • Server Security Check - Performs a basic security and settings check on the server (cPanel servers only)
    • Allow Dynamic DNS IP addresses - always allow your IP address even if it changes whenever you connect to the internet
    • Alert sent if server load average remains high for a specified length of time
    • mod_security log reporting (if installed)
    • Email relay tracking - tracks all email sent through the server and issues alerts for excessive usage (cPanel servers only)
    • IDS (Intrusion Detection System) - the last line of detection alerts you to changes to system and application binaries

    Installation is straightforward:

    # wget http://www.configserver.com/free/csf.tgz
    # tar xvf csf.tgz
    # cd csf
    # ./install.sh

    Note all ports that are displayed after the installation, these are port running already on your system (UDP, TCP in and out)
    review the config file by editing:

    # vi /etc/csf/csf.conf

    and add at least the port written before (if you trsut your system before install ;-))
    Do not allow incoming connection or outgoing connections to mysql port (use ssh localforwarding), ftp (use scp)
    As default the rules are only working 5 minutes then get erased. This is the learnig mode, you cant break anything. Just continue reading the file csf.conf It contains a lot of interesting informations...
  • First let's refresh some definitions...
    set user ID (SUID)

    The SUID permission causes a script to run as the user who is the owner of the script, rather than the user who started it. It is normally considered extremely bad practice to run a program in this way as it can pose many security problems.

    set group ID (SGID)

    The SGID permission causes a script to run with its group set to the group of the script, rather than the group of the user who started it. It is normally considered extremely bad practice to run a program in this way as it can pose many security problems.

    Latest versions of the Linux kernel will even prohibit the running of shell scripts that have SGID/SUID attribute set.

    Use of the SUID bit on binaries (to run with root privileges, aka &8221;setuid bit&8221;) MUST be limited to those shown in
    the following list:

    /bin/ping
    /bin/su
    /usr/bin/at
    /usr/bin/chage
    /usr/bin/chfn
    /usr/bin/chsh
    /usr/bin/crontab
    /usr/bin/gpasswd
    /usr/bin/newgrp
    /usr/bin/passwd


    The other binaries that were installed with the SUID bit set MUST have this bit removed. Administrators can still run
    these binaries normally, but they are not available for ordinary users. There are also a number of SGID files on the system that are needed, it may depending on the number of tools, or your distribution. Use Google and query the web for the right list ;-)

    Similarly, the SGID bit MUST NOT be used to give group &8221;root&8221; privileges to any binary.
    To generate a list of all SUID/SGID programs on the system simply run the following command:

    # find / -not -fstype ext3 -prune -o \ -type f \( -perm -4000 -o -perm -2000 \) \ -print


    Then, for each file in this list that is not one of the permitted SUID or SGID programs, run the command
    # chmod -s FILE

    to remove the SUID and SGID bits. When done, re-run the find command to verify that the list matches the
    permitted programs.

    I recommend you installing also FAF (File Anomaly Finder) on your server to check periodically for file with too much rights or privileges