Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Squid auf Rechner --> gleichzeitig Router
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Tinitus
Veteran
Veteran


Joined: 20 Sep 2004
Posts: 1754

PostPosted: Thu Sep 15, 2011 7:41 pm    Post subject: Squid auf Rechner --> gleichzeitig Router Reply with quote

Hallo,

ich habe einen Rechner, der über eth0 mit einem Router ans Internet angeschlossen ist.

Über br0 (also die 2. Netzwerkkarte) will ich nun squid transparent freigeben.

Mein Problem: Wie verhindere ich den Zugriff von local und vom lokalen Netz am Proxy vorbei?
Das Problem müßte ja mit IPTABLES zu lösen sein..bloß wie?

Wie geht das Portforwarding einzuschalten für IPV6?

G. Roland
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Fri Sep 16, 2011 6:09 am    Post subject: Re: Squid auf Rechner --> gleichzeitig Router Reply with quote

Tinitus wrote:
Wie verhindere ich den Zugriff [...] vom lokalen Netz am Proxy vorbei?


ungetestet aus dem Kopf (alle geforwardeten Pakete aus dem LAN auf externen Zielport 80 verwerfen)
Code:
iptables -A FORWARD -o eth0 -p tcp --dport 80 -j DROP

(Schöner ist ... -j REJECT wenn der Kernel das hergibt)

Von local aus wirds was kniffliger, weil da nicht die FORWARD Chain durchlaufen wird. Es gab mal einen Owner-Match der hier geholfen hätte, aber der ist wohl nicht mehr in aktuellen Kerneln. (IMHO) Aber evt. findest mit diesem Hinweis etwas.

http://www.linux-noob.com/forums/index.php?/topic/1180-how-to-block-local-users-ports-and-ips/
http://blog.remoteshell-security.com/index.php?/archives/23-Der-Owner-Match-von-Iptables-Staerken-und-Schwaechen.html

Logischer Ablauf müßte sein:

- gib Traffic auf externen Port 80 von Prozess o. User "squid" frei
- sperre externen Port 80 für den Rest
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Fri Sep 16, 2011 7:41 am    Post subject: Reply with quote

Hi,

besserer Ansatz ist der Transparente Proxy:

Squid <2.7 Konfiguration:
Code:

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on


Squid >=2.7 Konfiguration:
Code:

http_port 3128 transparent


Und dann iptables:
Code:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128


Wenn du dann einen speziellen Rechner rausnehmen möchtest, dann kannst du den auch noch in die Regel mit:

Code:

--source ! <ip-adresse>


einfügen.

Lokal sollte es dann ähnlich gehen.

MfG. Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum