LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   iptable rules for squid server.. (https://www.linuxquestions.org/questions/linux-server-73/iptable-rules-for-squid-server-759412/)

baig 10-03-2009 09:13 AM

iptable rules for squid server..
 
Hi,
I am running squid 2.7 as cache/proxy server on ubuntu 9.4. Proxy server is accessed by clients with proxy settings in browsers..

proxy address: 192.168.1.100:8080

What I'm looking for is..

Clients should only be able to http, https, ftp through squid. if they do not set proxy then internet facility should not be available.. How ever I need to let them chat.

I need iptable rules that would:

accept only connection to 192.168.1.100:8080 except for yahoo, aim, msn chatting..

internet device= ppp0
lan device = eth1
squid server = 192.168.1.100:8080

thanks in advance.

Cheers!!

jhcaiced 10-03-2009 01:34 PM

It would be difficult to setup iptables rules for IM since
they use may different servers with may different IPs that
change so your tables would be crazy.

For me it seems that configuring the squid server with
rules to allow the IM services should be easier since
the proxy can work on domains (not IPs) at the rules
and it's simpler to configure.

Perhaps, you could explain us more what are you trying to
accomplish, limit bandwith, limit internet access etc.

Best regards,

baig 10-04-2009 04:52 AM

Thank you for your reply..

Scenario is:

NETWORK CARDS:

2 NIC's 1->Internet eth1 & ppp0 2->eth1 LAN clients

SERVER: UBUNTU 9.4

Squid 2.7 stable with db auth
Mysqldb
dhcp2-server for lan
firewall: iptables

Internet Connection:

ppp0 over eth1
DHCP assigned addresses for eth1 & ppp0

Lan connections:
eth1
Clients: 20
network: 192.168.1.0/24
squid :192.168.1.100:8080



What I need:
iptable rules for firewall that can:

allow only access to 192.168.1.100:8080(squid 2.7) from LAN

Want to know:

do i need NAT'ing with squid? as my internt connections allows only ppp0 address to access internet with authentication on their server.

squid.conf


auth_param basic program /usr/lib/squid/squid_db_auth --user xxxxx --password xxxxxxxxxx --plaintext --presist
auth_param basic children 2
auth_param basic realm web-Proxy
auth_param basic credentialsttl 5 minute
auth_param basic casesensitive off

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network

acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

acl db-auth proxy_auth REQUIRED
acl bad_sites url_regex '/etc/squid/sites.txt'
http_access deny bad_sites
http_access allow db-auth
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all

http_port 192.168.1.100:8080

hierarchy_stoplist cgi-bin ?

cache_mem 512 MB
maximum_object_size_in_memory 512 KB
cache_dir ufs /var/spool/squid 50000 16 256
maximum_object_size 40480 KB

access_log /var/log/squid/access.log squid
client_netmask 255.255.255.0

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT

shutdown_lifetime 10 seconds

cache_mgr xxxxxxxxxxxxxx
visible_hostname xxxxxxxxxxxx
hosts_file /etc/hosts
coredump_dir /var/spool/squid


All times are GMT -5. The time now is 07:46 AM.