Previous |
Home | Next |
Version: | - squid 2.5 STABLE 14 |
[bash]# cp
/etc/squid/squid.conf
/etc/squid/squid.conf.original [bash]# vi /etc/squid/squid.conf |
#http_port 3128 |
#http_port
192.168.1.1:3128 |
icp_port 0 |
cache_peer
proxy.myisp.com parent 3128 3130 no-query |
acl QUERY urlpath_regex
cgi-bin \? no_cache deny QUERY |
cache_dir ufs
/var/spool/squid 100 16 256 |
Squid does not have a
cache store (the directories) when it
is first installed and wont run without it. The cache store can be
created by typing "squid
-z"
at the command prompt before starting the service for the first time. |
cache_access_log
/var/log/squid/access.log cache_log /var/log/squid/cache.log cache_store_log /var/log/squid/store.log |
log_fqdn off |
ftp_user
[email protected] |
dns_nameservers 127.0.0.1 |
cache_mgr
[email protected] |
visible_hostname
galaxy.example.com |
The
server is ready to be started, however no access has been granted at
this point. The server is functional but inaccessible, see access
controls to start using the proxy. The localhost
will have access. |
[bash]# chkconfig
--level 345 squid on [bash]# chkconfig --list squid |
squid -z |
[bash]# /etc/init.d/squid
restart [bash]# grep squid /var/log/messages |
iptables -I FORWARD -o
ppp0 -s 192.168.1.0/24 -p tcp -m
multiport \ --dports 21,23,70,80,81,82,210,280,443,488,563,591,777,3128,8080 -j DROP |
A iptables multiport
rule can only list up to 15 port numbers
for each rule. |
[bash]# vi /etc/squid/squid.conf |
# INSERT YOUR OWN
RULE(S) HERE TO ALLOW ACCESS FROM YOUR
CLIENTS |
Rules
are tested in sequential order as they appear in the configuration
file. Always check the order of your "http_access deny/allow" rules to
ensure they
are being enforced correctly. |
acl INTERNAL src
192.168.1.0/24 http_access allow INTERNAL |
acl BADPC src
192.168.1.25 http_access deny BADPC |
acl KIDsPC src
192.168.1.25 acl CLEANTIME MTWHF 15:00-18:00 http_access deny KIDsPC CLEANTIME |
When more than one ACL
is used in a deny/allow rule, they are
processed with the "LOGICAL AND" function. So both ACLs must be true
before the rule is enforced. |
acl FILE_MP3
urlpath_regex -i \.mp3$ http_access deny FILE_MP3 |
acl FILE_EXE
urlpath_regex -i \.exe$ http_access deny FILE_EXE |
[bash]# vi
/etc/squid/bad_domains xxx breast .sex.com .nasty.com .naughty.com .noclothes.com |
[bash]# chown root.squid
/etc/squid/bad_domains [bash]# chmod 640 /etc/squid/bad_domains |
acl BAD_DOMAINS
dstdom_regex -i "/etc/squid/bad_domains" http_access deny BAD_DOMAINS |
Using regular
expressions to match unwanted domain names may
also block legitimate sites, such as "breast" blocking
"www.breastcancer.com". Always check your entries to see if they may
effect other domains, or use "dstdomain"
instead of "dstdom_regex". |
[bash]# /etc/init.d/squid
reload |
[bash]# touch
/etc/squid/passwd [bash]# chown root.squid /etc/squid/passwd [bash]# chmod 640 /etc/squid/passwd |
The username and
password pairs located in the "passwd" file
could be subject to a brute force attack. Ensure that only root and
squid users have access to this file (hence the "chmod"). |
[bash]# htpasswd /etc/squid/passwd username |
acl INTERNAL src
192.168.1.0/24 acl AUTHUSERS proxy_auth REQUIRED http_access allow INTERNAL AUTHUSERS |
auth_param basic program
/usr/lib/squid/ncsa_auth
/etc/squid/passwd auth_param basic children 5 auth_param basic realm Squid - Home Proxy Server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off |
[bash]# /etc/init.d/squid
reload |
[bash]# vi /etc/squid/squid.conf |
httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_uses_host_header on |
[bash]# vi /root/firewall.sh |
# Redirect all WWW (port 80) OUTBOUNT packets to the Squid Server on port 3128 iptables -t nat -A PREROUTING -i $INT_DEV -s $INT_NET -p tcp --dport 80 -j REDIRECT --to-port 3128 |
[bash]# /root/firewall.sh |
[bash]# /etc/init.d/squid
reload |
[bash]# tail -f /var/log/squid/access.log |
Previous |
Home | Next |