#!/bin/bash #Copyright 2003 William Stearns #Released under the GPL. Me='identreject' MyVersion='0.3' [ -r /etc/firebricks/firebricks.conf ] && . /etc/firebricks/firebricks.conf [ -r /etc/firebricks/$Me.conf ] && . /etc/firebricks/$Me.conf [ -r ${FBLibDir:-'/usr/lib/firebricks/'}/firebrickslib ] && . ${FBLibDir:-'/usr/lib/firebricks/'}/firebrickslib if [ -z "$FBLibVer" ]; then echo 'It looks like firebrickslib was not loaded, why? Exiting' >&2 exit 1 fi for OneTask in $Tasks ; do case "$OneTask" in link) $IptablesBin -N $Me >/dev/null 2>&1 $IptablesBin $AppIn INPUT -i \! lo -p tcp --dport 113 -j $Me $IptablesBin $AppIn FORWARD -p tcp --dport 113 -j $Me $IptablesBin $AppIn OUTPUT -p tcp --dport 113 -j $Me ;; unlink) $IptablesBin -D INPUT -i \! lo -p tcp --dport 113 -j $Me $IptablesBin -D FORWARD -p tcp --dport 113 -j $Me $IptablesBin -D OUTPUT -p tcp --dport 113 -j $Me $IptablesBin -X $Me >/dev/null 2>&1 ;; create) echo "Starting $Me" FlushOrNewChain $Me Action='REJECT-tcp-reset' $Ipt -A $Me -p tcp --dport 113 $Tail ;; destroy) echo "Stopping $Me" DestroyChain $Me ;; status) if $IptablesBin -L $Me >/dev/null 2>&1 ; then echo "$Me created" >&2 else echo "$Me destroyed" >&2 fi ;; version) echo "$Me $MyVersion, firebrickslib $FBLibVer" >&2 ;; help) cat <&2 If a firewall drops Ident (tcp port 113) trafficwith out sending back a reset, this results in email, rlogin and irc connections that take two minutes to get going. _If_ you plan to disallow ident traffic, common firewall wisdom says to reject it with a reset instead of dropping it; this $Me module does that. _Do_ _not_ use this module if you need to allow ident traffic across your firewall. EOTEXT DefaultHelp ;; *) echo "Unknown action $Action in $Me, no action taken." >&2 ;; esac done