I just thought that you might be interested in a small script you can use in Hardy Heron.
It uses the new UFW (Uncomplicated firewall) introduced in this new Ubuntu distro.
The script is well commented, so everything is easy to understand.
Here is the script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#!/bin/bash ## set the default policy to drop (deny) all connections sudo ufw default deny ## set logging ON sudo ufw logging on ## permit unrestricted traffic from a specific static IP address sudo ufw allow from 192.168.1.1 # maybe your router ## permit TCP connections on ssh port 22 sudo ufw allow 22/tcp ## Allow Apache2 sudo ufw allow 80/tcp ## Allow MySQL sudo ufw allow 3306/tcp ## Allow Bittorrent for port in {7881..7889}; do sudo ufw allow $port/tcp; done ## Allow eMule sudo ufw allow 4662/tcp sudo ufw allow 4672/udp ## Allow DC++ sudo ufw allow 6845 ## Allow Samba from internal network only sudo ufw allow proto tcp from 192.168.1.0/24 to any port 135 # used by smbd sudo ufw allow proto udp from 192.168.1.0/24 to any port 137 # used by nmbd sudo ufw allow proto udp from 192.168.1.0/24 to any port 138 # used by nmbd sudo ufw allow proto tcp from 192.168.1.0/24 to any port 139 # used by smbd sudo ufw allow proto tcp from 192.168.1.0/24 to any port 445 # used by smbd ## Display rules sudo ufw status |
You can modify it by adding/removing rules accordingly.
0 Comments.