PF-Regeln einmal querlesen bitte

PatrickBaer

Well-Known Member
Salut,

müsste demnächst mal eine Watchguard mit einer OpenBSD-Kiste ersetzen. Dummerweise ist im Moment viel los, also wird die Firma den Bach runtergehen, wenn drei Kunden nachts um drei für eine Stunde keine Emails lesen können.

Kann sich jemand meiner erbarmen und mal hier drüberschauen, ob das so funktionieren MÜSSTE? Wäre nett...

(externe IP hab ich durch ... ersetzt)
Code:
# Variables

ext_if = "fxp0"
dmz_if = "ste0"
int_if = "ste1"

priv_nets = "{ 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 }"
dmz_net = "{ 10.0.0.0/8 }"
int_net = "{ 192.168.0.0/16 }"

ext_226 = "..."
ext_227 = "..."
ext_228 = "..."
ext_229 = "..."

adstream = "10.10.10.228"
farmerswife = "192.168.17.13"
postconnect = "10.10.10.5"
medusa = "192.168.17.5"
proxy = "10.10.10.1"
sbc = "192.168.17.9"

# Prerequisites

set require-order no
set skip on lo
scrub in all
antispoof for $ext_if inet

# First block everything

block in all
block out all

# Allow basic traffic

pass out quick on $ext_if proto { tcp, udp, icmp } from any to any modulate state
pass in  on $int_if from $int_net to any
pass out on $int_if from any to $int_net
pass in  on $dmz_if from $dmz_net to any
pass out on $dmz_if from any to $dmz_net

pass in on $ext_if proto icmp from any to any

# Basic NAT

nat on $ext_if from $int_if:network to any -> $ext_226
nat on $ext_if from $dmz_if:network to any -> $ext_226

# Custom rulesets

# Restrict HTTP traffic

pass in quick on $int_if proto { tcp, udp } from any port http to { 10.10.10.1, 10.10.10.2, 10.10.10.3 }
pass in quick on $int_if proto { tcp, udp } from 192.168.17.13 port http to any
pass in quick on $int_if proto { tcp, udp } from 192.168.20.117 port http to any
pass in quick on $int_if proto { tcp, udp } from 192.168.17.7 port http to any
block in on $int_if proto { tcp, udp } from any to any port http

# DMZ -> LAN

pass in quick on $dmz_if proto tcp from { 10.10.10.1, 10.10.10.2, 10.10.10.3 } port ssh to $int_net
pass in quick on $dmz_if proto tcp from { 10.10.10.1, 10.10.10.2, 10.10.10.3 } port smtp to $int_net
pass in on $dmz_if proto { tcp, udp } from $dmz_net port 143 to $int_net
pass in on $dmz_if proto { tcp, udp } from { 10.10.10.1, 10.10.10.2, 10.10.10.3 } to 192.168.17.15

# SBC Connectivity

rdr on $ext_if proto tcp from any to $ext_229 port ssh -> $sbc port ssh

# FTP Server, Email

rdr on $ext_if proto tcp from any to $ext_226 port 21 -> $proxy port ftp
rdr on $ext_if proto tcp from any to $ext_226 port smtp -> $proxy port smtp
rdr on $ext_if proto tcp from any to $ext_226 port 465 -> $proxy port 465

# Farmers Wife

rdr on $ext_if proto tcp from any to $ext_227 port http -> $farmerswife port http
rdr on $ext_if proto tcp from any to $ext_227 port 22020 -> $farmerswife port 22020
rdr on $ext_if proto tcp from any to $ext_227 port 22030 -> $farmerswife port 22030
rdr on $ext_if proto tcp from any to $ext_227 port 22080 -> $farmerswife port 22080

# Adstream

rdr on $ext_if proto tcp from { ... } to $ext_228 port 21 -> $adstream port 21
rdr on $ext_if proto tcp from any to $ext_228 port ssh -> $adstream port ssh
rdr on $ext_if proto tcp from { ... } to $ext_228 port http -> $adstream port http
rdr on $ext_if proto { tcp, udp } from any to $ext_228 port 50 -> $adstream port 50
rdr on $ext_if proto { tcp, udp } from any to $ext_228 port 500 -> $adstream port 500

# Webmailer

rdr on $ext_if proto tcp from any to $ext_226 port https -> $medusa port https

# Postconnect

rdr on $ext_if proto tcp from any to $ext_229 port 3389 -> $postconnect port 3389
rdr on $ext_if proto tcp from any to $ext_229 port 80 -> $postconnect port 80
 
hi

mal abgesehen davon das du die default reihenfolge fuer regeln nicht einhaellst , ist weniger mehr.

wenn du eh den traffic im lan und dmz erlaubst kannst du
auch nur eine block in out on ext_if all machen

interessant ist auch das du erst alles auf dem int interface erlaubst und dann es versuchst einzuschraenken.

an deiner stelle solltest du die regeln noch mal schwer ueberarbeiten ,
so wie sie hier stehen sind sie zimlich banane.

holger
 
Zurück
Oben