This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Install CSF Firewall
#1
Install CSF Firewall
This was posted previously on our old community panel:

CSF Firewall is an extended firewall setup including audit/aide setup with web interface to manage firewall. 

Code:
rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Website:

http://www.configserver.com/cp/csf.html

Some of features included:

Quote: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)

  • 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

  • Quick start csf - deferred startup by lfd for servers with large block and/or allow lists

  • Distributed Login Failure Attack detection

  • Temporary IP allows (with TTL)

  • IPv6 Support with ip6tables

  • Integrated UI - no need for a separate Control Panel or Apache to use the csf configuration

  • Integrated support for cse within the Integrated UI

  • cPanel Reseller access to per reseller configurable options Unblock, Deny, Allow and Search IP address blocks

  • System Statistics - Basic graphs showing the performance of the server, e.g. Load Averages, CPU Usage, Memory Usage, etc

Notice that this script is not suited for small VPS instances as it will add more services/packages running in the background.
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Freelance AWS Certified Architect & SysOps// DevOps

10$ free to start your VPS

Reply
Thanks given by: Cantalupo , andr3selite
#2
RE: Install CSF Firewall
Use commands

Separated list of commands so you can better control the CSF features (replace (IP)):

    CSF -g (IP)> Checks whether the searched IP is blocked
    csf -a (IP) "Reason - Your Name"> Adds an IP in the server whitelist. Use with caution and release only fixed IP
    csf -d (IP) "Reason - Your Name"> Blocks IP in firewall and add the comment in /etc/csf/csf.deny file
    CSF -Tr (IP)> Remove the temporary blocking of an IP
    CSF -Dr (IP)> Remove the definitive blocking an IP
    grep IP /var/log/lfd.log > Check the reason for a temporary lock

more....
Reply
Thanks given by:
#3
RE: Install CSF Firewall
Code:
###############################################################################
# Copyright 2006-2013, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################


Installation
============
Installation is quite straightforward:

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Next, test whether you have the required iptables modules:

perl /usr/local/csf/bin/csftest.pl

Don't worry if you cannot run all the features, so long as the script doesn't
report any FATAL errors

You should not run any other iptables firewall configuration script. For
example, if you previously used APF+BFD you can remove the combination (which
you will need to do if you have them installed otherwise they will conflict):

sh /usr/local/csf/bin/remove_apf_bfd.sh

That's it. You can then configure csf and lfd by reading the documentation and
configuration files in /etc/csf/csf.conf and /etc/csf/readme.txt directly or
through the csf User Interface.

csf installation for cPanel and DirectAdmin is preconfigured to work on those
servers with all the standard ports open.

csf auto-configures your SSH port on installation where it's running on a non-
standard port.

csf auto-whitelists your connected IP address where possible on installation.

You should ensure that kernel logging daemon (klogd) is enabled. Typically, VPS
servers running RedHat/CentOS v5 have this disabled and you should check
/etc/init.d/syslog and make sure that any klogd lines are not commented out. If
you change the file, remember to restart syslog.

See the csf.conf and readme.txt files for more information.


Webmin Module Installation/Upgrade
==================================

To install or upgrade the csf webmin module:

Install csf as above
Install the csf webmin module in:
  Webmin > Webmin Configuration > Webmin Modules >
  From local file > /usr/local/csf/csfwebmin.tgz > Install Module


Uninstallation
==============
Removing csf and lfd is even more simple:

cd /etc/csf
sh uninstall.sh


GD::Graph
=========
This perl module is required for Statistical Graphs available from the csf UI.
It is dependent on garphical libraries being installed for your OS (e.g.
libgd, libpng, etc. which is beyond the scope of this document)

The perl module itself can be installed in a variety of ways, e.g.:

RedHat/CentOS/CloudLinux:
# yum install perl-GDGraph

Debian v6:
# apt-get install libgd-graph-perl

Direct from cpan.org:
# perl -MCPAN -e shell
cpan> install GD::Graph
Angel
Reply
Thanks given by:
#4
RE: Install CSF Firewall
My server is VPS - Intel® Xeon® CPU E3-1270 v3 @ 3.50GHz - 60GB SSD - 2GB RAM
and this CSF eat my cpu sometimes ...
Angel
Reply
Thanks given by:
#5
RE: Install CSF Firewall
I know this is a stupid question but does CSF have a front end like CPanel?

[Image: csf02.JPG]
Reply
Thanks given by:
#6
RE: Install CSF Firewall
Code:
wget --no-check-certificate https://raw.github.com/stokes84/ConfigServer-Firewall-Installer/master/install.sh; bash install.sh; rm -f install.sh

One single line of code , you have than CSF & GUI Panel for CSF Smile
Reply
Thanks given by: onlineth
#7
RE: Install CSF Firewall
(04-10-2015, 06:34 AM)Active8 Wrote:
Code:
wget --no-check-certificate https://raw.github.com/stokes84/ConfigServer-Firewall-Installer/master/install.sh; bash install.sh; rm -f install.sh

One single line of code , you have than CSF & GUI Panel for CSF Smile

THANK YOU Big Grin Big Grin Big Grin
Reply
Thanks given by:
#8
RE: Install CSF Firewall
What would you suggest as minimal Requirments for a VPS to be able to use CSF?
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:
#9
RE: Install CSF Firewall
1GB as loads more services and better 2GB. Same if you plan to use clamAV/spamassassin you should think about min 2G.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Freelance AWS Certified Architect & SysOps// DevOps

10$ free to start your VPS

Reply
Thanks given by: apinto
#10
RE: Install CSF Firewall
on my 512 mb VPS it runs without problems
Reply
Thanks given by:


Possibly Related Threads...
Thread Author Replies Views Last Post
[HOW-TO]How Install Ioncube Sentora Cantalupo 11 22,374 09-17-2018, 06:10 PM
Last Post: itzdaniel483
[How-To] Install Redmine/Passenger/GIT/Subversion james30263 7 14,332 09-13-2018, 02:16 PM
Last Post: james30263
How to install mod_pagespeed on Sentora testing 0 1,218 11-26-2017, 06:23 AM
Last Post: testing

Forum Jump:


Users browsing this thread: 1 Guest(s)