[1889] in linux-security and linux-alert archive
[linux-security] Re: Linux and IPFWADM
daemon@ATHENA.MIT.EDU (seifried@seifried.org)
Wed Jun 17 02:53:10 1998
Date: Tue, 16 Jun 1998 00:41:53 -0600 (MDT)
From: <seifried@seifried.org>
To: S Hedges <shedges@shaw.wave.ca>
cc: linux-security@redhat.com
In-Reply-To: <3583404E.3DC5C8F@shaw.wave.ca>
Resent-From: linux-security@redhat.com
Resent-Reply-To: linux-security@redhat.com
> My request to someone out there is to please post a working copy of
> ipfwadm rules, that is WELL documented and not messy. I have found it
> difficult in the past to relate to some of the rules posted by various
> sources, as they are not documented enough for a novice ipfwadm user to read
> and understand what their purpose is.
>
> I thought it was time that some poor soul has brought this up, as I have
> really saw no interaction on the subject with an outcome that is beneficial
> to the various linux groups concerned about network integrity and security.
>
> Regards, Shaun.
There is nothihgn better then a true understanding of TCP-IP security, all
your network daemons, client software, etc. The O'Reilly Firewall book is
required reading IMHO. I'll put this on my to-do list (right better
firewall examples. BTW for ip accounting, use the ipac package, it
generates pretty files =) (http://seifried-gateway.seifried.org/).
-seifried
#!/bin/sh
#
PATH=/sbin
#
#############################################################
# CLEAR ALL RULES
#############################################################
#
ipfwadm -f -I
ipfwadm -f -O
ipfwadm -f -F
#
#############################################################
# ICMP SETTINGS
#############################################################
#
# Deny ALL ICMP from external.
#
ipfwadm -I -a deny -P icmp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
ipfwadm -O -a deny -P icmp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
#
#############################################################
# ANTI SPOOF RULES
#############################################################
#
# Disallow 10.0.0.0/8 and 127.0.0.0/8 from external (spoofing)
#
ipfwadm -I -a deny -S 10.0.0.0/8 -W eth0 -D 0.0.0.0/0
ipfwadm -I -a deny -S 127.0.0.0/8 -W eth0 -D 0.0.0.0/0
#
#############################################################
# ALLOW INTERNAL HOSTS RULES
#############################################################
#
# Allow anything to come in from internal addresses
#
ipfwadm -I -a accept -P all -S 10.0.0.0/8 -W eth1 -D 0.0.0.0/0
#
#############################################################
# ALLOW FTP CLIENTS TO WORK
#############################################################
#
# Allow ftp-data (20) connections incoming to internal clients (1024:65535)
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 20 -D 0.0.0.0/0 1025:65535
#
#############################################################
# ALLOW DNS QUERIES TO WORK
#############################################################
#
# Allow named (udp 53) connections incoming to clients (1024:65535)
#
ipfwadm -I -a accept -P udp -S 0.0.0.0/0 53 -D 0.0.0.0/0 1025:65535
#
############################################################
# ALLOW TO THE FTP SERVER
############################################################
#
# Allow incoming connections to ftp-data (20) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 20
#
# Allow incoming connections to ftp (21) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 21
#
############################################################
# ALLOW ACCESS TO SSH - use /etc/ssh/sshd_config
############################################################
#
# Allow incoming connections to ssh (22) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 22
#
############################################################
# ALLOW ACCESS TO SENDMAIL - use /etc/mail/*
############################################################
#
# Allow incoming connections to smtp (25) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 25
#
############################################################
# ALLOW ACCESS TO DNS SERVER - run chrooted, use named.conf
############################################################
#
# Allow incoming connections to named for zone xfers (tcp 53) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 53
#
# Allow incoming connections to named queries (udp 53) from anywhere
#
ipfwadm -I -a accept -P udp -S 0.0.0.0/0 -D 0.0.0.0/0 53
#
############################################################
# ALLOW ACCESS TO HTTP SERVER
############################################################
#
# Allow incoming connections to www (80) from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 80
#
############################################################
# ALLOW ACCESS TO HTTPS SERVER
############################################################
#
# Allow incoming connections to HTTPS from anywhere
#
ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 443
#
############################################################
# ALLOW ACCESS TO MISC PORTS
############################################################
#
# Allow incoming conenctions to port 8080
#
#ipfwadm -I -a accept -P tcp -S 0.0.0.0/0 -D 0.0.0.0/0 8080
#
############################################################
# ALLOW RETURNED CONNECTIONS
############################################################
#
# Allow connections that have been established by clients
#
ipfwadm -I -a accept -k -P tcp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
ipfwadm -I -a accept -k -P udp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
#
############################################################
# DENY ALL OTHER INCOMING PACKETS
############################################################
#
# Deny all incoming conenctions, tcp, udp, to prevent syn floods/etc
#
ipfwadm -I -a deny -P tcp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
ipfwadm -I -a deny -P udp -S 0.0.0.0/0 -W eth0 -D 0.0.0.0/0
#
############################################################
# IP MASQUERADING SETTINGS
############################################################
#
# Default deny policy
#
ipfwadm -F -p deny
#
# Allow IP Masquerading
#
#ipfwadm -F -a masquerade -S 10.0.0.0/16 -D 0.0.0.0/0
--
----------------------------------------------------------------------
Please refer to the information about this list as well as general
information about Linux security at http://www.aoy.com/Linux/Security.
----------------------------------------------------------------------
To unsubscribe:
mail -s unsubscribe linux-security-request@redhat.com < /dev/null