Skip to content

Cheatsheet: Structure ΒΆ

This page provides a summary of the files and folders associated with ConfigServer Security & Firewall (CSF). Use it as a reference to locate and edit specific configuration files or resources.


πŸ“ Directory StructureΒΆ

Directories associated with ConfigServer Filewall which house all of the files used to configure and manage CSF.

Folder Description
/etc/csf/ CSF configuration files, blocklists, whitelists, etc
/var/lib/csf/ Runtime data, temporary files, and logs for CSF and LFD
/var/lib/csf/ui Runtime data and cache for the CSF WebUI.
/usr/local/csf/bin/ Pre & post initialzation scripts csfpre.sh and csfpost.sh, test script csftest.pl, and csf uninstaller uninstall.sh
/usr/local/csf/lib/ Perl modules and static data
/usr/local/csf/profiles/ Pre-configured CSF setup profiles
/usr/local/csf/tpl/ Email alert templates
/usr/local/include/csf/pre.d/ Scripts to execute when CSF started. Runs before CSF configures iptables. These are triggered by /usr/local/csf/bin/csfpre.sh
/usr/local/include/csf/post.d/ Scripts to execute when CSF started. Runs after CSF configures iptables. These are triggered by /usr/local/csf/bin/csfpost.sh




πŸ“„ File StructureΒΆ

Files associated with ConfigServer Firewall configuration and management.

File Description
/etc/csf/changelog.txt List of changes made to each release of CSF / LFD
/etc/csf/cpanel.allow List of addresses allowed through iptables for unimpeded access to cpanel license servers
/etc/csf/cpanel.comodo.allow List of Sectigo (Comodo) IPs explicitly allowed through iptables to ensure AutoSSL connections are never blocked.
/etc/csf/cpanel.comodo.ignore List of Sectigo (Comodo) IPs ignored by LFD’s login/banning system to prevent them from being auto-blocked.
/etc/csf/cpanel.allow List of addresses which ensure traffic from cPanel’s license servers is explicitly allowed through iptables.
/etc/csf/cpanel.ignore List of addresses from cPanel’s license servers that are excluded from LFD (Login Failure Daemon) monitoring.
/etc/csf/csf.allow List of IP's & CIDR addresses allowed through the firewall
/etc/csf/csf.blocklists URLs for external blocklists used by CSF to block malicious IPs
/etc/csf/csf.cloudflare Contains configuration elements for the CF_ENABLE CloudFlare feature
/etc/csf/csf.conf Main configuration file
/etc/csf/csf.deny IP's and CIDR addresses that should never be allowed through the firewall
/etc/csf/csf.dirwatch Directories & files you want to be alerted when changed. Must specify full paths for entries
/etc/csf/csf.dyndns IPs & hostnames of systems that are dynamically updated (like via a dynamic DNS service)
/etc/csf/csf.fignore Files that lfd directory watching will ignore. You must specify the full path to the file
/etc/csf/csf.ignore IP's & CIDR addresses that the login failure daemon should ignore and not not block if detected
/etc/csf/csf.logfiles Log files for the LOGSCANNER feature
/etc/csf/csf.logignore Regular expressions for the LOGSCANNER feature. If a line matches it will be ignored, otherwise it will be reported
/etc/csf/csf.mignore Usernames and local IP addresses that RT_LOCALRELAY_ALERT will ignore
/etc/csf/csf.pignore Processes LFD should ignore (for example, trusted services).
/etc/csf/csf.rblconf Optional entries for the IP checking against RBLs within csf
/etc/csf/csf.redirect Port and/or IP address assignments to direct traffic to alternative ports/IP addresses
/etc/csf/csf.resellers Reseller accounts to allow access to limited csf functionality.
/etc/csf/csf.rignore Domains & partial domain that lfd process tracking will ignore based on reverse & forward DNS lookups
/etc/csf/csf.signore Files that LF_SCRIPT_ALERT will ignore. Specify the full path to the directory containing the script
/etc/csf/csf.sips List any server configured IP addresses for which you don't want to allow any incoming or outgoing traffic
/etc/csf/csf.smtpauth Will allow EXIM to advertise SMTP AUTH. One IP address per line.
/etc/csf/csf.suignore Usernames that are ignored during the LF_EXPLOIT SUPERUSER check
/etc/csf/csf.syslogs Log files for the UI System Log Watch and Search features. IF they exists they will apear in the drop-down lists
/etc/csf/csf.syslogusers Usernames which should be allowed to log via syslog/rsyslog
/etc/csf/csf.uidignore User ID's (UID) that are ignored by the User ID Tracking feature
/etc/csf/downloadservers Servers that will be pinged to fetch updates for CSF
/etc/csf/ui/ui.allow IPs allowed to access the CSF WebUI. IPs in this file bypass CSF's IP restrictions for the web ui
/etc/csf/ui/ui.ban IPs that are explicitly denied access to the CSF WebUI
/lib/systemd/system/csf.service Service file for csf (Login Failure Daemon)
/lib/systemd/system/lfd.service Service file for lfd (ConfigServer Firewall)
/var/lib/csf/lfd.log Main LFD log file recording login attempts, blocked IPs, and alerts.
/var/lib/csf/lfd.pid PID file for Login Failure Daemon (LFD).




Advanced StructureΒΆ

We have provided a very detailed tree below that make up CSF and LFD's entire structure. This assists you with locating specific files that you may need to modify. Each file or folder will contain an icon; we have provided a list below to be used as an icon lenend:


/etc/csf/ΒΆ

The files within the subfolder /etc/csf contain most of your configurable files, including the main csf.conf configuration file. This location also holds all of your allow and block lists that will be used to restrict access to your server and to your CSF web interface (if enabled).

└── etc
     └── csf
         β”œβ”€β”€ alerts -> /usr/local/csf/tpl
         β”œβ”€β”€ changelog.txt
         β”œβ”€β”€ cpanel.allow
         β”œβ”€β”€ cpanel.comodo.allow
         β”œβ”€β”€ cpanel.comodo.ignore
         β”œβ”€β”€ cpanel.ignore
         β”œβ”€β”€ csf.allow
         β”œβ”€β”€ csf.blocklists
         β”œβ”€β”€ csf.cloudflare
         β”œβ”€β”€ csf.conf
         β”œβ”€β”€ csf.deny
         β”œβ”€β”€ csf.dirwatch
         β”œβ”€β”€ csf.dyndns
         β”œβ”€β”€ csf.fignore
         β”œβ”€β”€ csf.ignore
         β”œβ”€β”€ csf.logfiles
         β”œβ”€β”€ csf.logignore
         β”œβ”€β”€ csf.mignore
         β”œβ”€β”€ csf.pignore
         β”œβ”€β”€ csf.pl -> /usr/sbin/csf
         β”œβ”€β”€ csf.rblconf
         β”œβ”€β”€ csf.redirect
         β”œβ”€β”€ csf.resellers
         β”œβ”€β”€ csf.rignore
         β”œβ”€β”€ csf.signore
         β”œβ”€β”€ csf.sips
         β”œβ”€β”€ csf.smtpauth
         β”œβ”€β”€ csf.suignore
         β”œβ”€β”€ csf.syslogs
         β”œβ”€β”€ csf.syslogusers
         β”œβ”€β”€ csftest.pl -> /usr/local/csf/bin/csftest.pl
         β”œβ”€β”€ csf.uidignore
         β”œβ”€β”€ csfwebmin.tgz -> /usr/local/csf/csfwebmin.tgz
         β”œβ”€β”€ downloadservers
         β”œβ”€β”€ install.txt
         β”œβ”€β”€ lfd.pl -> /usr/sbin/lfd
         β”œβ”€β”€ license.txt
         β”œβ”€β”€ messenger
         β”‚   β”œβ”€β”€ en.php
         β”‚   β”œβ”€β”€ index.html
         β”‚   β”œβ”€β”€ index.php
         β”‚   β”œβ”€β”€ index.recaptcha.html
         β”‚   β”œβ”€β”€ index.recaptcha.php
         β”‚   └── index.text
         β”œβ”€β”€ pt_deleted_action.pl -> /usr/local/csf/bin/pt_deleted_action.pl
         β”œβ”€β”€ readme.txt
         β”œβ”€β”€ regex.custom.pm -> /usr/local/csf/bin/regex.custom.pm
         β”œβ”€β”€ remove_apf_bfd.sh -> /usr/local/csf/bin/remove_apf_bfd.sh
         β”œβ”€β”€ ui
         β”‚   β”œβ”€β”€ images
         β”‚   β”‚   β”œβ”€β”€ admin_icon.svg
         β”‚   β”‚   β”œβ”€β”€ bootstrap
         β”‚   β”‚   β”‚   β”œβ”€β”€ css
         β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ bootstrap.min.css
         β”‚   β”‚   β”‚   β”‚   └── bootstrap.min.css.map
         β”‚   β”‚   β”‚   β”œβ”€β”€ fonts
         β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.eot
         β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.svg
         β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.ttf
         β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.woff
         β”‚   β”‚   β”‚   β”‚   └── glyphicons-halflings-regular.woff2
         β”‚   β”‚   β”‚   └── js
         β”‚   β”‚   β”‚       └── bootstrap.min.js
         β”‚   β”‚   β”œβ”€β”€ bootstrap-chosen.css
         β”‚   β”‚   β”œβ”€β”€ chosen.min.css
         β”‚   β”‚   β”œβ”€β”€ chosen.min.js
         β”‚   β”‚   β”œβ”€β”€ chosen-sprite@2x.png
         β”‚   β”‚   β”œβ”€β”€ chosen-sprite.png
         β”‚   β”‚   β”œβ”€β”€ configserver.css
         β”‚   β”‚   β”œβ”€β”€ csf-loader.gif
         β”‚   β”‚   β”œβ”€β”€ csf-logo-alt.svg
         β”‚   β”‚   β”œβ”€β”€ csf-logo.svg
         β”‚   β”‚   β”œβ”€β”€ csf_small.png
         β”‚   β”‚   β”œβ”€β”€ csf.svg
         β”‚   β”‚   β”œβ”€β”€ jquery.min.js
         β”‚   β”‚   β”œβ”€β”€ LICENSE.txt
         β”‚   β”‚   β”œβ”€β”€ loader.gif
         β”‚   β”‚   └── reseller_icon.svg
         β”‚   β”œβ”€β”€ server.crt
         β”‚   β”œβ”€β”€ server.key
         β”‚   β”œβ”€β”€ ui.allow
         β”‚   └── ui.ban
         β”œβ”€β”€ uninstall.sh -> /usr/local/csf/bin/uninstall.sh
         β”œβ”€β”€ version.txt
         └── webmin -> /usr/local/csf/lib/webmin


