Skip to content

Instantly share code, notes, and snippets.

@mdpuma
Last active May 10, 2026 09:13
Show Gist options
  • Select an option

  • Save mdpuma/180d125137295bfb7728939774e92e7e to your computer and use it in GitHub Desktop.

Select an option

Save mdpuma/180d125137295bfb7728939774e92e7e to your computer and use it in GitHub Desktop.
change csf/lfd firewall to cphulk blocking
#!/bin/bash
iptables -N DROP_OUT_HTTP
iptables -A DROP_OUT_HTTP -j LOG --log-prefix "DROP_OUT_HTTP: " --log-uid
iptables -A DROP_OUT_HTTP -p tcp --syn -j REJECT --reject-with tcp-reset
iptables -N OUT_HTTP
#iptables -A OUT_HTTP -p tcp -m owner --uid-owner tucanorate -j DROP_OUT_HTTP
iptables -A OUT_HTTP -p tcp -m string --string "HTTP" --algo kmp --to 100 -j NFLOG --nflog-group 5
iptables -A OUT_HTTP -p tcp --syn -j LOG --log-prefix "OUT_HTTP: " --log-uid
iptables -N OUT_SMTP
iptables -A OUT_SMTP -p tcp --syn -m owner --uid-owner 1000-65535 -j LOG --log-prefix "OUT_SMTP: " --log-uid
# monitorizare
iptables -t filter -I OUTPUT ! -o lo -p tcp -m multiport --dports 80,8080,443 -j OUT_HTTP
iptables -t filter -I OUTPUT ! -o lo -p tcp -m multiport --dports 25,465,587 -j OUT_SMTP
#!/bin/bash
sed -i '/^LF_PERMBLOCK =/s/1/0/' /etc/csf/csf.conf
sed -i '/^CC_LOOKUPS =/s/CC_LOOKUPS.*/CC_LOOKUPS = "1"/' /etc/csf/csf.conf
sed -i '/^LF_TRIGGER =/s/LF_TRIGGER.*/LF_TRIGGER = "0"/' /etc/csf/csf.conf
sed -i '/^LF_TRIGGER_PERM =/s/LF_TRIGGER_PERM.*/LF_TRIGGER_PERM = "0"/' /etc/csf/csf.conf
sed -i '/^LF_EMAIL_ALERT =/s/LF_EMAIL_ALERT.*/LF_EMAIL_ALERT = "0"/' /etc/csf/csf.conf
sed -i '/^LF_SSHD =/s/LF_SSHD.*/LF_SSHD = "0"/' /etc/csf/csf.conf
sed -i '/^LF_FTPD =/s/LF_FTPD.*/LF_FTPD = "0"/' /etc/csf/csf.conf
sed -i '/^LF_SMTPAUTH =/s/LF_SMTPAUTH.*/LF_SMTPAUTH = "0"/' /etc/csf/csf.conf
sed -i '/^LF_POP3D =/s/LF_POP3D.*/LF_POP3D = "0"/' /etc/csf/csf.conf
sed -i '/^LF_IMAPD =/s/LF_IMAPD.*/LF_IMAPD = "0"/' /etc/csf/csf.conf
sed -i '/^LF_CPANEL =/s/LF_CPANEL.*/LF_CPANEL = "0"/' /etc/csf/csf.conf
systemctl restart lfd
systemctl restart csf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment