pf.conf funktioniert nicht richtig

Hallo,
leider bin ich ein absoluter Laie auf dem Gebiet. Ein Freund hat mir die pf eingerichtet. Ich wollte TCP Port 4761:4762, sowie UDP Port 4766
für emule öffnen.
Leider schlägt der Porttest immer fehl!

Vielleicht findet ja jemand den Fehler.. hier die pf:

int_if = "rl0"
ext_if = "tun0"

tcp_services = "{ 22, 113 }"
udp_services = "{ }"
icmp_types = "echoreq"
mldonkeyTCPports="{ 4761, 4762, 6347, 6346, 1214, 8558, 4661, 4662, 19486, 6969, 6881, 6882 }"
#mldonkeyTCPports="{ 6347, 6346, 1214, 8558, 19486, 6969, }"
mldonkeyUDPports="{ 4766, 6347, 6364, 1214, 3665, 8558, 4666, 19486, 6881, 6882 }"

priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, \
10.0.0.0/8 }"
block_ip = "{ 207.88.221.230 }"

# options
set block-policy return
set loginterface $ext_if
#table <sshscan> persist

# scrub
scrub in all

#ackpi queue
altq on $ext_if priq bandwidth 8000Kb queue { q_pri, q_def }
queue q_pri priority 7
queue q_def priority 1 priq(default)

# nat/rdr
nat on $ext_if from $int_if:network to any -> ($ext_if)
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 \
port 8021

#donkey
rdr on $ext_if proto tcp from $int_if to any port 4761:4762 -> \
192.168.0.11 port 4761:4762
rdr on $ext_if proto udp from $int_if to any port 4766 -> \
192.168.0.11 port 4766


#bittorrent
#rdr on $ext_if proto tcp from $int_if to any port 6881:6889 -> \
# 192.168.0.10 port 6881:6889

#rdr on $ext_if proto tcp from $int_if to any port 6969 -> \
# 192.168.0.10 port 6969


# filter rules
block all
pass quick on lo0 all

block drop in quick on $ext_if from $priv_nets to any
block drop out quick on $ext_if from any to $priv_nets
block drop out quick on $ext_if from any to $block_ip
#block drop in quick on $ext_if proto tcp from <sshscan> \
# to any port 22

#sipgate
#pass in quick log on $ext_if inet proto udp from any to ($ext_if) \
# port 5060 queue (q_def, q_pri)

pass in quick log on $ext_if inet proto udp from any to ($ext_if) \
port 8000:8012 queue (q_def, q_pri)

#mldonkey
pass in quick on $ext_if proto tcp from any to $ext_if port \
$mldonkeyTCPports keep state

pass in quick log on $ext_if proto udp from any to $ext_if port \
$mldonkeyUDPports keep state


pass in on $ext_if inet proto tcp from any to ($ext_if) \
port $tcp_services flags S/SA keep state queue (q_def, q_pri)

#pass in on $ext_if inet proto udp from any to ($ext_if) \

# port $udp_services queue (q_def, q_pri)

pass in on $ext_if inet proto tcp from port 20 to ($ext_if) \
user proxy flags S/SA keep state queue (q_def, q_pri)

pass in inet proto icmp all icmp-type $icmp_types keep state

pass in on $int_if from $int_if:network to any keep state \
queue (q_def, q_pri)

#mldonkey
pass out on $ext_if inet proto tcp from $int_if:network to \
any port $mldonkeyTCPports keep state

pass out log on $ext_if inet proto udp from $int_if:network to \
any port $mldonkeyUDPports keep state



ich glaub da ist sicher viel unwichtiges Zeugs bei, doch weiß ich nicht genau worauf es ankommt... also hab ich einfach alles kopiert...

vielen Dank im vorraus

Jonny
 
Du möchtest die Ports vom Internet nach 192.168.0.11 umleiten?
Dann ist deine Weiterleitung falsch, nicht:
Code:
rdr on $ext_if proto tcp from $int_if to any port 4761:4762 -> \
192.168.0.11 port 4761:4762
rdr on $ext_if proto udp from $int_if to any port 4766 -> \
192.168.0.11 port 4766

sondern
Code:
rdr on $ext_if proto tcp from $ext_if to any port 4761:4762 -> \
192.168.0.11 port 4761:4762
rdr on $ext_if proto udp from $ext_if to any port 4766 -> \
192.168.0.11 port 4766
 
Ich hab's jetzt geändert, doch leider scheinen die Ports noch immer nicht offen zu sein.
Ist da vielleicht noch ein anderer Fehler drinne?

Jonny


PS: Wenn ich einen Portscanner laufen lasse, kommt folgendes bei raus:

Process:Emule.exe
PID: 1348
Lokal IP:0.0.0.0.
Remote IP: steht nichts
Remote Port: steht nichts
State: Listen

vielleicht hilft das weiter?!
 
