Hallo.
Wie man erahnen kann nutze ich IPFW als Paketfilter. Ich versuche mich gerade auch an Dummynet, aber darum soll es jetzt nicht gehen. Trotzdem: Die Syntax und Doku für ipfw + dummynet ist für nicht Entwickler echt ne Hürde. Da ist PF meilenweit voraus...
Ich habe ein funktionierendes Regelwerk, wollte aber aufgrund der besseren Lesbarkeit die Konfiguration in zwei Dateien splitten. Doch irgendwie stolpere ich dann über die Syntax.
/etc/ipfw.script
/etc/ipfw.rules
Führe ich nun das erste Skript aus mag der die "table"-Sachen und Variablen nicht:
Hab schon versucht das anders zu quoten, aber es läuft nicht.
Wie man erahnen kann nutze ich IPFW als Paketfilter. Ich versuche mich gerade auch an Dummynet, aber darum soll es jetzt nicht gehen. Trotzdem: Die Syntax und Doku für ipfw + dummynet ist für nicht Entwickler echt ne Hürde. Da ist PF meilenweit voraus...
Ich habe ein funktionierendes Regelwerk, wollte aber aufgrund der besseren Lesbarkeit die Konfiguration in zwei Dateien splitten. Doch irgendwie stolpere ich dann über die Syntax.
/etc/ipfw.script
Code:
#!/bin/sh
### Initiate variables
NIC="{nfe0}"
LAN="{1.2.3.4/8}"
PEGASUS="{1.2.3.5}"
HTTPD="{1.2.3.6}"
NGINX="{1.2.3.7}"
SSL="{1.2.3.8}"
JAILS="{ $HTTPD, $NGINX, $SSL }"
### Execute ipfw rules
/sbin/ipfw -q /etc/ipfw.rules
/etc/ipfw.rules
Code:
### flush rules and tables
flush
table all flush
### setup lookup table
table 1 add 1.2.3.4/8
table 1 add 4.3.2.1
### setup loopback
add allow ip from any to any via lo0
add deny ip from any to 127.0.0.1/8
add deny ip from 127.0.0.1/8 to any
### reassemble incoming fragments
add reass all from any to any in
### stateful filtering
add check-state
### for services permitted below
add allow tcp from me to any established
### allow any connection out, adding state for each
add allow tcp from me to any setup keep-state
add allow udp from me to any keep-state
add allow icmp from me to any keep-state
### allow my Router
add allow ip from 1.2.3.1 to me
### allow incoming SSH from trusted hosts or networks
add allow tcp from "table(1)" to any 22 in setup keep-state
### allow incoming SSH from everywhere
#add allow tcp from any to me 22 in setup keep-state
### allow public access to jailed Apache httpd
add allow tcp from any to ${HTTPD} 80 in setup
### other rules... ###
Führe ich nun das erste Skript aus mag der die "table"-Sachen und Variablen nicht:
Code:
Line 40: hostname ``"table(1)"'' unknown
Line 46: hostname ``$'' unknown
Hab schon versucht das anders zu quoten, aber es läuft nicht.