CSchantz Wiki

CSF Quick guide

CSF quick guide

Whitelist an IP (Permanent Allow)

csf -a 192.168.1.1
csf -a 192.168.1.1 "Reason"

Block an IP (Permanent Deny)

csf -d 192.168.1.1
csf -d 192.168.1.1 "Reason"

Temporary Block (Auto-expires)

# Block for 1 hour (3600 seconds) 

csf -td 192.168.1.1 3600 "reason"

# Block for 24 hours

csf -td 192.168.1.1 86400 "reason"

Temporary Allow

csf -ta 192.168.1.1 3600 "reason"

Common Time Values (seconds)

Duration Seconds
15 min 900
1 hour 3600
4 hours 14400
24 hours 86400
7 days 604800
30 days 2592000

Remove an IP from Deny List

csf -dr 192.168.1.1

Remove an IP from Allow List

csf -ar 192.168.1.1

Remove from Temp Lists

# Remove from temp deny 

csf -trd 192.168.1.1

# Remove from temp allow

csf -tra 192.168.1.1

Check if an IP is Blocked/Allowed

# Search all lists (allow, deny, temp, iptables)

csf -g 192.168.1.1

Reload / Restart

# Restart CSF (reloads rules)

csf -r

# Restart LFD (login failure daemon)

csf -lf

View Lists

# View temp deny/allow lists

csf -t

# View permanent allow list

cat /etc/csf/csf.allow

# View permanent deny list

cat /etc/csf/csf.deny

Flush All Rules

# Stop CSF (removes all firewall rules!)

csf -f

# Start it back up

csf -s