Setting up Linux Firewall Print

  • 0

Adding ConfigServer Firewall to your server. 

While Linux comes with built in firewall software, it can be a bit difficult to configure correctly. Fortunately, there is a sweet, open-source, software product available to make it much easier. This product is: Config Server Firewall, available at http://configserver.com/cp/csf.html.   

This software runs as a plug-in for cPanel, DirectAdmin, and Webmin, but needs to be installed via the command line (SSH as root).

To install run the following commands as root:

# wget http://configserver.com/free/csf.tgz
# tar xzvf csf.tgz
# cd csf

If you have cPanel installed:
# ./install.cpanel.sh

If you have DirectAdmin installed:
# ./install.directadmin.sh

Otherwise:
# ./install.sh

Once installed you can access the configuration via cPanel/WHM's Plugin's section or in the lower-left column of DirectAdmin's main Admin page. If you use Webmin, goto the Webmin Modules page and install a new module from a local directory. The module will be located at /etc/csf/csfwebmin.tgz.

 

 

This script runs two programs csf and lfd. The first is the firewall management program and the second, lfd is the Login Failure Deamon, which tracks failed login attempts, automatically blocks them, which protects you against Brute Force Attacks.

If you do not use Webmin or a Control Panel, you can edit /etc/csf/csf.conf manually. The important bits are "TESTING = "1"which you need to change to "0" to enable the firewall. Also the part titled "SECTION:Port Settings" which controls which ports are open on the server. Both csf.conf and the Control Panel plugin's have helpful descriptions explaining what each setting does. Also, the web interface found in the plugin has a button entitled "Check Server Security" which runs a serious of checks on your system to make sure the server is secured properly.

At first you may lock yourself out (just contact us at https://support.corporatecolo.com/ to assist, and there can be quite a bit of emails generated to the root account with warnings. These emails will alert you to any failed login attempts, blocked IPs, and more. 

This suite of scripts provides:

  • Straight-forward SPI iptables firewall script
  • Daemon process that checks for login authentication failures for:
    • Courier imap, Dovecot, uw-imap, Kerio
    • openSSH
    • cPanel, WHM, Webmail (cPanel servers only)
    • Pure-ftpd, vsftpd, Proftpd
    • Password protected web pages (htpasswd)
    • Mod_security failures (v1 and v2)
    • Suhosin failures
    • Exim SMTP AUTH
    • Custom login failures with separate log file and regular expression matching
  • POP3/IMAP login tracking to enforce logins per hour
  • SSH login notification
  • SU login notification
  • Excessive connection blocking
  • UI Integration for cPanelDirectAdmin and Webmin
  • Easy upgrade between versions from within cPanel/WHM, DirectAdmin or Webmin
  • Easy upgrade between versions from shell
  • Pre-configured to work on a cPanel server with all the standard cPanel ports open
  • Pre-configured to work on a DirectAdmin server with all the standard DirectAdmin ports open
  • 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
  • BOGON packet protection
  • 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 (via cPanel/DirectAdmin/Webmin UI)
  • 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
  • SYN Flood protection
  • Ping of death protection
  • Port Scan tracking and blocking
  • Permanent and Temporary (with TTL) IP blocking
  • Exploit checks
  • Account modification tracking - sends alerts if an account entry is modified, e.g. if the password is changed or the login shell
  • Shared syslog aware
  • Messenger Service - Allows you to redirect connection requests from blocked IP addresses to preconfigured text and html pages to inform the visitor that they have been blocked in the firewall. This can be particularly useful for those with a large user base and help process support requests more efficiently
  • Country Code blocking - Allows you to deny or allow access by ISO Country Code
  • Port Flooding Detection - Per IP, per Port connection flooding detection and mitigation to help block DOS attacks
  • DirectAdmin UI integration
  • Updated Webmin UI integration
  • WHM root access notification (cPanel servers only)
  • New in v5: lfd Clustering - allows IP address blocks to be automatically propagated around a group of servers running lfd. It allows allows cluster-wide allows, removals and configuration changes
  • New in v5: Quick start csf - deferred startup by lfd for servers with large block and/or allow lists
  • New in v5: Distributed Login Failure Attack detection
  • New in v5: Temporary IP allows (with TTL)
  • New in v5: IPv6 Support with ip6tables
  • New in v5: Integrated UI - no need for a separate Control Panel or Apache to use the csf configuration
  • New in v5: Integrated support for cse within the Integrated UI
  • New in v5: cPanel Reseller access to per reseller configurable options Unblock, Deny, Allow and Search IP address blocks
  • ...lots more! 

Was this answer helpful?

« Back