[wplug] IPTABLES help

Ted Rodgers ted.d.rodgers at gmail.com
Fri Aug 17 22:27:30 EDT 2012


This will open your ssh port (make sure you set the port both here and in
/etc/ssh/sshd_config) and allow traffic you request (web basically):


#!/bin/bash

# fix the value between quotes
ssh-port="put your port here"

# allow existing connections and related (requested) traffic
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# allow your ssh connection
iptables -A INPUT -p tcp --dport $ssh-port -j ACCEPT

# set policy to drop all other attempted connects
# note: this is done last so you don't kick yourself out if you do this
over ssh
iptables -P INPUT -j DROP

#  next line is probably not needed since sanity would say it's default
anyway
iptables -P OUTPUT -j ACCEPT



tdr


More information about the wplug mailing list