HP-UX IPFilter Version A.03.05.14 Administrator's Guide
Firewall Building Concepts
Using Keep State
Chapter 466
Using Keep State
The keep state keyword must be used with other IPFilter keywords
and filtering techniques so that IPFilter completely and correctly makes
an entry in the state table.
If you configure rules to both filter on TCP flags and keep state, you must
be sure you configure the rules correctly. In most cases, you should use
the keep state keyword on the first rule that interacts with a packet for
a connection. You might also need to add the keep state keyword to
subsequent rules in the ruleset.
The following rules do not filter on TCP flags, but use the keep state
keyword correctly:
block in all
pass in quick proto tcp from any to 20.20.20.20/32 port = 23
keep state
block out all
The following rules both filter on TCP flags and use the keep state
keyword:
block in all
pass in quick proto tcp from any to 20.20.20.20/32 port = 23
flags S keep state
pass out all keep state
Either of these sets of rules will result in a fully established state entry
for a connection to your server.
For more examples of correct uses of the keep state keyword, see
Appendix A, “HP-UX IPFilter Configuration Examples,” on page 147.
Protecting SSH Server Connections Using Keep State
The previous examples demonstrate keeping state on TCP, UDP, and
ICMP. The IPFilter system can make outgoing connections seamlessly,
and attackers cannot get back into the system. The ruleset specifies the
ports systems can access, and adds entries to the state table to monitor
each connection.