================================================================================
 rc.firewall FAQ

 Purpose: answer general questions on rc.firewall. Provides a starting point
 for more information/research.

 "Being paranoid doesn't guarantee they're NOT after you to get you."
 - Unknown
================================================================================

Index

0. About this document
1. HELP! - It doesn't work!
2. What does this warning mean?
3. How can I...?
	...get the latest version of rc.firewall?
	...upgrade from an earlier version?
	...determine which services to open?
	...see what my firewall is doing?
	...understand what all those syslog log entries mean?
	...log the screen output of rc.firewall?
	...log the screen output of rc.firewall to a file, instead of
		syslog?
	...open specific ports for my favorite game/application?
	...open certain ports when rc.firewall has already started?
	...open all ports (i.e. tear down my firewall)?
	...pass options to the modules to be loaded, e.g. ICQ?
	...determine whether I have enough firewall rules?
	...be certain I am hacker-proof?
	...have martians in my logs?
	...report a bug?
	...contribute to the evolution of rc.firewall?
	...unsubscribe from the mailing list?
	...block SPAM with my firewall?
4. How should I configure my kernel?
5. More information
	5.1 Websites
		HOWTO's
		Linux Documentation Project (LDP)
		Clarification of protocol/port/network numbers
		Assessing your security
		Host information
		Other information
	5.2 Mailing lists
		The rc.firewall mailing list (linux-firewall)
		Other, security- or firewall related mailing-lists
	5.3 Newsgroups


0. About this document

"If all else fails, read the manual"
 - Unknown

rc.firewall is designed to be as user-friendly as such a complex matter like
firewalling can be. Nevertheless, it is possible you have questions about or
problems with it. This FAQ was made to assist you in times of need. I hope
no-one needs to read it. :-) Reality mostly proves otherwise: People who need
it generally don't read it.

Please read this document carefully before asking any of the authors or the
mailing list. It saves you a lot of RTFM (read the fine manual) answers.
People usually refer to this document or the man pages.

Maintainer:          Edwin ten Brink
E-mail:              edwin@privateer.student.utwente.nl
                     <or> via the 'users' mailing list
Last revision date:  October 20, 2000
License:             GPL
rc.firewall version: 5.0

This document will never be complete. Feedback, also positive, is highly
appreciated.


1. HELP! - It doesn't work!

- Make sure you have configured you kernel properly as described in chapter:
  4. How should I configure my kernel?
- Make sure you are running that kernel.
- Read this entire document.
- Use all information quoted in the websites (listed in chapter 5.1)
  and documentation.

Q: rc.firewall gives an error/warning.
A: See chapter 2 for more details.

Q: rc.firewall generated a new firewall.conf for me but there are no
   variables in it!
A: rc.firewall determines all interfaces when it starts up. If you're
   building a box, but haven't all the network interfaces installed,
   (ethernet cards, PPP links etc), edit the firewall.conf file
   and update the pub and pri interface variables with what you will have
   on the completed machine. Then re-run 'rc.firewall --update-config'.
   This will create all the variables and interfaces if they exist yet or
   not. As long as they're not installed, rc.firewall will report that
   they are down and remove them temporarily.

Q: My favorite game/application doesn't work!
A: See section 3 on how to make it work. And I really mean all of section 3.

Q: I downloaded a custom port script and it doesn't work!
A: You should have placed it in the correct directory. Then run rc.firewall
   with --update-config, change the generated /etc/firewall.conf to suit
   your needs. Last but not least, restart the firewall. See again section 3.
   Also look if rc.firewall reports the script being loaded.

Q: It still doesn't work!
A: If you still can't find the cause of your problem, after reading this
   document, join & post a question to the mailing list (see section 5.2
   Mailing list) BUT READ THIS FAQ FIRST!

I'm sorry this section isn't longer, but there weren't that many cries for
help yet.... And I like to keep it this way. ;-)


2. What does this warning mean?