Zuletzt bearbeitet:
Du hast einen Portscan laufen lassen, von wo? Von einem Rechner im Internet zu deinem OpenBSD Rechner?
Dann wäre doch alles in Ordnung, der Scanner hat doch die Emule.exe erkannt.

Nur seit wann erkennt ein Portscanner die PID eines Dienstes/Daemon?
Du hast den Portscanner nicht zufällig auf deinem Rechner laufen lassen, auf dem dein Emule läuft, oder?

Ansonsten, hat dein Rechner auf dem Emule läuft, auch die IP 192.168.0.11?

Die Redirect Regel sieht richtig aus und eine Pass Regel für die Weiterzuleitenden Ports UDP/TCP 4761 und TCP 4762 gibt es auch.
Die pf.conf sieht für dein Emule eigentlich gut aus.
 
hi,
geh mal auf folgende Seite:
https://www.grc.com/x/ne.dll?bh0bkyd2
dann "Proceed" und lass dir von dem ding mal den Port 4662 scannen. Also "4662" in das Feld tippen und "User Specified Customer Port Probe" drüken.
Wenn der sagt das er geschlossen oder "stealth" ist (wohlgemerkt wenn der Esel auf deiner Kiste läuft), dann ändere die Regel wie folgt mal ab:

Code:
rdr on $ext_if inet proto tcp from any to any port 4662 -> 192.168.0.11 port 4662
und der Port 4662 muss natürlich offen sein, aber das müsste bei deiner Regel so sein.
 
Hallo,
also, der Test verläuft immer negativ ( closed ).

Ob die Regel dafür stimmt weiß ich nicht, da ich nicht wirklich Ahnung von der Materie habe. Aber sicherheitshalber öffnete&testete ich wie Du sagtest 4661, obwohl ich eigentlich 4761 offen haben wollte... dachte das die Regel auf die Du anspieltets noch auf 4761 ausgelegt ist!

Ich habe ja meine gesammte pf gepostet, vielleicht kannst Du mal schaun ob die "Regel" vielleicht falsch ist?

Jonny
 
Irgendwie werde ich nicht ganz schlau daraus. Ich hab gerade mal bei google geguckt und da steht das es normalerweise reicht Port 4662 weiterzuleiten.

also, rdr- Regel:
Code:
rdr on $ext_if inet proto tcp from any to any port 4662 -> 192.168.0.11 port 4662

und folgende Pass-Regel:
Code:
pass in on $ext_if inet proto tcp from any to 192.168.0.11 port 4662 keep state
natürlich kannst du jetzt den Port durch das ersetzten, was du willst.

Dann würde ich nochmal dieses Shield-Up Tool darüber jagen. Aber was auch immer auf dem Port liegt muss laufen, wenn du diesen Test machst, sonst macht das keinen Sinn.
 
also...

Ich habe jetzt folgende Änderungen Übernommern:

#donkey
rdr on $ext_if inet proto tcp from any to any port 4662 -> 192.168.0.11 port 4662
rdr on $ext_if inet proto udp from any to any port 4672 -> 192.168.0.11 port 4672

#rdr on $ext_if inet proto tcp from any to any port 4761:4762 -> \
192.168.0.11 port 4761:4762
#rdr on $ext_if inet proto udp from any to any port 4766 -> \
192.168.0.11 port 4766


und

pass in on $ext_if inet proto tcp from any to 192.168.0.11 port 4662 keep state


aber der Port Test geht immernoch in die Hose ... was kann das denn sein?
 
Ich glaube dir fehlt einfach eine "pass out"-Regel, damit der Netzwerkverkehr vom OpenBSD-System zum Client kommen kann:

Code:
#mldonkey
pass out quick on $int_if proto tcp from any to 192.168.0.11 port \
$mldonkeyTCPports keep state

pass out quick on $int_if proto udp from any to 192.168.0.11 port \
$mldonkeyUDPports keep state

Danach kannst du entweder den Portscan nochmal durchführen oder einfach mal vom OpenBSD-System aus nc aufrufen:

Code:
nc -v 192.168.0.11 4662

Sollte jedenfalls nicht in einem Timeout enden.
 
Hey,

zwischendurch will ich mich ersteinmal bedanken das Ihr mich nicht im Regen stehen lasst... obwohl es mir ein Fass ohne Boden zu sein scheint!

Ich hab nun auchnoch die Pass out Geschichten übertragen.. doch leider kommt :

nc: connect to 192.168.0.11 port 4662 (tcp) failed: Connection refused

Da ich durch meine Unwissenheit sicherlich fürchterlich viel falsches in meiner pf stehen habe, will ich sie nochmals komplett posten. schaut dochmal drüber.

Vielleicht kann mir ja mal jemand eine ganz simple config schreiben, die nur die Weiterleitung für TCP&UDP beinhaltet. Oder andere Kleinigkeiten die man noch braucht... ganz basic halt - eine die einfach funktionieren muss!!!

