iptables transparent redirect to proxy on localhost SOLVED

Thanasis thanasis at asyr.hopto.org
Sun Oct 7 15:37:08 EEST 2007


on 10/07/2007 12:31 PM Gabriel Tzagkarakis wrote the following:
> On 10/6/07, Thanasis <thanasis at asyr.hopto.org> wrote:
>> on 10/05/2007 08:44 PM Gabriel Tzagkarakis wrote the following:
>>> an exeis kanei compile ton kernel sou compile me CONFIG_IP_NF_MATCH_OWNER=m
>>> tote isws doulepsei to e3hs:
>>>
>>> iptables -t nat -I OUTPUT -m owner ! --uid-owner
>>> whatever_uid_you_run_squid_as -p tcp -m tcp --dport 80 -j REDIRECT
>>> --to-ports 8080
>>>
>>> to whatever_uid_you_run_squid_as 8a to breis apo to squid.conf
>>> an psa3eis gia cache_effective_user  (sunh8ws nobody)
>>> opote trexeis ena id nobody kai to briskeis .
>>>
>>> kalh tuxh
Αγαπητοί Τζαγκαράκη και Κοζυράκη,
Δούλεψε με την *αρχική* πρόταση του Τζαγκαράκη ήτοι:

iptables -t nat -A OUTPUT -m owner ! --uid-owner 31 -p tcp -m tcp
--dport 80 -j REDIRECT --to-port 8080

(Δεν χρειάστηκε αλλαγή του χρήστη του dansguardian, και λογικό αφού
τελικά τα πακέτα πού βγαίνουν έχουν owner τον squid).

Το πρόβλημα ήταν το εξής: Χθές, διαβάζοντας το howto που πρότεινε ο
Kozyrakis, έλεγξα με βάσει το Access denied που έπαιρνα, το squid.conf
και πρόσθεσα το acl "to_localhost" στο http_access allow ως εξής:

http_access allow localhost to_localhost

ενώ το default ήταν:
http_access allow localhost

(γι' αυτό άλλωστε *πριν* δούλευε κανονικά για συνδέσεις από άλλο μηχάνημα).

Έλα όμως που δεν μπορείς να βάλεις δύο acl ονόματα στην ίδια γραμμή ! =-O
...και λόγω αυτού του λάθους (που δεν προκαλούσε πρόβλημα στον squid,
πιθανόν διάβαζε μόνο το "to_localhost"), προέκυπτε το κόψιμο των πακέτων
από τον ίδιο τον squid. :'(

Ευχαριστώ όλους που βοήθησαν, και ιδιαίτερα τον Τζαγκαράκη, ο οποίος και
έδωσε αρχικά την σωστή λύση. :-)
Για τους ενδιαφερόμενους επισυνάπτω τα configs του squid και
dansguardian, όπως έχουν τώρα και παίζουν κανονικά. 8-)



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: squid.conf
URL: <http://lists.hellug.gr/pipermail/linux-greek-users/attachments/20071007/ad05c787/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dansguardian.conf
URL: <http://lists.hellug.gr/pipermail/linux-greek-users/attachments/20071007/ad05c787/attachment.txt>


More information about the Linux-greek-users mailing list