/usr/local/csf/ΒΆ

The files and subfolders of this path contain most of the functionality for CSF and LFD. For most scenarios, you should not need to modify any of the files here.

The one exception is the tpl subfolder, which contains all of the email alert templates. However, you can also find these within /etc/csf/alerts

└── usr
    β””── local
        β””── csf
            β”œβ”€β”€ bin
            β”‚   β”œβ”€β”€ csfpre.sh
            β”‚   β””── csfpost.sh
            β”‚   β”œβ”€β”€ csftest.pl
            β”‚   β”œβ”€β”€ pt_deleted_action.pl
            β”‚   β”œβ”€β”€ regex.custom.pm
            β”‚   β”œβ”€β”€ remove_apf_bfd.sh
            β”‚   └── uninstall.sh
            β”œβ”€β”€ csfwebmin.tgz
            β”œβ”€β”€ lib
            β”‚   β”œβ”€β”€ ConfigServer
            β”‚   β”‚   β”œβ”€β”€ AbuseIP.pm
            β”‚   β”‚   β”œβ”€β”€ CheckIP.pm
            β”‚   β”‚   β”œβ”€β”€ CloudFlare.pm
            β”‚   β”‚   β”œβ”€β”€ Config.pm
            β”‚   β”‚   β”œβ”€β”€ cseUI.pm
            β”‚   β”‚   β”œβ”€β”€ DisplayResellerUI.pm
            β”‚   β”‚   β”œβ”€β”€ DisplayUI.pm
            β”‚   β”‚   β”œβ”€β”€ GetEthDev.pm
            β”‚   β”‚   β”œβ”€β”€ GetIPs.pm
            β”‚   β”‚   β”œβ”€β”€ KillSSH.pm
            β”‚   β”‚   β”œβ”€β”€ Logger.pm
            β”‚   β”‚   β”œβ”€β”€ LookUpIP.pm
            β”‚   β”‚   β”œβ”€β”€ Messenger.pm
            β”‚   β”‚   β”œβ”€β”€ Ports.pm
            β”‚   β”‚   β”œβ”€β”€ RBLCheck.pm
            β”‚   β”‚   β”œβ”€β”€ RBLLookup.pm
            β”‚   β”‚   β”œβ”€β”€ RegexMain.pm
            β”‚   β”‚   β”œβ”€β”€ Sanity.pm
            β”‚   β”‚   β”œβ”€β”€ Sendmail.pm
            β”‚   β”‚   β”œβ”€β”€ ServerCheck.pm
            β”‚   β”‚   β”œβ”€β”€ ServerStats.pm
            β”‚   β”‚   β”œβ”€β”€ Service.pm
            β”‚   β”‚   β”œβ”€β”€ Slurp.pm
            β”‚   β”‚   └── URLGet.pm
            β”‚   β”œβ”€β”€ Crypt
            β”‚   β”‚   β”œβ”€β”€ Blowfish_PP.pm
            β”‚   β”‚   └── CBC.pm
            β”‚   β”œβ”€β”€ csfajaxtail.js
            β”‚   β”œβ”€β”€ csf.div
            β”‚   β”œβ”€β”€ csf.help
            β”‚   β”œβ”€β”€ csf.rbls
            β”‚   β”œβ”€β”€ HTTP
            β”‚   β”‚   └── Tiny.pm
            β”‚   β”œβ”€β”€ JSON
            β”‚   β”‚   └── Tiny.pm
            β”‚   β”œβ”€β”€ Net
            β”‚   β”‚   β”œβ”€β”€ CIDR
            β”‚   β”‚   β”‚   └── Lite.pm
            β”‚   β”‚   └── IP.pm
            β”‚   β”œβ”€β”€ restricted.txt
            β”‚   β”œβ”€β”€ sanity.txt
            β”‚   β”œβ”€β”€ version
            β”‚   β”‚   β”œβ”€β”€ regex.pm
            β”‚   β”‚   └── vpp.pm
            β”‚   β”œβ”€β”€ version.pm
            β”‚   └── webmin
            β”‚       └── csf
            β”‚           β”œβ”€β”€ images
            β”‚           β”‚   β”œβ”€β”€ admin_icon.svg
            β”‚           β”‚   β”œβ”€β”€ bootstrap
            β”‚           β”‚   β”‚   β”œβ”€β”€ css
            β”‚           β”‚   β”‚   β”‚   β”œβ”€β”€ bootstrap.min.css
            β”‚           β”‚   β”‚   β”‚   └── bootstrap.min.css.map
            β”‚           β”‚   β”‚   β”œβ”€β”€ fonts
            β”‚           β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.eot
            β”‚           β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.svg
            β”‚           β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.ttf
            β”‚           β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.woff
            β”‚           β”‚   β”‚   β”‚   └── glyphicons-halflings-regular.woff2
            β”‚           β”‚   β”‚   └── js
            β”‚           β”‚   β”‚       └── bootstrap.min.js
            β”‚           β”‚   β”œβ”€β”€ bootstrap-chosen.css
            β”‚           β”‚   β”œβ”€β”€ chosen.min.css
            β”‚           β”‚   β”œβ”€β”€ chosen.min.js
            β”‚           β”‚   β”œβ”€β”€ chosen-sprite@2x.png
            β”‚           β”‚   β”œβ”€β”€ chosen-sprite.png
            β”‚           β”‚   β”œβ”€β”€ configserver.css
            β”‚           β”‚   β”œβ”€β”€ csf-loader.gif
            β”‚           β”‚   β”œβ”€β”€ csf-logo-alt.svg
            β”‚           β”‚   β”œβ”€β”€ csf-logo.svg
            β”‚           β”‚   β”œβ”€β”€ csf_small.png
            β”‚           β”‚   β”œβ”€β”€ csf.svg
            β”‚           β”‚   β”œβ”€β”€ jquery.min.js
            β”‚           β”‚   β”œβ”€β”€ LICENSE.txt
            β”‚           β”‚   β”œβ”€β”€ loader.gif
            β”‚           β”‚   └── reseller_icon.svg
            β”‚           β”œβ”€β”€ index.cgi
            β”‚           └── module.info
            β”œβ”€β”€ profiles
            β”‚   β”œβ”€β”€ block_all_perm.conf
            β”‚   β”œβ”€β”€ block_all_temp.conf
            β”‚   β”œβ”€β”€ disable_alerts.conf
            β”‚   β”œβ”€β”€ protection_high.conf
            β”‚   β”œβ”€β”€ protection_low.conf
            β”‚   β”œβ”€β”€ protection_medium.conf
            β”‚   └── reset_to_defaults.conf
            β””── tpl
                β”œβ”€β”€ accounttracking.txt
                β”œβ”€β”€ alert.txt
                β”œβ”€β”€ apache.https.txt
                β”œβ”€β”€ apache.http.txt
                β”œβ”€β”€ apache.main.txt
                β”œβ”€β”€ connectiontracking.txt
                β”œβ”€β”€ consolealert.txt
                β”œβ”€β”€ cpanelalert.txt
                β”œβ”€β”€ exploitalert.txt
                β”œβ”€β”€ filealert.txt
                β”œβ”€β”€ forkbombalert.txt
                β”œβ”€β”€ integrityalert.txt
                β”œβ”€β”€ litespeed.https.txt
                β”œβ”€β”€ litespeed.http.txt
                β”œβ”€β”€ litespeed.main.txt
                β”œβ”€β”€ loadalert.txt
                β”œβ”€β”€ logalert.txt
                β”œβ”€β”€ logfloodalert.txt
                β”œβ”€β”€ modsecipdbalert.txt
                β”œβ”€β”€ netblock.txt
                β”œβ”€β”€ permblock.txt
                β”œβ”€β”€ portknocking.txt
                β”œβ”€β”€ portscan.txt
                β”œβ”€β”€ processtracking.txt
                β”œβ”€β”€ queuealert.txt
                β”œβ”€β”€ recaptcha.txt
                β”œβ”€β”€ relayalert.txt
                β”œβ”€β”€ resalert.txt
                β”œβ”€β”€ reselleralert.txt
                β”œβ”€β”€ scriptalert.txt
                β”œβ”€β”€ sshalert.txt
                β”œβ”€β”€ sualert.txt
                β”œβ”€β”€ sudoalert.txt
                β”œβ”€β”€ syslogalert.txt
                β”œβ”€β”€ tracking.txt
                β”œβ”€β”€ uialert.txt
                β”œβ”€β”€ uidscan.txt
                β”œβ”€β”€ usertracking.txt
                β”œβ”€β”€ watchalert.txt
                β”œβ”€β”€ webminalert.txt
                β””── x-arf.txt