Your PATH variable contains relative directories (doesn't start with '/').
For security reasons, you should remove these directories from your PATH
permanently.

Relative PATH variables, such as ".", or "./bin" have proven to be security
risks, therefore it cannot accept those. As the warning says, the script
will strip those paths temporarily, but it is highly recommended to remove
them completely. (e.g. in /etc/profile, /etc/bashrc, or where you put your
PATH statement at your system.)

-----

Unable to locate XXXXX in any PATH directory!

The binary XXXXX is missing! The named binary is needed for correct
functioning of your firewall, so make sure you install it, or complete you
PATH variable to include it, then re-run the script.

-----

The owners and/or permissions for XXXXX are incorrect.
Please execute the following commands:
        chmod <permissions> XXXXX
        chown root:root XXXXX

The firewall script should be protected from users who don't have any rights
to modify the rules. It is therefore required to set the permissions
accordingly, with the suggested statements.

-----

The /etc/firewall.conf file is missing - a new one will be created.
Edit this new configuration file and re-run the firewall script.

This warning is self-explanatory. Review and edit the /etc/firewall.conf
file to suit your needs.

-----

Both /etc/firewall.conf and rc.firewall.conf exist!
The correct configuration file path is /etc/firewall.conf.
Please remove the old rc.firewall.conf file.

rc.firewall-4.1 and earlier had a /etc/rc.d/rc.firewall.conf file. It is
moved to /etc/firewall.conf when upgrading to rc.firewall-5.0. When running
two different versions, yoy might get this message. Remove the old file, and
upgrade to the newest version.

-----

Version mismatch between script and configuration file! You must
execute rc.firewall with the --update-config parameter to fix this problem.
Since all variables and options are backwards compatible, the script will
continue.

A version check is performed to ensure you have the correct config file.
Make sure you upgrade your configuration, since new parameters may be added.
Don't forget to review your configuration before restarting!

-----

WARNING: Please enable XXXXX in your kernel!

See chapter 4. How should I configure my kernel?

-----

The configuration file has moved to /etc/firewall.conf since version 5.0.
Moving rc.firewall.conf to /etc/firewall.conf...

This one is self-explanatory. No intervention is needed.

-----

Removing XXXXX (down) Interface from INT_INTERFACES

It seems that the specified internal interface is down. Make sure it's up
and execute the script again.

-----

Removing XXXXX (down) Interface from EXT_INTERFACES

It seems that the specified external interface is down. Make sure it's up
and execute the script again.

-----

modprobe: Can't locate module XXXXX

The specified module cannot be found. They are usually located in
/lib/modules/<current kernel version>/ipv4/
Make sure you compiled your kernel correctly (see chapter 4. How should I
configure my kernel?). Also, for ip_masq_icq you need to obtain, compile
and install a separate module, as explained in the firewall.conf file.

-----


3. How can I...?

...get the latest version of rc.firewall?
The latest stable version will regularly be posted at:
http://freshmeat.net/projects/rc.firewall/?highlight=rc.firewall
If you feel the need to have the latest version, for development, or because
you need the state-of-the-art, you can download the development version at:
http://www.jsmoriss.dyndns.org/linux/firewall/dev/
Be advised that the development version may contain bugs, doesn't function
correctly etc.
It is *not recommended* to run the development version on a production
machine!


...upgrade from an earlier version?

Save the original rc.firewall and it's configuration file (just in case).
Execute the new rc.firewall with the --update-config parameter. Review the
new configuration file (some options may have been added).


...determine which services to open?

The firewall.conf file lists several services you offer, or accept from
the public Internet. It's easy to get lost in it. Generally: If you don't
know what the specific service is, you don't need it. Specify no hosts,
just leave the quotes empty ("").
Look at your firewall logs if you don't know the host, protocol or port
number or can't find them in http://www.isi.edu/in-notes/iana/assignments/


...see what my firewall is doing?

On several occasions you might wonder what traffic is being blocked --
to debug something, spot hacker activity, etc. I recommend you save syslog
messages generated by ipchains to a seperate log file. Add something like
this to your /etc/syslog.conf file "kern.=info /var/log/firewall/ipchains.log".
'Normal' kernel logging can then be redirected by "kern.notice /var/log/kernel"
Remember to use only TABS as whitespace, NOT spaces, or else it will not
work. The directory /var/log/firewall needs to exist, of course.
You can follow it realtime with "tail -f /var/log/firewall/ipchains.log"


...understand what all those syslog log entries mean?

An typical log entry looks like this:
Sep 25 09:18:19 privateer kernel: Packet log: eth0i DENY eth0 PROTO=17
130.89.XXX.XXX:513 130.89.255.255:513 L=232 S=0x00 I=45818 F=0x0000 T=64
(#141)

Sep 25 09:18:19
	The date and time the packet hit the firewall

privateer
	It occured on host 'privateer'

kernel
	Was logged by the kernel

Packet log
	Describes a packet log entry

eth0i
	It matched a rule in the ruleset for 'eth0', 'i'nbound

DENY
	The packet was denied (i.e. discarded without notice to the sender)
	You can have REJECT here as well, this discards the packet and
	acknowledges to the sender that it was discarded. We mostly DENY on
	the outside, and REJECT on the inside. That's because a sender must
	wait until the packet has expired, and will make the life of
	portscanners a little more difficult. This does reveal you have a
	strong firewall in place, though.

eth0
	Occured on 'eth0' (my external interface). Other devices might be
	ppp for a dialup link

PROTO=17
	It was a packet with protocol 17, i.e. it was an UDP packet. (These
	protocol numbers can be found in /etc/protocols, or at
	http://www.isi.edu/in-notes/iana/assignments/protocol-numbers)
	Other common numbers are for example 1 (ICMP) or 6 (TCP).

130.89.XXX.XXX
	It originated at the host with IP 130.89.XXX.XXX
	(IP erased for privacy reasons)

513
	On it's port 513.
	The numbers can be found in /etc/services, or far more exhaustive at
	http://www.isi.edu/in-notes/iana/assignments/port-numbers

130.89.255.255
	It was sent to IP 130.89.255.255, the broadcast on this (class B)
	subnet

513
	With destination port 513	

L=232
	It had a length of 232 bytes

S=0x00
	It had no type of service set.
	In theory, you can tell the Internet how to handle your traffic, be
	it sensitive to delay, throughput, etc.
	0x10 = Minimum Delay
	0x08 = Maximum Throughput
	0x04 = Maximum Reliability
	0x02 = Minimum Cost
	0x00 = not set
	
I=45818
	Had this ID number, which you don't need to know.

F=0x0000
	It had a 16bit fragment offset including any TCP/IP packet flags of
	"0x0000"
	"0x2..." or "0x3..." means the "More Fragments" bit was set so more
	fragmented packet will be coming in to complete this one big packet.
	"0x4..." or "0x5..." means that the "Don't Fragment" bit is set.
	Any other values is the Fragment offset (divided by 8) to be later
	used to recombinw into the original big packet.

T=64
	It's TTL (Time To Live) was 64. Each hop on the internet subtracts 1
	from this number. If it reaches zero, we assume that it was lost and
	it will be dropped/discarded.

#141
	And matched my firewall rule number 141 (as present in the kernel).
	If you want to know exactly which rule it was, use
	"ipchains -L -n --line-numbers".

Well, what do we know then? It was a packet denied from some host,
broadcasted at 513/UDP. This was, according to the IANA numbers, a
communication which "maintains databases showing who's logged in to machines
on a local net and the load average of the machine". AKA r-services. Nice to
know, nothing threatening. But I personally think it gives away too much
about his box, even though it might be cool to report your fabulous uptime.


...log the screen output of rc.firewall?

Invoke the script as:
./rc.firewall 2>&1 | logger
This will log all output on level user.info. Make sure you have a rule in
/etc/syslog.conf to do something with that level. (On my system it will by
default be logged to /var/log/messages). If your not comfortable with that
level, use the '-p' flag to specify the desired level.

If you use SysV startup scripts (e.g. /etc/rc.d/rc3.d/S98firewall) screen
output is logged automatically when you change runlevels.


...log the screen output of rc.firewall to a file, instead of syslog?

Invoke the script as:
./rc.firewall 2>&1 | tee -a rc.firewall.log
This will append (hence the '-a' flag) all output to the file
rc.firewall.log.


...open specific ports for my favorite game/application?

Since this script cannot possibly include every service out there, you can
easily create your own script with the example provided in the file:
/etc/firewall-modules/public/services/tcp-clients-template
Copy the file to the relevant directory in the firewall-modules hierarchy
and edit it to suit your needs. Run rc.firewall with the --update-config
parameter and edit your newly created options in /etc/firewall.conf
Upon restart of the firewall, you're script should be executed.
After you've fine-tuned your new service rules, please send the list a copy
of your script. If this is a widely used application, and your rules look
secure, they'll be added them to rc.firewall. You can also post your custom
script and/or get some help from our devlopers mailing list.
Some earlier developed scripts are available at:
http://www.jsmoriss.dyndns.org/linux/firewall/custom-ports/


...open certain ports when rc.firewall has already started?

Use the
--[accept|deny|forward]-[int]-[serv]-[hosts|servers|clients|ports|hostports]
{host|ip|subnet} {...} switch. Adds a temporary entry to a configuration
option; Useful when you want to open-up a service "on the fly". These
settings will be lost the next time the firewall is executed.


...open all ports (i.e. tear down my firewall)?

Use the --accept-all switch. This sets the default policy to "accept";
flushes all firewall rules and removes chains. This allows any incoming and
outgoing traffic.


...pass options to the modules to be loaded, e.g. ICQ?

Modprobe should be used to pass options to modules. The options should be
entered in /etc/modules.conf or /etc/conf.modules. See man modprobe and man
modules.conf for more information.


...determine whether I have enough firewall rules?

"That which is not strictly allowed, is prohibited." Keep that in mind. Deny
everything that should not be allowed.
As to the amount of rules as reported by rc.firewall:
There's no general rule of thumb. I depends on your configuration. If need
to open lots of services to the outside world, your rule-count will
increase. The strict mode will also add a lot of rules (+/- 60) for added
security. Counts have been reported in the range of 180 - 330 rules.


...be certain I am hacker-proof?

You can't. Simple as that. Nothing can be made 100% hacker-proof. Even Fort
Knox can be cracked, but the effort might be more costly than the rewards.
If you want to be certain no-one enters your box from the Internet, there's
one solution: pull the plug. Don't connect. That's however not an option for
most of us, so try to make as little services available to the outside world
as possible. Comment them out in /etc/inetd.conf _and_ block them with
rc.firewall. Don't start any unnecessary services in /etc/rc.d/rcX.d _and_
block them with rc.firewall. Be as secure on every level of configuration as
you can possibly be. Read the guides mentioned in the websites section of
this document.
You may also probe your security from other boxes with portscanners. They
won't tell if it's vulnerable, but they can show you the strength of your
firewall.


...have martians in my logs?

Ask Mulder & Scully... Serious, these are entries where packets were dropped
because they were spoofed, source-routed, or redirect packets.


...report a bug?

About the rc.firewall script:
Send a message to the author, Jean-Sebastien Morisset
<jsmoriss@jsm-mv.dyndns.org>, or to the 'users' mailing list (section 5.2).

About the rc.firewall FAQ:
Send a message to the author, Edwin ten Brink
<edwin@privateer.student.utwente.nl>, or to the 'users' mailing list (section
5.2).


...contribute to the evolution of rc.firewall?

See section 5.2 and join the 'developers' mailing list.


...unsubscribe from one of the mailing lists?

See section 5.2 for instructions


...block SPAM with my firewall?

A firewall is not the most suitable tool for dealing with spam. There are
enough anti-spam features in, for example sendmail to deal with it. If you're
interested in blocking SPAM, have a look at http://mail-abuse.org/rss/


4. How should I configure my kernel?

A list of the options needed is below. Unless you have an urgent reason not
to, I recommend you enable all options below. The ones marked 'recommended'
should only be disabled if you know what your doing, or when you're very low
on memory.

For 2.2.x kernels:

In General Setup:
Needed: Networking support: CONFIG_NET
Recommended: Sysctl support: CONFIG_SYSCTL

In Networking options:
Needed: Network firewalls: CONFIG_FIREWALL
Needed: TCP/IP Networking: CONFIG_INET
Recommended: IP: advanced router: CONFIG_IP_ADVANCED_ROUTER
Recommended (speed): IP: use TOS value as routing key: CONFIG_IP_ROUTE_TOS
Recommended (security): IP: verbose route monitoring:
CONFIG_IP_ROUTE_VERBOSE
Needed: IP: firewalling: CONFIG_IP_FIREWALL
Needed for masquerading: IP: masquerading: CONFIG_IP_MASQUERADE
Recommended (security): IP: ICMP masquerading: CONFIG_IP_MASQUERADE_ICMP
Needed for port forwarding: IP: masquerading special modules support:
CONFIG_IP_MASQUERADE_MOD
Recommended (speed when routing mostly): IP: optimize as router not host:
CONFIG_IP_ROUTER
Recommended (security): IP: TCP syncookie support (not enabled per default):
CONFIG_SYN_COOKIES

In Network device support:
Needed: Network device support: CONFIG_NETDEVICES
Needed: Support for your network card or dialup connection

In Filesystems:
Recommended: /proc filesystem support: CONFIG_PROC_FS

Don't forget to save the options, compile, copy, install and reboot with
that kernel.


5. More information

5.1 Websites

As everyone knows, nothing changes faster than the Internet, so the links
below may have changed. If you find a broken link or a site of which you
feel it really should be in here, please report it to me.
There are tons of information out there. This list is not, and will not be,
complete. It merely provides useful references.

HOWTO's

	http://linux.seva.net/LDP/HOWTO/HOWTO-INDEX/howtos.html
	For a list of all available Linux Documentation Projects HOWTO's.
	Some specific HOWTO's are listed below.

	http://linux.seva.net/LDP/HOWTO/Ethernet-HOWTO.html
	This is the Ethernet-Howto, which is a compilation of information
	about which ethernet devices can be used for Linux, and how to set
	them up.
	Note that this Howto is focused on the hardware and low level driver
	aspect of the ethernet cards, and does not cover the software end of
	things like ifconfig and route. See the Network Howto for that stuff.

	http://linux.seva.net/LDP/HOWTO/Firewall-HOWTO.html
	http://www.grennan.com/Firewall-HOWTO.html
	This document is designed to describe the basics of firewall systems
	and give you some detail on setting up both a filtering and proxy
	firewall on a Linux based system.

	http://linux.seva.net/LDP/HOWTO/IP-Masquerade-HOWTO.html
	This document describes how to enable the Linux IP Masquerade
	feature on a given Linux host. IP Masq is a form of Network Address
	Translation or NAT that allows internally connected computers that
	do not have one or more registered Internet IP addresses to have
	the ability to communicate to the Internet via your Linux box's
	single Internet IP address.

	http://linux.seva.net/LDP/HOWTO/IPCHAINS-HOWTO.html
	This document aims to describe how to obtain, install and configure
	the enhanced IP firewalling chains software for Linux, and some
	ideas on how you might use them.

	http://linux.seva.net/LDP/HOWTO/Net-HOWTO/index.html
	General information about networking for Linux.

	http://linux.seva.net/LDP/HOWTO/Networking-Overview-HOWTO.html
	The purpose of this document is to give an overview of the
	networking capabilities of the Linux Operating System and to provide
	pointers for further information and implementation details.

	http://linux.seva.net/LDP/HOWTO/Securing-Domain-HOWTO.html
	This document outlines the things you will probably have to do when
	you want to set up a network of computers under your own domain. It
	covers configuration of network parameters, network services, and
	security settings.

	http://linux.seva.net/LDP/HOWTO/Security-HOWTO.html
	This document is a general overview of security issues that face the
	administrator of Linux systems. It covers general security
	philosophy and a number of specific examples of how to better
	secure your Linux system from intruders. Also included are pointers
	to security-related material and programs.


Linux Documentation Project (LDP)

	http://www.linuxdoc.org/LDP/nag2/
	The Linux Network Administrators Guide

	http://www.linuxdoc.org/LDP/sag/index.html
	The Linux System Administrators Guide


Clarification of protocol/port/network/rfc numbers

	http://www.isi.edu/in-notes/iana/assignments/ipv4-address-space
	List of allocated networks.

	http://www.isi.edu/in-notes/iana/assignments/port-numbers
	List of port numbers and their usual application.

	http://www.isi.edu/in-notes/iana/assignments/protocol-numbers
	List of protocol numbers.

	http://www.cis.ohio-state.edu/htbin/rfc/INDEX.rfc.html
	http://info.internet.isi.edu/in-notes/rfc/
	List of RFC's (protocol specifications)


Assessing your security

	http://www.nessus.org/
	Downloadable scanner which also probes for security exploits.

	http://grc.com/default.htm
	Probes your ports remotely.
	Doesn't cover everything, but quickly checks the basics.
	Mainly Windoze-oriented.

	http://www.insecure.org/nmap/index.html
	Great downloadable portscanner. Determines remote OS as well.

	http://www.insecure.org/nmap/index.html
	Commercial remote portscanner. One free try.


Host information

	http://www.whois.org/
	Provides information on a domain names

	http://www.traceroute.org/
	Performs a traceroute to a selected host

	http://www.norid.no/domreg.html
	Domain name registries around the world


Other information

	http://www.ecst.csuchico.edu/~dranch/LINUX/TrinityOS/cHTML/TrinityOS-c.html
	TrinityOS: A Guide to Configuring Your Linux Server for Performance,
	Security, and Managability

	http://www.linux-firewall-tools.com/linux/
	The Linux Firewall and Security Site
	Tons of links to several security sites


5.2 Mailing lists

The rc.firewall mailing list (linux-firewall)

	Read this FAQ and the archives of the mailing lists first before
	posting a question to any of the mailing lists!

	There are three mailing lists, all with different audiences. You may
	subscribe to any combination of them.


	Linux ipchains firewall announce mailing list
	---------------------------------------------
	Audience:
		All users who want to be notified of updates
	About the list:
		http://www.jsm-mv.dyndns.org/mailman/listinfo/linux-firewall-announce
	Archive of previous posts:
		http://www.jsm-mv.dyndns.org/pipermail/linux-firewall-announce/
	Help about the list:
		Mail to: linux-firewall-announce-request@jsm-mv.dyndns.org
		With the subject: "help"
	Subscribe:
		Mail to: linux-firewall-announce-request@jsm-mv.dyndns.org
		With the subject: "subscribe"
	Unsubscribe:
		Mail to: linux-firewall-announce-request@jsm-mv.dyndns.org
		With the subject: "unsubscribe"


	Linux ipchains firewall users mailing list
	------------------------------------------
	Audience:
		Users who want to ask or answer general user questions
	About the list:
		http://www.jsm-mv.dyndns.org/mailman/listinfo/linux-firewall-users
	Archive of previous posts:
		http://www.jsm-mv.dyndns.org/pipermail/linux-firewall-users/
	Help about the list:
		Mail to: linux-firewall-users-request@jsm-mv.dyndns.org
		With the subject: "help"
	Subscribe:
		Mail to: linux-firewall-users-request@jsm-mv.dyndns.org
		With the subject: "subscribe"
	Unsubscribe:
		Mail to: linux-firewall-users-request@jsm-mv.dyndns.org
		With the subject: "unsubscribe"
	Posting a message:
		Mail to: linux-firewall-users@jsm-mv.dyndns.org


	Linux ipchains firewall developers mailing list
	-----------------------------------------------
	Audience:
		Users who want to participate in or stay informed about
		developments of rc.firewall
	About the list:
		http://www.jsm-mv.dyndns.org/mailman/listinfo/linux-firewall-dev
	Archive of previous posts:
		http://www.jsm-mv.dyndns.org/pipermail/linux-firewall-dev/
	Help about the list:
		Mail to: linux-firewall-dev-request@jsm-mv.dyndns.org
		With the subject: "help"
	Subscribe:
		Mail to: linux-firewall-dev-request@jsm-mv.dyndns.org
		With the subject: "subscribe"
	Unsubscribe:
		Mail to: linux-firewall-dev-request@jsm-mv.dyndns.org
		With the subject: "unsubscribe"
	Posting a message:
		Mail to: linux-firewall-dev@jsm-mv.dyndns.org


Other, security- or firewall related mailing-lists

	Various lists can be found at http://www.securityfocus.com/, among
	them the famous BugTraq.


5.3 Newsgroups

comp.os.linux.networking
Deals with Linux networking

comp.os.linux.security
Deals with Linux security

comp.protocols.tcp-ip
Deals with the TCP/IP protocol

comp.protocols.tcp-ip.domains
Deals with Internet domains

comp.security.firewalls
Deals with firewalling in general


================================================================================

 "Note that if I can get you to "su and say" something just by asking, you
 have a very serious security problem on your system and you should look into
 it." (By Paul Vixie, vixie-cron 3.0.1 installation notes)

================================================================================

