probleme mit pf.conf

exp

Member
so schaut meine pf.conf aus:

Code:
##
#
# pf.conf v.0.1
#
##
ext_if="fxp0"
ppp_if="tun0"
int_if="em0"
wlan_if="sis0"
priv_nets1="{ 127.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8 }" 
priv_nets2="{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }" 
lan_nets="{ 192.168.0.0/24 }"
wlan_nets="{ 10.0.2.0/24 }"

#default rules
block in all
block out all
pass quick on lo0 all
scrub in all
block quick inet6

#logging on
set block-policy return
set loginterface $ext_if
set loginterface $ppp_if

#ip spoofing
block drop in  quick on $ext_if from $priv_nets1 to any
block drop out quick on $ext_if from any to $priv_nets1
block drop in  quick on $ppp_if from $priv_nets2 to any
block drop out quick on $ppp_if from any to $priv_nets2
antispoof for $ext_if inet
antispoof for $ppp_if inet
antispoof for $int_if inet
antispoof for $wlan_if inet

#nmap sucks
block in log quick on $ppp_if inet proto tcp from any to any flags FUP/FUP
block in log quick on $ppp_if inet proto tcp from any to any flags SF/SFRA
block in log quick on $ppp_if inet proto tcp from any to any flags /SFRA

#rules on ppp_if
pass out on $ppp_if proto tcp all modulate state flags S/SA
pass out on $ppp_if proto { udp, icmp } all keep state
pass in inet proto icmp all icmp-type echoreq keep state

#rules on int_if
pass in  on $int_if from $lan_nets to any
pass out on $int_if from any to $lan_nets

#rules on wlan_if
pass out on $wlan_if proto esp from 10.0.2.1/32 to 10.0.2.0/24
pass in on $wlan_if proto esp from 10.0.2.0/24 to 10.10.10.10/32
pass out on $wlan_if proto udp from 10.0.2.1/32 to 10.0.2.0/24 port = 500
pass in on wi0 proto udp from 10.0.2.0/24 to 10.0.2.1/32 port = 500

#trans. proxy
rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128
rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128

#nat
nat on $int_if from $int_if:network to any -> ($ppp_if)
nat on $wlan_if from $wlan_if:network to any -> ($ppp_if)

um die regeln zu testen habe ich das file mit pfctl geladen. dann bekomme ich folgende meldungen:
Code:
/tmp/pf.conf:19: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:23: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:24: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:25: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:58: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:59: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:62: Rules must be in order: options, normalization, queueing, translation, filtering
/tmp/pf.conf:63: Rules must be in order: options, normalization, queueing, translation, filtering

bsp zeile 19 (scrub in all) nur weis ich nicht was daran falsch sein sollte
 
SCRUB-Regeln stehen VOR den Filter-Regeln.


Siehst du doch in der Fehlermeldung, in der gesagt wird, dass zuerst die Normalisierung und erst dann alles andere eingetragen werden muss.

Es sei denn, du schaltest diese Reihenfolge per Befehl ab ... aber, das ist wirklich eine sehr, sehr schlechte Sache.
 
ouTi schrieb:
die nat und rdr rules kommt auch vor die filter regeln

Ich muss doch nicht den englischen Text in der Fehlermeldung übersetzen, oder? ;)

Außerdem, es ging hier um SCRUB und es spielt (zur Zeit) keine Rolle, was danach kommt.

Können auch blaugrüne Dromedare sein. :D
 
die pf.conf lässt sich jetzt fehlerfrei laden

nur habe ich das problem das die nat regeln nicht greifen

wenn ich ein traceroute von einem client im lan ins internet mache komme ich nicht über die ip von tun0

wenn ich tcpdump auf tun0 werfe sehe ich wie die packete mit der source ip vom privaten lan rausgeschickt werden (daher vermute ich, dass nat nicht funktioniert)

die ausgabe von pfctl -sn schaut so aus:
nat on em0 from 192.168.0.0/24 to any -> (tun0) round-robin
 
nat on $int_if from $int_if:network to any -> ($ppp_if) ?

Muhahaha! Wie soll das denn funktionieren? Probiere es mal mit

nat on $ext_if from $int_if:network to any -> ($ext_if)
 
danke nat funktioniert



ein problem habe ich aber noch der trans. proxy funktioniert nicht.

rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128

wenn ich den proxy direkt im browser einstelle funktioniert www.

edit:
wenn ich versuche mit den umleitung den port 80 traffic auf den proxy umleite, bekomme ich im firefox: the connection was refused when attempting to contact seite.de
 
Zuletzt bearbeitet:
Sieht so aus, als hättest du vor dem Bau von Squid die pf-Unterstützung nicht in die Konfiguration eingetragen. Konfi löschen, Squid noch mal bauen und reinstallen.
 
ich habe jetzt folgendes gemacht:
cd /usr/ports/www/squid
make deinstall
rm -r /usr/local/etc/squid

env FLAVOR=transparent make install
squid.conf angepasst
squid gestartet

trotzdem habe ich noch immer das problem
 
Code:
cache_log /var/log/squid/access.log
cache_effective_user squid
cache_effective_group squid

visible_hostname gw
cache_mgr admin@localhost
cache_mem 128 MB
http_port 192.168.0.1:3128
http_port 10.0.2.1:3128
cache_dir ufs /usr/local/squid/cache 2000 16 256

acl all src 0.0.0.0/0.0.0.0
acl localnet src 192.168.0.0/255.255.255.0
acl localwlan src 10.0.2.0/255.255.255.0
acl localhost src 127.0.0.1/255.255.255.255
acl url_ads url_regex "/usr/local/etc/squid/banner-ads.acl"

http_access deny url_ads
http_access allow localnet
http_access allow localwlan
http_access allow localhost
http_access deny all

acl CONNECT method CONNECT


httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
 
damn... warum ist mir das nicht aufgefallen, dass er nicht auf 127.0.0.1 liegt

aber es wäre ja zu fad wenns jetzt funktionieren würde

Code:
ERROR
The requested URL could not be retrieved
While trying to process the request:
GET /newsticker/ HTTP/1.1
Host: www.heise.de
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: accept_cookie=ac&1; 79426=m&&cef&c; show_preview=sp&y; show_voting=sv&y; 79422=m&&cef&c
Pragma: no-cache
Cache-Control: no-cache

The following error was encountered:
    * Invalid Request 
Some aspect of the HTTP Request is invalid. Possible problems:
    * Missing or unknown request method
    * Missing URL
    * Missing HTTP Identifier (HTTP/1.0)
    * Request is too large
    * Content-Length missing for POST or PUT requests
    * Illegal character in hostname; underscores are not allowed

tritt nur auf bei clients die den proxy trans. nutzen. wenn der proxy direkt eingetragen wird, gibts keine probleme.
 
kann ich das jemand erklären? genau die gleiche squid.conf funktioniert auf einem linux server im trans. einsatz ohne probleme.

kann das vielleicht an pf liegen?
 
hallo, also ich hatte die tage scheinbar ein ähnlices problem, in der access log fand ich den hinweis das squid rechteprobleme beim zugriff auf das pf device hat, gelöst habe ich es indem ich die rechte entsprechend geändert habe und /dev/pf in die gruppe squid aufgenommen habe, sowie lese und schreib rechte gegeben.

die hinweis hab ich hier gefunden

http://www.benzedrine.cx/transquid.html


mfg
 
Zuletzt bearbeitet:
Zurück
Oben