/usr/local/include/csf/ΒΆ

This folder contains your own custom pre and post initialization scripts for CSF. These scripts control the execution of custom Bash scripts before and after CSF applies firewall rules to your IP tables.

  • Drop custom bash scripts in the pre.d folder if you want to modify your iptables before CSF injects its own rules into iptables.
  • Drop custom bash scripts in the post.d folder if you want to modify your iptables after CSF injects its own rules into iptables.

└── usr
    β””── local
        β””── include
            β””── csf
                β””── pre.d
                    β””── custom_script.sh
                β””── post.d
                    β””── custom_script.sh


/var/lib/csf/ΒΆ

This folder contains your csf.conf backups and also stores files generated by the integrated statistics module, including charts. While backups can be accessed directly from the CSF web interface, this folder is primarily for internal use. You generally won’t need to interact with it, and it’s important not to modify any of the files stored here.

└── var
    β””── lib
        β””── csf
            β””── backup
            β”‚   └── 1759876810_pre_v15_01_upgrade
            β”œβ”€β”€ Geo
            β”œβ”€β”€ lock
            β”‚   └── command.lock
            β”œβ”€β”€ stats
            β”œβ”€β”€ ui
            β”œβ”€β”€ webmin
            β””── zone


/usr/sbin/ΒΆ

The /usr/sbin folder contains the two most important files, which are the main CSF and LFD binary files. These files are responsible for how CSF and LFD behave and contain the core code.

└── user
     └── sbin
         β”œβ”€β”€ csf
         └── lfd


/lib/systemd/systemΒΆ

The /usr/sbin folder contains the CSF and LFD services which are responsible for bringing the two servces online.

└── lib
     └── systemd
     └── system
         β”œβ”€β”€ csf.service
         └── lfd.service




Patcher FilesΒΆ

The following files are associated with the ConfigServer Firewall scripts located in this repo's extras/scripts folder. These scripts add special iptable rules so that CSF can communicate with Docker & OpenVPN.

File Description
/usr/local/csf/bin/csfpre.sh Loader for pre scripts. Runs before CSF adds firewall rules.
/usr/local/csf/bin/csfpost.sh Loader for post scripts. Runs after CSF adds firewall rules.
/usr/local/include/csf/post.d/docker.sh Patch adds specific Docker network compatibility to CSF.
/usr/local/include/csf/post.d/openvpn.sh Patch adds specific OpenVPN rules to CSF to allow VPN connections.