Transparenter squid im lan

tassadar

Member
Hi Zusammen,

ich als Firewall ein OpenBSD 3.6 generic. Es funktioniert auch alles. Ich wollte nun einen transparenten Squid aufsetzten. Dieser soll allerdings nicht auf der Firewall laufen, sondern in meinem LAN. Die Firewall besitzt 2 Interfaces ein für DSL und das andere für mein LAN (172.16.55.0/24).

Interfaces auf der Firewall:
xl0: 172.16.55.254
tun0: DSL

Der squid läuft auf einem meiner Server (172.16.55.40) im LAN. Nun soll es so sein, dass alle Anfragen, aus einem bestimmten breich (172.16.55.110-172.16.55.150)die an der Firewall auf Port 80 ankommen und irgendein Ziel haben, umgeleitet werden auf den proxy-server auf port 3128. Dazu habe ich die folgenden zeilen in die pf-config mit aufgenommen.

Code:
rdr on xl0 inet proto tcp from 172.16.55.110 to any port 80 -> 172.16.55.40 port 3128
rdr on xl0 inet proto tcp from 172.16.55.111 to any port 80 -> 172.16.55.40 port 3128
...
rdr on xl0 inet proto tcp from 172.16.55.150 to any port 80 -> 172.16.55.40 port 3128

nat on tun0 proto {tcp udp icmp} from 172.16.55.0/24 to any -> (tun0)

Diese Regel steht als erstes in meiner pg-config. Leider funktioniert das so nicht. Es kommen keinen Anfragen an meinem Proxy an. Habe ich da etwas übersehen oder falsch gedacht? Wäre nett, wenn mir jemand bei diesem problem helfen könnte. Danke

Gruß
Flo
 
tassadar said:
Leider funktioniert das so nicht. Es kommen keinen Anfragen an meinem Proxy an. Habe ich da etwas übersehen oder falsch gedacht? Wäre nett, wenn mir jemand bei diesem problem helfen könnte. Danke

Gruß
Flo

die anfragen werden vermutlich geblockt.
die "pass in" zeilen fehlen :confused:

etwa so:

Code:
pass in log on xl0 proto tcp from 172.16.55.110 to 172.16.55.254 port 80
...
pass in log on xl0 proto tcp from 172.16.55.150 to 172.16.55.254 port 80
 
ich wuerds eher so machen alles was auf port 80 ankommt auf den proxy weiterzuleiten ausser eben den proxy selber damit die anfragen ja nach draussen kommen sonst rennt der eben im kreis.
 
Mach es mal so:
Code:
rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128
pass in log on $int_if inet proto tcp from any to 127.0.0.1 port 3128 keep state
pass out log on $ext_if inet proto tcp from any to any port www keep state
 
asg aber die firewall und der squid sind 2 verschiedene kisten. er muss also aufpassen das der squid nich durch den redirect nochmal gejagt wird sonst laeuft der ja im kreis.
 
bei nem transparenten squid würd ich noch https mit ins spiel bringen in den redirections .)
 
Mein Squid rennt hier auch auf einem Rechner vor der Firewall im LAN. Und es funktioniert.
Es wird doch nur jede Anfrage auf Port 80 auf den Squid umgeleitet. Gut ist. Dann gehts weiter zur FW, dann raus. Fertig.
 
Ich muss den "alten" thread nochmal raus kramen, da ich momentan genau vor dem Gleichen Problem stehe. Wenn ich die IP des Proxys im Browser ein trage lüppt alles wunderbar, nur transparent tuts noch nicht.

squid-config:
Code:
http_port 192.168.0.169:3128
http_port proxy.schlossfeld.de:3128
httpd_accel_port 80
httpd_accel_host virtual
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
never_direct deny local_hosts
never_direct allow all

und meine aktuelle pf.conf
Code:
 # Macros: define common values, so they can be referenced and changed easily.
ext_if="tun0"    # replace with actual external interface name i.e., dc0
int_if="dc0"     # replace with actual internal interface name i.e., dc1
vpn_if="tun1"    # replace with actual external interface name i.e., dc0

internal_net="192.168.0.0/24"

tcp_services="{22, 25, 80, 113, 123, 2222, 3128}"
icmp_types="echoreq"

interactive_tcp="22, 24, 5190, 9898"
critical_tcp="25, 110, 119, 995"
ntp_udp="123"
# options
set block-policy return
set loginterface $ext_if

# scrub
scrub in all

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

# filter rules
block all

pass quick on lo0 all

block drop in  quick on $ext_if from $internal_net to any
block drop out quick on $ext_if from any to $internal_net

pass in  on $ext_if inet proto tcp from any to $internal_net \
   port $tcp_services flags S/SA keep state

pass in  inet proto icmp all icmp-type $icmp_types keep state
pass out inet proto icmp from any to any keep state #icmp-type $icmp_types keep state

pass in  on $int_if from $int_if:network to any keep state
pass out on $int_if from any to $int_if:network keep state

ich muss dazu sagen, dass ich von BSD/pf keinen sonderliche Plan habe, die pf.conf hat mir damals ein Bekannte eingerichtet.
Der Squid läuft auf nem 2. Server unter Debian.

Ich habe die redirects aus dem thread schon probiert, es kommt jedoch nix beim Proxy an. Kann mir jmd. weiter helfen, bitte? :)
 
Back
Top