Firewall mit pf

espo

espo

On the dark side
Hi zusammen,

ich hab mir daheim nen Test-Server installiert mit dem ich gern mein Setup das ich für den Rootserver will einzustellen und zu testen nur leider komm ich hier nicht weiter.
Hab folgende pf.conf angelegt:

Code:
if_ext = "vr0"
if_loop = "lo0"
vif_01 = "lo1"

master_ip  = "1234123"
bad_ports = "69,135,137,138,139,445,524,548,1433,6000,31337,666,12345"
www_ip = "127.0.10.10"
ts3_ip = "127.0.20.10"

###---------------------------------------------------------------------
###
### NAT FOR JAILS
###

nat pass on $if_ext from $www_ip to any -> $master_ip
nat pass on $if_ext from $ts3_ip to any -> $master_ip
###----------------------------------------------------------------------
###
### DEFAULT RULES
###

# INCOMING DEFAULT: block and normalize all
block in all
# OUTGOING DEFAULT: block all
block out log all

# SPECIAL IMMEDIATE BLOCKS:
# block bad ports and external broadcasts
block in quick  proto { udp,tcp }  from any to any port { = $bad_ports }
block in quick  on $if_ext         from any to 255.255.255.255

# block weird tcp packets on if_ext:
block in quick on $if_ext inet proto tcp from any to any flags FUP/FUP
block in quick on $if_ext inet proto tcp from any to any flags SF/SFRA
block in quick on $if_ext inet proto tcp from any to any flags /SFRA

#bogus table
table <bogus> persist

# Ganz oben vor allen anderen Filterregeln (ok, globale Blocker dürfen davor stehen):
block in log quick from <bogus> to any


###----------------------------------------------------------------------
###
### LOOPBACK
###

pass in quick on lo0 all
pass out quick on lo0 all

###----------------------------------------------------------------------
###
### EXTERNAL INTERFACE
###


# INCOMING: accept ssh
pass in quick on $if_ext  proto tcp  from any to $master_ip  port = 22
pass in log quick on $if_ext proto tcp from any to $master_ip port 22 flags S/SA keep state (max-src-conn 10, max-src-conn-rate 5/30, overload <bogus> flush global)

# INCOMING: accept http and redirect to www_ip
pass in quick on $if_ext proto tcp  from any to $master_ip  port = 80
rdr on $if_ext proto tcp from any to any port 80 -> $www_ip

# INCOMING: accept teamspeak and redirect to ts3_ip
pass in quick on $if_ext proto udp from any to $master_ip port = 9987
rdr on $if_ext proto udp from any to any port 9987 -> $ts3_ip
pass in quick on $if_ext proto tcp  from any to $master_ip  port = 10011
rdr on $if_ext proto tcp from any to any port 10011 -> $ts3_ip
pass in quick on $if_ext proto tcp  from any to $master_ip  port = 30033
rdr on $if_ext proto tcp from any to any port 30033 -> $ts3_ip

# OUTGOING: block non nated packets, pass the others
block out quick on $if_ext                          from !$if_ext/32 to any
pass out quick  on $if_ext  proto tcp               from $if_ext/32 to any flags S/SA        keep state
pass out quick  on $if_ext  proto { udp,icmp }      from $if_ext/32 to any  keep state

Die nats brauch ich fuer die jails der einzelnen Dienste. Wenn ich nun aber /etc/rc.d/pf reload eingeb kommt immer folgende Meldung:

Code:
Reloading pf rules.
/etc/pf.conf:64: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:68: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:70: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:72: Rules must be in order: options, normalization, queueing, translation, filtering

evtl. kann mir jemand auf die Sprünge helfen.

Gruss
 
Hi,
aus dem OpenBSD Handbuch http://www.openbsd.org/faq/pf/de/config.html:

Die pf.conf-Datei besteht aus sieben Teilen :

* Makros: benutzerdefinierte Variablen, die IP-Adressen, Schnittstellennamen usw. enthalten.
* Tabellen: Eine Tabelle dient dazu, IP-Adresslisten zu speichern.
* Optionen: Zahlreiche Möglichkeiten, um die Arbeitsweise von PF zu steuern.
* Scrub: Paketaufbereitung zur Normalisierung oder zur Defragmentierung.
* Queueing: Stellt Bandbreitenkontrolle und Paketpriorisierung zur Verfügung.
* Übersetzung: Regelt NAT und Paketweiterleitung.
* Filterregeln: Erlauben das selektive Filtern oder Blocken von Paketen während sie eines der Interfaces passieren.

Mit Ausnahme der Makros und Tabellen sollte jeder Teilbereich in dieser Reihenfolge in der Konfigurationsdatei erscheinen.

Du musst die Regeln deiner pf.conf also in die richtige Reihenfolge bringen.

MfG,
baggio
 

Ähnliche Themen

pf problem

PF mit NAT OpenBSD 5.4

Bruteforce-Angriffe auf FTP mit PF verhindern

Akonadi startet nicht mehr

Apache /var/www zu /home/ich/www wechseln

Zurück
Oben