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.dfolder if you want to modify your iptables before CSF injects its own rules into iptables. - Drop custom bash scripts in the
post.dfolder 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. |