BSD Firewalls: IPFW
Pages: 1, 2, 3
Antes de reconstruir mi kernel, añadiré las siguientes líneas a mi archivo de configuración:
#To enable IPFW with default deny all packets
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=10
#To hide firewall from traceroute
options IPSTEALTH
#To hide from nmap, remove if create web server
options TCP_DROP_SYNFIN
#To hide from portscans
options TCP_RESTRICT_RST
Mientras se recompila mi kernel, echaré una mirada a las opciones que
debería añadir en /etc/rc.conf. De nuevo, usaré "/"
para buscar la sección correcta en manpage:
man rc.conf
/firewall
firewall_enable
(bool) Set to NO if you do not want have firewall rules
loaded at startup, or YES if you do. If set to YES, and
the kernel was not built with IPFIREWALL, the ipfw kernel
module will be loaded. See also ipfilter_enable.
firewall_script
(str) If you want to run a firewall script other than
/etc/rc.firewall, set this variable to the full path to
that script.
firewall_type
(str) Names the firewall type from the selection in
/etc/rc.firewall, or the file which contains the local
firewall ruleset. Valid selections from /etc/rc.firewall,
are ''open'' - unrestricted IP access; ''closed'' - all IP
services disabled, except via lo0; ''client'' - basic pro-
tection for a workstation; ''simple'' - basic protection
for a LAN. If a filename is specified, the full path must
be given.
Debido a que quiero que las reglas de mi firewall se carguen en el arranque,
voy a poner firewall_enable en YES. Estaré creando mi propio
conjunto de reglas, así que especificaré la ruta del archivo que crearé usando
firewall_type.
firewall_quiet
(bool) Set to YES to disable the display of ipfw rules on
the console during boot.
Es buena opción poner en YES a medida que le muestra cada regla que está
cargando; si tiene un tipo en su conjunto de reglas, todas las reglas que
siguen a tipo NO serán cargadas. Si está mirando la pantalla durante el
arranque, verá un mensaje de sintaxis ipfw a continuación de la
última regla que fue cargada exitosamente; querrá mirar un tipo en la siguiente
línea de tal regla, entonces rearranque para asegurar que todas sus reglas se
cargaron exitosamente.
firewall_logging
(bool) Set to YES to enable ipfw event logging. This is
equivalent to the IPFIREWALL_VERBOSE kernel option.
tcp_extensions
(bool) Set to NO by default. Setting this to YES enables
certain TCP options as described by RFC 1323. If you have
problems with connections randomly hanging or other weird
behavior of such nature, you might try setting this back to
NO and seeing if that helps. Some hardware/software out
there is known to be broken with respect to these options.
log_in_vain (bool) Set to NO by default. Setting to YES
will enable logging of connection attempts to ports that have
no listening socket on them.
tcp_keepalive
(bool) Set to YES by default. Setting to NO will disable
probing idle TCP connections to verify that the peer is
still up and reachable.
tcp_drop_synfin
(bool) Set to NO by default. Setting to YES will cause the
kernel to ignore TCP frames that have both the SYN and FIN
flags set. This prevents OS fingerprinting, but may break
some legitimate applications. This option is only avail-
able if the kernel was built with the TCP_DROP_SYNFIN op-
tion.
Debido a que añadí la opción TCP_DROP_SYNFIN en mi kernel,
pondré este valor correspondiente en YES. Incluiré una nota para eliminar esta
línea si yo habilito un servidor web en esta computadora.
tcp_restrict_rst
(bool) Set to NO by default. Setting to YES will cause the
kernel to refrain from emitting TCP RST frames in response
to invalid TCP packets (e.g., frames destined for closed
ports). This option is only available if the kernel was
built with the TCP_RESTRICT_RST option.
icmp_drop_redirect
(bool) Set to NO by default. Setting to YES will cause the
kernel to ignore ICMP REDIRECT packets.
icmp_log_redirect
(bool) Set to NO by default. Setting to YES will cause the
kernel to log ICMP REDIRECT packets. Note that the log
messages are not rate-limited, so this option should only
be used for troubleshooting your own network.
Terminaré agregando las siguientes líneas a mi archivo
/etc/rc.conf:
#required for ipfw support
firewall_enable="YES"
firewall_script="/etc/rc.firewall"
firewall_type="/etc/ipfw.rules"
firewall_quiet="NO" #change to YES once happy with rules
firewall_logging_enable="YES"
#extra firewalling options
log_in_vain="YES"
tcp_drop_synfin="YES" #change to NO if create webserver
tcp_restrict_rst="YES"
icmp_drop_redirect="YES"
Unas notas antes de rearrancar con mi nuevo kernel. El archivo
LINT realmente tiene significado cuando dice "TU MISMO TE
QUEDARAS ENCERRADO AFUERA". Hasta que arranque creando un conjunto de reglas
que permita los paquetes IP que deseo, ningún paquete IP podrá salir o entrar
en mi computadora. Si deseo verificar mi correo electrónico o bajar cualquier
de Internet cantidad de bits de la información sobre conjuntos de reglas, ahora
es el momento de hacerlo, antes de rearrancar.
