# Detect aborted TCP connections.
iptables -A INPUT -m state --state ESTABLISHED,RELATED -p tcp --tcp-flags RST RST -j logaborted
Any packet on the INPUT chain hitting this rule, that is recognised as part of an ongoing TCP connection, with TCP flags RESET, will be sent (j: jump) to the "logaborted" chain for further processing.
# Quickly allow anything that belongs to an already established connection.
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
Any packet on any of the INPUT,OUTPUT and FORWARD chains hitting this rule, that is recognised as part of an ongoing TCP connection, will pass this rule unchanged.
I have no reference to INVALID, XMAS, OR FIN.
INVALID is a filter away packets with an unusual set of TCP flags. Portscanners using XMAS or FIN scan can be filtered also looking for a set of TCP flags.
Quote:
" and check out the LQ FAQ: Security references. It's got a section about Iptables filtering you might find interesting."
|
Here's the XMAS filter: iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
Also, I am not familiar with building an arp table and creating the IP:MAC file.
Query each connected ethernet interface on surrounding hosts in your LAN subnet for details (ifconfig -a) to get the IP/MAC combo. If you add hosts that use DHCP to get any IP addy use their FQDN, not IP.
Put the IP/MAC combo's in a plain textfile:
192.168.0.1 00:11:22:33:44:55
192.168.0.2 00:DA:BA:33:44:A0
192.168.0.3 00:FF:22:33:44:CB
...then load with "arp -f /location/of/your/textfile", and check with "arp -vne". Static entries will have the "M" flag added.
Also, would the following code work for anti-spoofing mac:
iptables -A FORWARD -s 192.168.0.2 -m mac --mac-source ! 00:11:22:33:44:55 -j DROP
It would not forward traffic if the IP/MAC combo doesn't match up, yes.
Consider MAC filtering on the AP a first priority before this though.
If so, should I also include a line for INPUT and OUTPUT as well? I'm a little confused.
On INPUT, yes, unless someone says PREROUTING would be better.