PROPHET/OS

NAME

firewall: it sets the packet filter

SYNOPSIS

firewall <file> [-off] [-sweep] [-check <file>]

DESCRIPTION

It sets the packet filter. What the filter holds and what it counted stands in filter; this command changes it and shows nothing.

firewall <file>            read the rules from it, replacing what is there
firewall -off              throw all rules away, the door is open again
firewall -sweep            drop dead connections, count what does not add up
firewall -check <file>     say what is wrong with it, set nothing
firewall test [in|out] [tcp|udp|icmp] [<from>] [to <ip>]
              [port <n>] [syn|ack]

-check and test are the two ways to ask a question without changing anything. -check reads a rule file and reports what it cannot parse; test takes one imaginary packet and names the rule that decides about it, and how. Nothing moves: no counter, no state entry, no log line. That is the point, because a filter you can only test by sending real traffic through it is a filter you test in production.

The rules the machine starts with live in /system/config/net/firewall. Reading a file replaces the whole set, it does not add to it: half a rule set is worse than none, because nobody notices.

-off opens the machine completely. It exists for the moment when a rule locks you out, and it should be followed by a file.

-sweep is the one pass that is driven on request. It drops what has expired, so it changes the machine, and that is why no view triggers it.

EXAMPLE

$ firewall
[WARN] firewall  firewall sets, `filter` shows
firewall <file> [-off] [-sweep] [-check <file>]
  sets the packet filter; `filter` shows what it holds
  a file: read the rules from it, replacing what is there
  -off: throw all rules away, the door is open again
  -sweep: go over the remembered connections, drop the
          dead ones and count what does not add up
  -check <file>: read it and say what is wrong, set nothing
firewall test [in|out] [tcp|udp|icmp] [<from>] [to <ip>]
              [port <n>] [syn|ack]
  says which rule decides about that packet, and how.
  nothing happens: no counter, no state, no log line

SEE ALSO

filter, net, top, log