int_if = "rl0"
ext_if = "tun0"

tcp_services = "{ 22, 113 }"
udp_services = "{ }"
icmp_types = "echoreq"
mldonkeyTCPports="{ 4761, 4762, 6347, 6346, 1214, 8558, 4661, 4662, 19486, 6969, 6881, 6882 }"
#mldonkeyTCPports="{ 6347, 6346, 1214, 8558, 19486, 6969, }"
mldonkeyUDPports="{ 4766, 6347, 6364, 1214, 3665, 8558, 4666, 19486, 6881, 6882 }"

priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, \
10.0.0.0/8 }"
block_ip = "{ 207.88.221.230 }"

# options
set block-policy return
set loginterface $ext_if
#table <sshscan> persist

# scrub
scrub in all

#ackpi queue
altq on $ext_if priq bandwidth 8000Kb queue { q_pri, q_def }
queue q_pri priority 7
queue q_def priority 1 priq(default)

# nat/rdr
nat on $ext_if from $int_if:network to any -> ($ext_if)
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 \
port 8021

#donkey
rdr on $ext_if inet proto tcp from any to any port 4662 -> 192.168.0.11 port 4662
rdr on $ext_if inet proto udp from any to any port 4672 -> 192.168.0.11 port 4672
#rdr on $ext_if inet proto tcp from any to any port 4761:4762 -> \
192.168.0.11 port 4761:4762

#bittorrent
#rdr on $ext_if proto tcp from $int_if to any port 6881:6889 -> \
# 192.168.0.10 port 6881:6889

#rdr on $ext_if proto tcp from $int_if to any port 6969 -> \
# 192.168.0.10 port 6969


# filter rules
block all
pass quick on lo0 all

block drop in quick on $ext_if from $priv_nets to any
block drop out quick on $ext_if from any to $priv_nets
block drop out quick on $ext_if from any to $block_ip
#block drop in quick on $ext_if proto tcp from <sshscan> \

#sipgate
#pass in quick log on $ext_if inet proto udp from any to ($ext_if) \
# port 5060 queue (q_def, q_pri)

pass in quick log on $ext_if inet proto udp from any to ($ext_if) \
port 8000:8012 queue (q_def, q_pri)

#mldonkey
#pass in quick on $ext_if proto tcp from any to $ext_if port \
# $mldonkeyTCPports keep state

#pass in quick log on $ext_if proto udp from any to $ext_if port \
# $mldonkeyUDPports keep state

pass in on $ext_if inet proto tcp from any to 192.168.0.11 port 4662 keep state

pass in on $ext_if inet proto tcp from any to ($ext_if) \
port $tcp_services flags S/SA keep state queue (q_def, q_pri)

#pass in on $ext_if inet proto udp from any to ($ext_if) \
# port $udp_services queue (q_def, q_pri)

pass in on $ext_if inet proto tcp from port 20 to ($ext_if) \
user proxy flags S/SA keep state queue (q_def, q_pri)

pass in inet proto icmp all icmp-type $icmp_types keep state

pass in on $int_if from $int_if:network to any keep state \
queue (q_def, q_pri)

#mldonkey
#pass out on $ext_if inet proto tcp from $int_if:network to \
any port $mldonkeyTCPports keep state

#pass out log on $ext_if inet proto udp from $int_if:network to \
any port $mldonkeyUDPports keep state


pass out quick on $int_if proto tcp from any to 192.168.0.11 port \
$mldonkeyTCPports keep state

pass out quick on $int_if proto udp from any to 192.168.0.11 port \
$mldonkeyUDPports keep state

pass out on $int_if from any to $int_if:network keep state \
queue (q_def, q_pri)

pass out on $ext_if proto tcp all modulate state flags S/SA \
queue (q_def, q_pri)

pass out on $ext_if proto { udp, icmp } all keep state
 
Du könntest bei #options kurzzeitig zum Testen einfach mal
Code:
set skip on $int_if
machen, dann wird der LAN-Verkehr nicht weiter gefiltert.

Wenn du dann immer noch keine Verbindung mit nc aufbauen kannst (während eMule läuft, versteht sich), dann überprüf mal, ob nicht auf dem anderen Rechner 'ne Firewall blockt. :)
 
Hallo,
leider war ich wegen Krankheit nicht in der Lage die Geschichte weiter zu verfolgen... ich hoffte das Ihr trotzdem weiterhin behilflich sein werdet.

Habe
set skip on $int_if
ausprobiert, da schlug es immernoch fehl, der einzige Unterschied war, das das Testergebniss sonst unmittelbar erschien und nach dem obrigem Befehl, es etwas länger dauerte!

wenn Bummibaer das noch etwas verständlicher für mich ausführen würde, könnte ich auch diesen ratschlag mal ausprobieren...

Jonny
 
Zurück
Oben