-
Notifications
You must be signed in to change notification settings - Fork 258
CSF Command Line Options
Home · Start Here · Reference Map
- Primary CSF configuration files and their purposes.
- How comments, rotation, and
do not deleteprotection work. - Include-based config composition for maintainable setups.
- CLI vs file-edit syntax differences.
| Your intent | Go to |
|---|---|
| Config file reference, Include support, comment rules (you're here) | This page |
| Quick syntax lookup for CLI commands | Cheatsheet: Commands |
| Step-by-step workflow with context and warnings | CLI Guide |
Before configuring CSF for the first time, validate your system supports the required netfilter modules:
perl /etc/csf/csftest.plFor full command help:
man csf
csf -hFor a compact command reference, see Cheatsheet: Commands. For workflow-oriented guidance, see CLI Guide.
| File | Purpose |
|---|---|
/etc/csf/csf.conf |
Main behavior and feature toggles — the primary config file with inline documentation |
/etc/csf/csf.allow |
Permanent allow entries (IPs and CIDRs that always pass the firewall) |
/etc/csf/csf.deny |
Permanent deny entries (IPs and CIDRs that are always blocked) |
/etc/csf/csf.ignore |
Entries LFD should not auto-block (exempts from login failure detection) |
/etc/csf/csf.*ignore |
Feature-specific ignore files — see each file for its purpose and syntax |
If you modify any of these files directly, you must restart CSF and LFD (csf -ra) for changes to take effect. CLI commands (csf -a, csf -d, etc.) handle the restart automatically.
In csf.allow and csf.deny, keep comments on the same line as the IP using <space>#<space>:
11.22.33.44 # Added because I don't like them
Important: Comments on a separate line will be lost during
csf.denyrotation cleanup.
When using CLI commands, do not use # — pass the comment as plain text:
csf -d 11.22.33.44 Added because I don't like themCLI-added comments are automatically timestamped. LFD-triggered blocks also include a descriptive comment with timestamp.
csf.deny has a line limit (DENY_IP_LIMIT). When the limit is reached, older entries are rotated out. To protect a specific entry from rotation, include do not delete in the comment:
11.22.33.44 # Added because I don't like them. do not delete
- Run
csftest.plbefore first enablement and after major kernel/network changes. - Edit the target config files.
- Keep comments on the same line as the IP/rule.
- Reload with
csf -raso changes apply to both CSF and LFD. - Verify behavior in
/var/log/lfd.log.
For a more detailed safe change workflow with pitfall prevention, see CLI Guide → Safe change workflow.
Use Include /full/path/file in supported files to split policy by environment, team, or automation layer.
Example in csf.allow:
Include /etc/csf/csf.alsoallow
Rules:
- Include paths must be absolute.
- Do not append trailing comments to an
Includeline — this invalidates the line. - CSF add/remove commands apply to the primary file only, not Include files (Include files are treated as read-only by the CLI).
| Config file | Purpose |
|---|---|
/etc/csf/csf.allow |
Permanent allow list |
/etc/csf/csf.blocklists |
External block list sources |
/etc/csf/csf.cloudflare |
Cloudflare integration config |
/etc/csf/csf.deny |
Permanent deny list |
/etc/csf/csf.dirwatch |
Directory watch paths |
/etc/csf/csf.dyndns |
Dynamic DNS hostnames |
/etc/csf/csf.fignore |
File integrity check ignores |
/etc/csf/csf.ignore |
LFD ignore list |
/etc/csf/csf.logfiles |
Custom log files for LFD monitoring |
/etc/csf/csf.logignore |
Log scanner ignore patterns |
/etc/csf/csf.mignore |
Messenger ignore list |
/etc/csf/csf.pignore |
Process tracking ignores |
/etc/csf/csf.rblconf |
RBL lookup configuration |
/etc/csf/csf.redirect |
Port/IP redirection rules |
/etc/csf/csf.rignore |
Resource usage ignore list |
/etc/csf/csf.signore |
Script tracking ignores |
/etc/csf/csf.sips |
Server IP addresses |
/etc/csf/csf.smtpauth |
SMTP auth restriction list |
/etc/csf/csf.suignore |
Superuser tracking ignores |
/etc/csf/csf.syslogs |
Syslog source files |
/etc/csf/csf.syslogusers |
Syslog user list |
/etc/csf/csf.uidignore |
User ID tracking ignores |
Last reviewed: 2026-02-25
← Previous: lfd Principles · Next: lfd Command Line Options
- Security Features Guide
- Cloud & Container Hardening
- Automation & IaC
- IPv6 Deployment & Hardening
- IP Block Lists
- Reference Map
- Introduction
- csf Principles
- lfd Principles
- csf CLI Options
- lfd CLI Options
- Login Tracking
- Regex Custom Cookbook
- Script Email Alerts
- Process Tracking
- Directory Watching
- Advanced Filters
- Multiple Ethernet
- Generic Linux
- FTP Issues
- Messenger Service
- Block Reporting
- Port Flood
- Pre/Post Scripts
- Port Knocking
- Connection Limit
- Port/IP Redirect
- Integrated UI
- RESTRICT_SYSLOG
- Exim SMTP AUTH
- UI Skinning
- InterWorx
- CentOS Web Panel