Securing your server these days is a must! Alpha Computer Services will be showing you how to secure your Server / VPS with CSF / LFD and includes packet inspection, firewall with login intrusion detection and security application for Linux Servers. Requires SSH access to your Dedicated Server or VPS.
You can view more detailed information by visiting their website
http://configserver.com/cp/csf.html
UI integration for cPanel, DirectAdmin and Webmin, but we’ll be installing it on Parallels Plesk Panel 12 which does not include a interface.
I HIGHLY RECOMMEND NOT INSTALLING WEBMIN OVER PLESK UNLESS YOU’RE REALLY NEW TO MANAGING A PLESK SERVER, USE SSH INSTEAD.
How to Install Webmin Plesk CentOS
You can install webmin over your plesk installation, visit webmins website and once you install, login to your webmin control panel. https://yourIP_or_DomainName:10000 and then go to Webmin – Webmin Configuration – Webmin Modules – From Local File and then Browse to usually /etc/csf/csfwebmin.tgz then click install module. You will have to install csf first, if not webmin will install it for you. It will install under System in your webmin control panel, from here you can instantly increase your servers security levels and check log files, unblock, block ips and lots more.
As long as you don’t use webmin to edit or update anything you don’t have to worry about it, but you can use it to edit your configuration files pretty easily. Don’t do it unless you know what you’re doing.
You can view screen shots I just made with CSF / LFD using webmin here:
Tip: when using ssh terminal begin by typing for example nano /etc/csf/cs and keep hitting tab key. it will show you the available combinations for the remaining file names in that directory. This trick will save you a heck of a lot of time using terminal “SSH†shell, whatever you want to call it. Okay, well lets begin.
If using windows you can download Putty SSH Cient If you’re using Linux or Mac you can open Terminal. I prefer Terminator because you can open other terminal sessions inside the same window by right clicking the terminal and clicking split horizontally.
tip: when you try typing nano and if the command is not found type this:
Debian Based “Ubuntu†etc : apt-get install nano
RedHat Based “CentOS†etc : yum install nano
Add sudo before command if not ROOT.
CSF LFD Works in Linux Dedicated Server and VPS “Virtual Private Serversâ€
Install on Dedicated Server or VPS “Virtual Private Serversâ€, We run ours in virtual private servers in the cloud so we can move our nodes from host to host.
Downloading and Installing Webmin in Parallels Plesk Panel 12 using SSH
Must be logged in as ROOT:
su – root
cd /root
Download and installation:
wget http://www.configserver.com/free/csf.tgz
tar –xzf csf.tgz
cd csf
sh install.sh
Which ports do I need open?
Once you run the install script it will tell you the current TCP and UDP listening ports for incoming connections. This will not give you all the ports you need open, nor will it tell you which ports you need closed. but gives you a good starting point.
Note: your settings might be different, if you have no idea just copy the current ports listed when you installed config server or just contact us and we’ll be happy to help you for free.
Check http://kb.parallels.com/391 for more details on which ports plesk panel 12 uses.
Make sure iptables has the correct modules:
perl /etc/csf/csftest.pl
Change to csf installed directory:
cd /etc/csf
Now edit csf main config file. the creators of configserver did an excellent job explaining what all the options do. So read your configuration and adjust to your liking, depending on how much you want to lock down your system. If you’re a web hosting business make sure to look at the perspective from your hosting customers point of view.
nano /etc/csf/csf.conf
Tip: when done editing your file type CTRL+X and than Y to save changes.
lfd will not start while this is enabled
# The interval for the crontab in minutes. Since this uses the system clock the
# CRON job will run at the interval past the hour and not from when you issue
# the start command. Therefore an interval of 5 minutes means the firewall
# will be cleared in 0-5 minutes from the firewall start
# Enabling auto updates creates a cron job called /etc/cron.d/csf_update which
# runs once per day to see if there is an update to csf+lfd and upgrades if
# available and restarts csf and lfd
#
# You should check for new version announcements at http://blog.configserver.com
###############################################################################
# SECTION:IPv4 Port Settings
###############################################################################
# Lists of ports in the following comma separated lists can be added using a
#
Lookup your Plesk Panel Version for Ports to Open and if your Server uses other ervices Open Ports for Which ones you want to Allow Access to the Outside World
colon (e.g. 30000:35000).# Allow incoming TCP ports
Â
# If you do not want to allow external access to MySQL or PostgreSQL. I would block it as people logging into plesk panel 12 will still be able to install applications and access the database using phpmyadmin or phpPGadmin. block incoming PostgrelSQL: 5432 and MYSQL: 3306
# Allow outgoing TCP ports
# Allow incoming UDP ports
# Allow outgoing UDP ports
# To allow outgoing traceroute add 33434:33523 to this list
# Allow incoming PING
# Allow outgoing PING
# Set the per IP address outgoing ICMP packet rate (hits per second allowed),
# e.g. “1/sâ€
# To disable rate limiting set to “0â€
###############################################################################
# By default, csf will auto-configure iptables to filter all traffic except on
# the loopback device. If you only want iptables rules applied to a specific
NIC, then list it here (e.g. eth1, or eth+)
# By adding a device to this option, ip6tables can be configured only on the
# specified device. Otherwise, ETH_DEVICE and then the default setting will be
# used
If you want to skip maybe your local intranet than an example would be eth2, eth+ means all networking devices will be protected.
# To switch from the deprecated iptables “state†module to the “conntrackâ€
# module, change this to 1
###############################################################################
# Configure csf to watch IP addresses (with csf -w [ip]). This option will add
# overhead to packet traversal through iptables and syslog logging, so should
# only be enabled while actively watching IP addresses. See readme.txt for more
# information on the use of this option
###############################################
Important Setup Email Address To Receive Logs
###############################################################################
# By default, lfd will send alert emails using the relevant alert template to
# the To: address configured within that template. Setting the following
# option will override the configured To: field in all lfd alert emails
#
#Leave this option empty to use the To: field setting in each alert template
# By default, lfd will send alert emails using the relevant alert template from
# the From: address configured within that template. Setting the following
# option will override the configured From: field in all lfd alert emails
#
# Leave this option empty to use the From: field setting in each alert template
# By default, lfd will send all alerts using the SENDMAIL binary. To send using
# SMTP directly, you can set the following to a relaying SMTP server, e.g.
# “127.0.0.1â€. Leave this setting blank to use SENDMAIL
IF YOU STILL CAN’T GET EMAIL FROM CSF LFD THAN TRY USING SMTP DIRECTLY BY CHANGING LF_ALERT_SMTP = “†to LF_ALERT_SMTP = “127.0.0.1†OR WHERE YOUR EMAIL SERVER IS LOCATED.
Â
Important! Make sure to Setup Login Failure Blocking for Specific Services
# SECTION:Login Failure Blocking and Alerts
###############################################################################
# The following[*] triggers are application specific. If you set #LF_TRIGGER to
# “0†the value of each trigger is the number of failures against that
# application that will trigger lfd to block the IP address
#
# If you set LF_TRIGGER to a value greater than “0†then the following[*]
# application triggers are simply on or off (“0″ or “1â€) and the value of
# LF_TRIGGER is the total cumulative number of failures that will #trigger lfd
# to block the IP address
#
# Setting the application trigger to “0†disables it
# block the IP address, or LF_TRIGGER_PERM can be set to a value #greater than
# “1†and the IP address will be blocked temporarily for that value in #seconds.
# For example:
# LF_TRIGGER_PERM = “1†=> the IP is blocked permanently
# LF_TRIGGER_PERM = “3600†=> the IP is blocked temporarily for 1 hour
#
# If LF_TRIGGER is “0â€, then the application LF_[application]_PERM value #works
# in the same way as above and LF_TRIGGER_PERM serves no function
Â
# To only block access to the failed application instead of a complete #block
# for an ip address, you can set the following to “1â€, but LF_TRIGGER #must be
# set to “0†with specific application[*] trigger levels also set #appropriately
#
# The ports that are blocked can be configured by changing the #PORTS_* options
LF_SELECT = “0â€
# Send an email alert if an IP address is blocked by one of the [*] #triggers
LF_EMAIL_ALERT = “1â€
# [*]Enable login failure detection of sshd connections
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_SSHD = “8â€
LF_SSHD_PERM = “1â€
# [*]Enable login failure detection of ftp connections
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_FTPD = “14â€
LF_FTPD_PERM = “1â€
LF_SMTPAUTH = “15â€
LF_SMTPAUTH_PERM = “1â€# [*]Enable syntax failure detection of Exim connections
LF_EXIMSYNTAX = “2â€
LF_EXIMSYNTAX_PERM = “1â€# [*]Enable login failure detection of pop3 connections
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_POP3D = “20â€
LF_POP3D_PERM = “1â€# [*]Enable login failure detection of imap connections
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_IMAPD = “20â€
LF_IMAPD_PERM = “1â€# [*]Enable login failure detection of Apache .htpasswd connections
# Due to the often high logging rate in the Apache error log, you might #want to
# enable this option only if you know you are suffering from attacks #against
# password protected directories
LF_HTACCESS = “â€
LF_HTACCESS_PERM = “1â€# [*]Enable failure detection of repeated Apache mod_security rule #triggers
LF_MODSEC = “3â€
LF_MODSEC_PERM = “1â€# [*]Enable detection of repeated BIND denied requests
# This option should be enabled with care as it will prevent blocked IPs #from
# resolving any domains on the server. You might want to set the #trigger value
# reasonably high to avoid this
# Example: LF_BIND = “100â€
LF_BIND = “100â€
LF_BIND_PERM = “1â€# [*]Enable detection of repeated suhosin ALERTs
# Example: LF_SUHOSIN = “5â€
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_SUHOSIN = “5â€
LF_SUHOSIN_PERM = “1â€# [*]Enable detection of repeated cxs ModSecurity mod_security rule #triggers
# This option will block IP addresses if cxs detects a hits from the
# ModSecurity rule associated with it
#
# Note: This option takes precedence over LF_MODSEC and removes #any hits
# counted towards LF_MODSEC for the cxs rule
#
# This setting should probably set very low, perhaps to 1, if you want #to
# effectively block IP addresses for this trigger option
LF_CXS = “1â€
LF_QOS = “2â€
LF_QOS_PERM = “1â€# [*]Enable detection of repeated Apache symlink race condition #triggers from
# the Apache patch provided by:
# http://www.mail-archive.com/dev@httpd.apache.org/msg55666.html
# This patch has also been included by cPanel via the easyapache #option:
# “Symlink Race Condition Protectionâ€
LF_SYMLINK = “2â€
LF_SYMLINK_PERM = “1â€# [*]Enable login failure detection of webmin connections
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_WEBMIN = “1â€
LF_WEBMIN_PERM = “1â€# Send an email alert if anyone logs in successfully using SSH
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_SSH_EMAIL_ALERT = “1â€# Send an email alert if anyone uses su to access another account. This #will
# send an email alert whether the attempt to use su was successful or #not
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_SU_EMAIL_ALERT = “1â€# Send an email alert if anyone accesses webmin
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_WEBMIN_EMAIL_ALERT = “1â€# Send an email alert if anyone logs in successfully to root on the #console
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_CONSOLE_EMAIL_ALERT = “1â€
# to send an alert in case a possible server compromise is detected
#
# To enable this feature set the following to the checking interval in #seconds
# (a value of 300 would seem sensible).
#
# To disable set to “0â€
LF_EXPLOIT = “300â€
If you want to Setup Directories that will be Watched for Changes
# SECTION:Directory Watching & Integrity
###############################################################################
# Enable Directory Watching. This enables lfd to check /tmp and /dev/shm
# directories for suspicious files, i.e. script exploits. If a suspicious
# file is found an email alert is sent. One alert per file per LF_FLUSH
# interval is sent
#
# To enable this feature set the following to the checking interval in seconds.
# To disable set to “0â€
LF_DIRWATCH = “1800â€# To remove any suspicious files found during directory watching, enable the
# following. These files will be appended to a tarball in
# /var/lib/csf/suspicious.tar
LF_DIRWATCH_DISABLE = “0â€# This option allows you to have lfd watch a particular file or directory for
# changes and should they change and email alert using watchalert.txt is sent
#
# To enable this feature set the following to the checking interval in seconds
# (a value of 60 would seem sensible) and add your entries to csf.dirwatch
#
# Set to disable set to “0â€
LF_DIRWATCH_FILE = “240â€
# SECTION:Distributed Attacks
###############################################################################
# Distributed Account Attack. This option will keep track of login #failures
# from distributed IP addresses to a specific application account. If the
# number of failures matches the trigger value above, ALL of the IP addresses
# involved in the attack will be blocked according to the temp/perm #rules above
#
# Tracking applies to LF_SSHD, LF_FTPD, LF_SMTPAUTH, LF_POP3D, #LF_IMAPD,
# LF_HTACCESS
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
# LF_DISTATTACK
Â
# Distributed FTP Logins. This option will keep track of successful FTP logins.
# If the number of successful logins to an individual account is at least
# LF_DISTFTP in LF_DIST_INTERVAL from at least LF_DISTFTP_UNIQ IP #addresses,
# then all of the IP addresses will be blocked
#
# This option can help mitigate the common FTP account compromise #attacks that
# use a distributed network of zombies to deface websites
#
# A sensible setting for this might be 5, depending on how many #different
# IP addresses you expect to an individual FTP account within #LF_DIST_INTERVAL
#
# To disable set to “0â€
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LF_DISTFTP = “8â€
# Set the following to the minimum number of unique IP addresses #that trigger
# LF_DISTFTP. LF_DISTFTP_UNIQ must be <= LF_DISTFTP for this to #work
LF_DISTFTP_UNIQ = “5â€
# If this option is set to 1 the blocks will be permanent
# If this option is > 1, the blocks will be temporary for the specified #number
# of seconds
LF_DISTFTP_PERM = “1â€
# Distributed SMTP Logins. This option will keep track of successful #SMTP
# logins. If the number of successful logins to an individual account is #at
# least LF_DISTSMTP in LF_DIST_INTERVAL from at least #LF_DISTSMTP_UNIQ IP
# addresses, then all of the IP addresses will be blocked. These options #only
# apply to the exim MTA
#
# This option can help mitigate the common SMTP account #compromise attacks that
# use a distributed network of zombies to send spam
## A sensible setting for this might be 5, depending on how many #different
# IP addresses you expect to an individual SMTP account within #LF_DIST_INTERVAL
#
# To disable set to “0â€
LF_DISTSMTP = “8â€
# Set the following to the minimum number of unique IP addresses #that trigger
# LF_DISTSMTP. LF_DISTSMTP_UNIQ must be <= LF_DISTSMTP for this #to work
LF_DISTSMTP_UNIQ = “4â€
# If this option is set to 1 the blocks will be permanent
# If this option is > 1, the blocks will be temporary for the specified #number
# of seconds
LF_DISTSMTP_PERM = “1â€
# This is the interval during which a distributed FTP or SMTP attack is
# measured
LF_DIST_INTERVAL = “300â€
###############################################################################
# SECTION:Login Tracking
###############################################################################
# Block POP3 logins if greater than LT_POP3D times per hour per #account per IP
# address (0=disabled)
#
# This is a temporary block for the rest of the hour, afterwhich the IP is
# unblocked
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LT_POP3D = “10â€
# Block IMAP logins if greater than LT_IMAPD times per hour per #account per IP
# address (0=disabled) – not recommended for IMAP logins due to the #ethos
# within which IMAP works. If you want to use this, setting it quite high #is
# probably a good idea
#
# This is a temporary block for the rest of the hour, afterwhich the IP is
# unblocked
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
LT_IMAPD = “30â€
# Send an email alert if an account exceeds LT_POP3D/LT_IMAPD logins #per hour
# per IP
LT_EMAIL_ALERT = “1â€
# If LF_PERMBLOCK is enabled but you do not want this to apply to
# LT_POP3D/LT_IMAPD, then enable this option
LT_SKIPPERMBLOCK = “0â€
# SECTION:Connection Tracking
###############################################################################
# Connection Tracking. This option enables tracking of all connections #from IP
# addresses to the server. If the total number of connections is greater #than
# this value then the offending IP address is blocked. This can be used #to help
# prevent some types of DOS attack.
#
# Care should be taken with this option. It’s entirely possible that you #will
# see false-positives. Some protocols can be connection hungry, e.g. #FTP, IMAPD
# and HTTP so it could be quite easy to trigger, especially with a lot of
# closed connections in TIME_WAIT. However, for a server that is prone #to DOS
# attacks this may be very useful. A reasonable setting for this option #might
# be around 300.
#
# To disable this feature, set this to 0
# connection tracking scans
Â
# Send an email alert if an IP address is blocked due to connection #tracking
CT_EMAIL_ALERT = “1â€
# If you want to make IP blocks permanent then set this to 1, otherwise #blocks
# will be temporary and will be cleared after CT_BLOCK_TIME seconds
CT_PERMANENT = “1â€
# If you opt for temporary IP blocks for CT, then the following is the #interval
# in seconds that the IP will remained blocked for (e.g. 1800 = 30 mins)
CT_BLOCK_TIME = “1800â€
# SECTION:Process Tracking
###############################################################################
# Process Tracking. This option enables tracking of user and nobody #processes
# and examines them for suspicious executables or open network #ports. Its
# purpose is to identify potential exploit processes that are running on #the
# server, even if they are obfuscated to appear as system services. If a
# suspicious process is found an alert email is sent with relevant #information.
# It is then the responsibility of the recipient to investigate the process
# further as the script takes no further action
#
# The following is the number of seconds a process has to be active #before it
# is inspected. If you set this time too low, then you will likely trigger
# false-positives with CGI or PHP scripts.
# Set the value to 0 to disable this feature
PT_INTERVAL = “60â€
# exceeds the memory usage set (MB). To ignore specific processes or #users use
# csf.pignore
#
# Set to 0 to disable this feature
# defaults to 5 if set otherwise) on the server every PT_LOAD seconds. If #the
# load average is greater than or equal to PT_LOAD_LEVEL then an #email alert is
# sent. lfd then does not report subsequent high load until #PT_LOAD_SKIP
# seconds has passed to prevent email floods.
#
# Set PT_LOAD to “0†to disable this feature
PT_LOAD_AVG = “5â€
PT_LOAD_LEVEL = “6â€
PT_LOAD_SKIP = “3600â€
# same session id and if greater than the value set, the whole session #tree is
# terminated and an alert sent
#
# You can see an example of common session id processes on most #Linux systems
# using: “ps axf -O sidâ€
#
# On cPanel servers, PT_ALL_USERS should be enabled to use this #option
# effectively
#
# This option will check root owned processes. Session id 0 and 1 will #always
# be ignored as they represent kernel and init processes. csf.pignore #will be
# honoured, but bear in mind that a session tree can contain a variety #of users
# and executables
#
# Care needs to be taken to ensure that this option only detects #runaway fork
# bombs, so should be set higher than any session tree is likely to get 3(e.g.
# httpd could have 100s of legitimate children on very busy systems). A
# sensible starting point on most servers might be 250
Important to Block Port Scan Attempts – Important
# SECTION:Port Scan Tracking
###############################################################################
# Port Scan Tracking. This feature tracks port blocks logged by #iptables to
# syslog. If an IP address generates a port block that is logged more #than
# PS_LIMIT within PS_INTERVAL seconds, the IP address will be blocked.
#
# This feature could, for example, be useful for blocking hackers #attempting
# to access the standard SSH port if you have moved it to a port other #than 22
# and have removed 22 from the TCP_IN list so that connection #attempts to the
# old port are being logged
#
# This feature blocks all iptables blocks from the iptables logs, #including
# repeated attempts to one port or SYN flood blocks, etc
#
# Note: This feature will only track iptables blocks from the log file set #in
# IPTABLES_LOG below and if you have DROP_LOGGING enabled. #However, it will
# cause redundant blocking with DROP_IP_LOGGING enabled
#
# Warning: It’s possible that an elaborate DDOS (i.e. from multiple IP’s)
# could very quickly fill the iptables rule chains and cause a DOS in #itself.
# The DENY_IP_LIMIT should help to mitigate such problems with #permanent blocks
# and the DENY_TEMP_IP_LIMIT with temporary blocks
#
# Set PS_INTERVAL to “0†to disable this feature. A value of between 60 #and 300
# would be sensible to enable this feature
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG #option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
# Port Scan Tracking feature. The following setting is a comma #separated list
# of those ports and uses the same format as TCP_IN. The default #setting of
# 0:65535,ICMP covers all ports
# To specify how many different ports qualifies as a Port Scan you can #increase
# the following from the default value of 1. The risk in doing so will #mean
# that persistent attempts to attack a specific closed port will not be
# detected and blocked
PS_DIVERSITY = “1â€
# or permanent. Set PS_PERMANENT to “0†for temporary and “1†for #permanent
# blocking. If set to “0†PS_BLOCK_TIME is the amount of time in #seconds to
# temporarily block the IP address for
PS_BLOCK_TIME = “3600â€
# “0†to disable them
PS_EMAIL_ALERT = “1â€
# SECTION:User ID Tracking
###############################################################################
# User ID Tracking. This feature tracks UID blocks logged by iptables to
# syslog. If a UID generates a port block that is logged more than UID_LIMIT
# times within UID_INTERVAL seconds, an alert will be sent
#
# Note: This feature will only track iptables blocks from the log file set in
# IPTABLES_LOG and if DROP_OUT_LOGGING and DROP_UID_LOGGING are enabled.
#
# To ignore specific UIDs list them in csf.uidignore and then restart lfd
#
# Set UID_INTERVAL to “0†to disable this feature. A value of between 60 and 300
# would be sensible to enable this feature
#
# SECURITY NOTE: This option is affected by the RESTRICT_SYSLOG option. Read
# this file about RESTRICT_SYSLOG before enabling this option:
UID_LIMIT = “10â€
# SECTION:Account Tracking
###############################################################################
# Account Tracking. The following options enable the tracking of modifications
# to the accounts on a server. If any of the enabled options are triggered by
# a modifications to an account, an alert email is sent. Only the modification
# is reported. The cause of the modification will have to be investigated
# manually
#
# You can set AT_ALERT to the following:
# 0 = disable this feature
# 1 = enable this feature for all accounts
# 2 = enable this feature only for superuser accounts (UID = 0, e.g. root, etc)
# 3 = enable this feature only for the root account
AT_ALERT = “1â€# This options is the interval between checks in seconds
AT_INTERVAL = “60â€# Send alert if a new account is created
AT_NEW = “1â€# Send alert if an existing account is deleted
AT_OLD = “1â€# Send alert if an account password has changed
AT_PASSWD = “1â€# Send alert if an account uid has changed
AT_UID = “1â€# Send alert if an account gid has changed
AT_GID = “1â€# Send alert if an account login directory has changed
AT_DIR = “1â€# Send alert if an account login shell has changed
AT_SHELL = “1â€
# SECTION:Log Scanner
###############################################################################
# Log Scanner. This feature will send out an email summary of the log lines of
# each log listed in /etc/csf/csf.logfiles. All lines will be reported unless
# they match a regular expression in /etc/csf/csf.logignore
#
# File globbing is supported for logs listed in /etc/csf/csf.logfiles. However,
# be aware that the more files lfd has to track, the greater the performance
# hit. Note: File globs are only evaluated when lfd is started
#
# Note: lfd builds the report continuously from lines logged after lfd has
# started, so any lines logged when lfd is not running will not be reported
# (e.g. during reboot). If lfd is restarted, then the report will include any
# lines logged during the previous lfd logging period that weren’t reported
#
# 1 to enable, 0 to disable
# template
#
# The interval can be set to:
# “hourly†– sent on the hour
# “daily†– sent at midnight (00:00)
# “manual†– sent whenever “csf –logrun†is run. This allows for scheduling
# via cron job
# Report Style
# 1 = Separate chronological log lines per log file
# 2 = Simply chronological log of all lines
LOGSCANNER_STYLE = “1â€
# Send the report email even if no log lines reported
# 1 to enable, 0 to disable
LOGSCANNER_EMPTY = “1â€
# Maximum number of lines in the report before it is truncated. This is to
# prevent log lines flooding resulting in an excessively large report. This
# might need to be increased if you choose a daily report
LOGSCANNER_LINES = “3000â€
Parallels Plesk Panel 12 Log File Locations:
# Log file locations
MODSEC_LOG = “/var/log/httpd/error_logâ€
SSHD_LOG = “/var/log/secureâ€
SU_LOG = “/var/log/secureâ€
FTPD_LOG = “/var/log/secureâ€
SMTPAUTH_LOG = “/usr/local/psa/var/log/maillogâ€
POP3D_LOG = “/usr/local/psa/var/log/maillogâ€
IMAPD_LOG = “/usr/local/psa/var/log/maillogâ€
IPTABLES_LOG = “/var/log/messagesâ€
SUHOSIN_LOG = “/var/log/messagesâ€
BIND_LOG = “/var/log/messagesâ€
SYSLOG_LOG = “/var/log/messagesâ€
WEBMIN_LOG = “/var/log/secureâ€
CUSTOM2_LOG = “/usr/local/psa/admin/logs/sitebuilder.logâ€
CUSTOM3_LOG = “/var/log/sw-cp-server/error_logâ€
CUSTOM4_LOG = “/var/www/vhosts/DOMAIN/logs/error_logâ€
CUSTOM6_LOG = “/var/www/vhosts/DOMAIN/logs/webmail_access_logâ€
CUSTOM7_LOG = “/usr/local/psa/admin/logs/panel.logâ€
CUSTOM10_LOG = “/var/log/nginx/error.logâ€
CUSTOM11_LOG = “/var/log/magicspam/mslogâ€
Now you need to edit the /etc/csf/csf.logfiles and add:
nano /etc/csf/csf.logfiles and make sure none are missing.
/var/log/lfd.log
/var/log/cxswatch.log
/var/log/secure
#/var/log/httpd/access_log
/var/log/httpd/error_log
/usr/local/psa/var/log/maillog
/usr/local/psa/admin/logs/panel.log
/var/log/nginx/error.log
Parallels Plesk Panel 12 Log File Locations:
/var/log/plesk/panel.log
/var/log/maillog
/var/log/psa-horde/psa-horde.log
/var/log/secure
/var/log/plesk-roundcube/errors
/usr/local/psa/admin/logs/sitebuilder.log
/var/log/httpd/error_log
/var/log/nginx/error.log
/var/log/sw-cp-server/error_log
/var/www/vhosts/*/logs/access_log
/var/www/vhosts/*/logs/access_log
#/var/log/nginx/access.log
Now you need to edit the /etc/csf/csf.logfiles and put in the correct logs.
Add CloudFlare Capabilities to your Plesk Panel Web Hosting Server
nano /etc/csf/csf.blocklists
You will can add IP Block Lists adding some cloudflare capabilities to your plesk panel 12 web hosting services.
Uncomment:
#Spamhaus Don’t Route Or Peer List (DROP)
# Details: http://www.spamhaus.org/drop/
SPAMDROP|86400|0|http://www.spamhaus.org/drop/drop.lasso
# Spamhaus Extended DROP List (EDROP)
# Details: http://www.spamhaus.org/drop/
SPAMEDROP|86400|0|http://www.spamhaus.org/drop/edrop.lasso
# DShield.org Recommended Block List
# Details: http://dshield.org
DSHIELD|86400|0|http://www.dshield.org/block.txt
# Details: http://www.team-cymru.org/Services/Bogons/
# Details: http://www.projecthoneypot.org
# C.I. Army Malicious IP List
# Details: http://www.ciarmy.com
# Details: http://danger.rulez.sk/index.php/bruteforceblocker/
# Details:
# Details: http://www.openbl.org
# Details: http://www.autoshun.org/
# Details: http://www.maxmind.com/en/anonymous_proxies
#To use this list you’ll probably need vhange URLGET in csf.conf to use
#LWP asthis list uses an SSL connection.Alternatively use ALTTORbelow
#Detai-https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList
# Details: http://torstatus.blutmagie.de/
################################################################################################
Adding legitimate files to be ignored in /etc/csf/csf.pignore
it will basically tell you in the log report sent to your email address on which commands, executables and users to start adding to /etc/csf/csf.pignore . After you put our csf.pignore template inside /etc/csf/csf.pignore . you might have other processes and users you will have to ignore depending on which other services you’re providing.
## Custom Added ##
exe:/opt/drweb/drwebd.real
cmd:drwebd.real
user:drweb
user:apache
exe:/usr/sbin/httpd
cmd:/usr/sbin/httpd
user:nginx
exe:/usr/sbin/nginx
cmd:/usr/sbin/nginx
cmd:nginx: worker process
user:postfix
exe:/usr/lib64/plesk-9.0/psa-pc-remote
cmd:/usr/lib64/plesk-9.0/psa-pc-remote -p inet:12768@localhost
exe:/usr/libexec/postfix/tlsmgr
cmd:tlsmgr -l -t unix -u
exe:/usr/libexec/postfix/qmgr
cmd:qmgr -l -t fifo -u
exe:/usr/bin/php-cgi
user:hspc
exe:/usr/bin/perl
cmd:/usr/bin/perl /usr/sbin/hspc-plugin-rpc.fcgi
# Plesk process/user template #
user:admin
exe:/var/qmail/bin/qmail-smtpd
exe:/usr/bin/imapd
exe:/var/qmail/bin/qmail-queue
exe:/usr/bin/pop3d
exe:/var/qmail/bin/qmail-send
cmd:qmail-send
cmd:/usr/bin/pop3d Maildir
cmd:/var/qmail/bin/qmail-queue
cmd:/var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
cmd:/usr/bin/imapd Maildir
exe:/var/qmail/bin/qmail-rspawn
cmd:qmail-rspawn
exe:/var/qmail/bin/qmail-clean
cmd:qmail-clean
exe:/usr/sbin/clamd
cmd:clamd
exe:/var/qmail/bin/splogger
cmd:splogger qmail
exe:/var/qmail/bin/qmail-remote.moved
user:qmaill
user:popuser
user:qmaild
user:qmails
user:qmailr
user:qmailq
user:qscand
exe:/usr/sbin/avahi-daemon
user:avahi
exe:/usr/local/sbin/zabbix_agentd
cmd:/usr/local/sbin/zabbix_agentd
user:zabbix
exe:/usr/bin/sw-engine-cgi
cmd:/usr/bin/sw-engine-cgi
user:sso
exe:/usr/sbin/sw-cp-serverd
cmd:/usr/sbin/sw-cp-serverd -f /etc/sw-cp-server/config
user:sw-cp-server
exe:/usr/bin/sw-engine-cgi
cmd:/usr/bin/sw-engine-cgi -c /usr/local/psa/admin/conf/php.ini -d auto_prepend_file=auth.php3 -u psaadm
user:psaadm
exe:/usr/libexec/mysqld
cmd:/usr/libexec/mysqld -basedir=/usr -datadir=/var/lib/mysql -user=mysql -pid-file=/var/run/mysqld/mysqld.pid -skip-external-locking -socket=/var/lib/mysql/m$
user:mysql
exe:/usr/libexec/hald-addon-acpi
exe:/usr/sbin/hald
cmd:hald
user:haldaemon
exe:/usr/bin/postgres
user:postgres
exe:/sbin/portmap
cmd:portmap
user:rpc
exe:/usr/bin/xfs
cmd:xfs -droppriv -daemon
user:xfs
exe:/usr/bin/python
cmd:/usr/bin/python /usr/lib/mailman/bin/qrunner -runner=VirginRunner:0:1 -s
user:mailman
exe:/usr/java/jdk1.6.0_20/bin/java
user:tomcat
You have now successfully installed CSF / LFD configserver on your server.
Enable CSF
csf –e
Disable CSF
csf -x
Starting CSF
csf -s
Ban IP:
csf -d 1.2.3.4
Stop CSF
csf –stop
Flush CSF
csf -f
Stop LFD
service lfd stop
Start LFD
service lfd star