Liunx Firewall

/sbin/iptables [-A|-I|-D] [OUTPUT|INPUT|FORWARD] [LINE_NUMBE] -p [protocol] --[dports|sport] PORT_NUMBER -J [DROP/EJECT/ACCEPT]

Firewall log

1> Log file
kern.warning /var/log/iptables.log >> /etc/syslog.conf

2> restart syslog daemon
service syslogd restart


Useful tip:
/etc/init.d/iptables save (save to /etc/sysconfig/iptables)

Save/restore the rules
iptables-save > /root/iptables-save.out
iptables-restore -c /root/iptables-save.out


Firewall Code:
# with a maximum of 15 log entries per minute
/sbin/iptables -A INPUT -m limit --limit 15/minute -j LOG \
--log-level 7 --log-prefix "Dropped by firewall: "
/sbin/iptables -A OUTPUT -m limit --limit 15/minute -j LOG \
--log-level 7 --log-prefix "Dropped by firewall: "

# Reject any packets that do not meet the specified criteria
/sbin/iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
/sbin/iptables -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable

iptables -A INPUT -s 64.55.11.2 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix '** HACKERS **'--log-level 4
iptables -A INPUT -s 64.55.11.2 -j DROP

Comments

Popular posts from this blog

VIOS TIPs

Configure Solaris 10 LDOM on Solaris 11.4

Change P410i from HBA mode to Raid mdoe