Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Anybody with 100% working NAT/MASQ/SQUID/HTTPS solution?

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
Gentoo Server
Apprentice
Apprentice
Posts: 279
Joined: Mon Jul 21, 2003 1:46 pm

Anybody with 100% working NAT/MASQ/SQUID/HTTPS solution?

  • Quote

Post by Gentoo Server » Thu Aug 28, 2003 6:58 am

I try real hard but my basic

iptables --append FORWARD --in-interface eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

setting is good for http but any https transfer doesnt work

I have only eth0 and ppp0 anybody has a working solution for me?

Greetings Olaf
Top
xming
Guru
Guru
User avatar
Posts: 441
Joined: Tue Jul 02, 2002 7:32 pm
Contact:
Contact xming
Website

  • Quote

Post by xming » Thu Aug 28, 2003 10:11 am

Maybe this will help
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 3128
[/quote]
Top
Gentoo Server
Apprentice
Apprentice
Posts: 279
Joined: Mon Jul 21, 2003 1:46 pm

  • Quote

Post by Gentoo Server » Thu Aug 28, 2003 10:18 am

xming wrote:Maybe this will help
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 3128
[/quote]
I tried it but squid dont like 443 requests
how can I make squid 2.5.3 443 enabled ?
Top
jhboricua
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 113
Joined: Tue May 07, 2002 3:04 pm
Contact:
Contact jhboricua
Website

  • Quote

Post by jhboricua » Thu Aug 28, 2003 10:15 pm

Have you checked the squid mailing lists?

I've seen some info there that suggested https and squid don't work well together, but I may be wrong.
Top
Chris W
l33t
l33t
User avatar
Posts: 972
Joined: Tue Jun 25, 2002 11:38 am
Location: Brisbane, Australia

  • Quote

Post by Chris W » Fri Aug 29, 2003 5:41 am

You can't transparently proxy HTTPS. Connections must be made end-to-end.

http://www.ibiblio.org/Linux/HOWTO/Tran ... html#ss2.3
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Top
Gentoo Server
Apprentice
Apprentice
Posts: 279
Joined: Mon Jul 21, 2003 1:46 pm

  • Quote

Post by Gentoo Server » Fri Aug 29, 2003 8:52 am

I tried to disable the squid & redirect then not even http was working i think its a dns problem

ping on the client works 100%


my client has router = dns = wins = linux server

on linux server I use dnsmasq to get dns resolved

my isp is a pp0 with changing dns servers

I need some special config for dns/dnsmasq ?

internet on linux server is 100%

mtu of isp is 1400

Bye
Olaf
Top
Evileye
l33t
l33t
User avatar
Posts: 782
Joined: Wed Aug 06, 2003 9:09 pm
Location: Toronto

My Configuration

  • Quote

Post by Evileye » Fri Aug 29, 2003 1:53 pm

If you only have 1 ethernet card, why do you need masquerading?

If you have two cards, did you do
cd /etc/init.d
cp net.eth0 net.eth1
rc-update add net.eth1 default
I have 2 network cards, one connects to my network(eth1), the other to the internet using ADSL(ppp0 over eth0).

First, do you have all the right kernel modules installed?

Here is my configuration thus far....

For the kernel, under networking options I have
<*> Packet socket
[*] Packet socket: mmapped IO

[*] Network packet filtering (replaces ipchains)
[*] Socket Filtering
<*> Unix domain sockets
[*] TCP/IP networking
[*] IP: advanced router
Then under IP Netfilter Configuration (which is found under networkting options) I have
<*> Connection tracking (required for masq/NAT)
<*> FTP protocol support
<*> IP tables support (required for filtering/masq/NAT)
<*> limit match support
<*> Connection state match support
<*> Packet filtering
<*> REJECT target support
<*> Full NAT
<*> MASQUERADE target support
<*> REDIRECT target support
For my firewall I created a scripts as follows

nano firewall.txt (call it whatever you want) then enter the following
iptables -F
iptables -t nat -F

iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE

iptables -P INPUT DROP
iptables -P FORWARD DROP

iptables -P OUTPUT ACCEPT

iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A INPUT -i eth1 -p all -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A FORWARD -i lo -p all -j ACCEPT
iptables -A FORWARD -i eth1 -p all -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -i ppp0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 443 -j ACCEPT
eth1 is the network(ethernet) card connected to my network. ppp0 is my adsl connection to the internet.

chmod the script as follows so you can execute it
chmod 700 firewall.txt
then type
./firewall.txt
This will enter the rules into your iptables and you should see the following on your screen
Chain INPUT (policy DROP):15:02 2003
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:https

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Now in /etc/conf.d/local.start add the following
adsl-start

echo 1 > /proc/sys/net/ipv4/ip_forward
I assume you have run
adsl-setup
(you may have to change some options manually in /etc/ppp/pppoe.conf)

You should be good to go!

I don't think you can accept connections for https using squid and I have read using squid for port 80 has potential security risks but I have never tried that. I just have all the computers on my network connect to the internet through squid.
Top
Gentoo Server
Apprentice
Apprentice
Posts: 279
Joined: Mon Jul 21, 2003 1:46 pm

  • Quote

Post by Gentoo Server » Fri Aug 29, 2003 4:04 pm

Thanks for your help!


iptables -F
iptables -t nat -F

iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE

iptables -P INPUT DROP
iptables -P FORWARD DROP

iptables -P OUTPUT ACCEPT

iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A INPUT -i eth0 -p all -j ACCEPT
iptables -A INPUT -i ppp0 -p all -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A FORWARD -i lo -p all -j ACCEPT
iptables -A FORWARD -i eth0 -p all -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

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



I did this and everythings works with http when i go to this banking site

https://homebanking.dvg-ka.de/050/index.html

i cannot get it on my client


when i enable proxy server:3128 at my ie6 it works

strange its not possible zu use a linux router without entering proxydata to ie6

Greetings
Olaf
Top
axxackall
l33t
l33t
User avatar
Posts: 651
Joined: Wed Nov 06, 2002 4:04 pm
Location: Toronto, Ontario, 3rd Rock From Sun

  • Quote

Post by axxackall » Mon Sep 15, 2003 10:53 pm

xming wrote:Maybe this will help
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 3128
[/quote]

What if my users are going to various site sitting on arbitrary ports other than 80? Is it possible to trasparently redirect web connections with arbitrary ports based not on the port number (too many port numbers will be in the table), but on the protocol fingerprint of HTTP?
"Lisp is a programmable programming language." - John Foderaro, CACM, September 1991
Top
acidreign
Tux's lil' helper
Tux's lil' helper
Posts: 122
Joined: Sun Apr 21, 2002 9:44 am
Location: Brisbane, Australia
Contact:
Contact acidreign
Website

  • Quote

Post by acidreign » Fri Sep 19, 2003 5:33 pm

Might help ? http://www.subverted.net/wakka/wakka.ph ... SquidCache

Gentoo server, are you part of the Genoo Server Project ?
Gentoo Server Project
http://www.subverted.net
Top
Post Reply

10 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy