One DocBook source in docs/guide produces the manual pages, one HTML file, the PDF and an MCDE information library. The guide follows the structure of The NetBSD Guide, describes Makronix 0.99.10 (Camouflage), and has its own chapters for MCDE, the Information Manager and the display. The forms are installed by the release: /usr/share/doc/makronix/makronix-guide.html /usr/share/doc/makronix/makronix-guide.pdf /usr/share/doc/makronix/infolib/makronix.dti/ (base-sys-share) /usr/share/man/man7/makronix-guide*.7 (man-reference-man) /etc/dt/config/Xsession.d/0000makronix (etc-sys-etc) /etc/dt/infolib/en_US.UTF-8/makronix.dti (symlink) The information library is built with MCDE's dtdocbook2infolib from a small Lua writer for the CDE DocBook SGML dialect; tools/test-tools.sh runs docs/guide/check.sh on the installed copies and proves that a missing manual page falls red.
107 lines
4.0 KiB
XML
107 lines
4.0 KiB
XML
<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
|
|
<chapter id="firewall">
|
|
<title>The Firewall</title>
|
|
|
|
<para>Makronix turns on NetBSD's packet filter,
|
|
<citerefentry><refentrytitle>npf</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
|
|
and installs a rule set that lets nothing in that the machine did not ask
|
|
for. Outgoing connections work, their replies come back, DHCP and IPv6
|
|
set-up work, ping works, SSH works and the local network names work.
|
|
Everything else is blocked.</para>
|
|
|
|
<sect1 id="firewall-default">
|
|
<title>The default rule set</title>
|
|
|
|
<para><filename>/etc/npf.conf</filename> on a freshly installed machine
|
|
is the following. It is the rule set that the installer writes and that
|
|
<filename>/usr/src/docs/reference/npf-default.conf</filename> records
|
|
for validation:</para>
|
|
|
|
<screen>alg "icmp"
|
|
|
|
group default {
|
|
pass final on lo0 all
|
|
|
|
# out: everything, with the replies
|
|
pass stateful out final all
|
|
|
|
# DHCP replies (a broadcast, so no state) and IPv6 set-up
|
|
pass in final proto udp from any port 67 to any port 68
|
|
pass final family inet6 proto ipv6-icmp all
|
|
|
|
# ping
|
|
pass stateful in final family inet4 proto icmp all
|
|
|
|
# remote login
|
|
pass stateful in final proto tcp to any port ssh
|
|
|
|
# mDNS and DNS-SD (mdnsd): the multicast announcements, port 5353
|
|
pass in final proto udp to any port 5353
|
|
|
|
block in final all
|
|
}</screen>
|
|
|
|
<para>Read it from the bottom up: everything that arrives is blocked
|
|
unless an earlier rule lets it in. The rules above it are the
|
|
exceptions. <literal>stateful</literal> means that the reply to a
|
|
connection the machine started is allowed without a rule of its
|
|
own.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="firewall-open">
|
|
<title>Opening one port</title>
|
|
|
|
<para>A service that should be reachable from the network needs a rule
|
|
above the final block. For a web server on port 80, add this line
|
|
before <literal>block in final all</literal>:</para>
|
|
|
|
<screen> pass stateful in final proto tcp to any port 80</screen>
|
|
|
|
<para>Then check the file and reload the running rule set. A rule set
|
|
with a syntax error must not be loaded; <command>npfctl validate</command>
|
|
reads the file without touching the running one:</para>
|
|
|
|
<screen># npfctl validate /etc/npf.conf
|
|
# /etc/rc.d/npf reload
|
|
# npfctl show
|
|
# npfctl stats</screen>
|
|
|
|
<para><command>npfctl show</command> prints the rules that are active,
|
|
after the variables and groups have been expanded. If the line you
|
|
added is not there, the reload did not happen; the console and
|
|
<filename>/var/log/messages</filename> say why.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="firewall-service">
|
|
<title>The firewall at boot</title>
|
|
|
|
<para>The service is enabled in <filename>/etc/rc.conf</filename>:</para>
|
|
|
|
<screen>npf=YES</screen>
|
|
|
|
<para>At boot, <command>npf</command> loads <filename>/etc/npf.conf</filename>
|
|
before the network is up. A machine that boots without a rule set is a
|
|
machine that is open for the time it takes to notice. After a change,
|
|
reload rather than restart; the existing connections survive a
|
|
reload.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="firewall-more">
|
|
<title>NAT and a router</title>
|
|
|
|
<para>A machine that routes between two networks needs NAT and forwarding.
|
|
The rules are in <citerefentry><refentrytitle>npf.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>;
|
|
the shape is a <literal>map</literal> line for the outgoing interface
|
|
and <literal>pass</literal> rules for the two directions. Forwarding
|
|
itself is a <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
|
setting:</para>
|
|
|
|
<screen># sysctl -w net.inet.ip.forwarding=1
|
|
# echo 'net.inet.ip.forwarding=1' >> /etc/sysctl.conf</screen>
|
|
|
|
<para>A router is a machine with two interfaces and a rule set that
|
|
describes both directions. Do not enable forwarding on a desktop that
|
|
has one interface; it has nothing to forward between.</para>
|
|
</sect1>
|
|
</chapter>
|