Sunday, 9 September 2007

ssh iptables

iptables -A INPUT -p tcp --dport 22 -m recent --set --name ssh --rsource
iptables -A INPUT -p tcp --dport 22 -m recent ! --rcheck --seconds 60 --hitcount 4 --name ssh --rsource -j ACCEPT

The first rule says to record the IP of the sender whenever someone tries to connect to port 22. The second rule checks to see if the source has attempted t connect 4 or more times in the last 60 seconds. If not, allow the packet (since my policy is DROP, this is the only way the packet can get through).

iptables-save #to save it

Saturday, 14 July 2007

wlan ubuntu hack

#! /bin/sh
# /etc/init.d/blah
#

echo 1 > /sys/bus/usb/devices/usb1/1-1/bConfigurationValue

/etc/init.d/networking restart

ifup wlan0