Squid Proxy Server
Created: 12/05/2006
General Information
First posted on Overridersworld.Requirements
Installation
When installing the FreeBSD OS for use with Squid, I have used a partition layout like below:|
512M / 512M /tmp 1024M swap 5G /var 15G /usr ~58G /squidcache |
|
# # |
cd /usr/ports/www/squid make install clean |
SQUID_LARGEFILE additionally to what was checked by default. I assume Squid is going to build and install correctly here.Configuration
|
# # |
cd /usr/local/etc/squid/ echo 'squid_enable="YES"' >> /etc/rc.conf |
Note: If there is no squid.conf file, copy ot over from the .default file
| # | cp squid.conf.default squid.conf |
/usr/local/etc/squid/squid.conf as root and make sure that your config file contains these entries:|
######CONFIG START http_port 3128 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin ? no_cache deny QUERY cache_mem 8 MB maximum_object_size 50960 KB maximum_object_size_in_memory 16 KB cache_dir diskd /squidcache/squid/cache 80000 16 256 cache_access_log /var/log/squid/access.log cache_log none cache_store_log none pid_filename /var/run/squid.pid hosts_file /etc/hosts auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 10080 acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl Safe_ports port 8080 #also http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews 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 CONNECT method CONNECT acl blacklist dstdomain "/usr/local/etc/squid/blacklist.txt" http_access deny blacklist http_access allow manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports #change below 10.0.1.0/24 to what matches your LAN IP address space acl our_networks src 10.0.1.0/24 http_access allow our_networks http_access allow localhost http_access deny all http_reply_access allow all icp_access allow all cache_mgr you@somedomain.com cache_effective_user squid visible_hostname proxy.yourdomain.com cachemgr_passwd secret all coredump_dir /squidcache/coredump ######CONFIG END |
|
# # # # # # # # # # # # # # |
mkdir /squidcache/squid mkdir /squidcache/coredump/ mkdir /squidcache/coredump/cache mkdir /var/log/squid touch /usr/local/etc/squid/blacklist.txt touch /var/run/squid.pid echo '.123.com' >> /usr/local/etc/squid/blacklist.txt chown -R squid:squid /usr/local/etc/squid/blacklist.txt chown -R squid:squid /var/log/squid chown -R squid:squid /var/run/squid.pid chown -R squid:squid /squidcache squid -z #needed once to create the cache directories reboot #to reboot the machine |
access.log file by opening a second terminal and running the following as root:| # | tail -f /var/log/squid/access.log |
Note: Remember you set hosts_file /etc/hosts in the squid.conf file? Go and read this and fill your /etc/hosts with all types of ad-ware and spam-ware sites pointing to localhost. This will really save some bandwidth as squid will block all kinds of bad stuff for your Users.
/usr/local/squid/blacklist.txt. The blacklist.txt file takes one domain per line. After adding a domain to that file such as .microsoft.com, everybody will be denied access to .microsoft.com. Of course you can get way more complicated than that, but for me it was enough until now. I used to use a redirector called squid guard for a while, but it seems that project is no longer maintained and it's successor is commercial software. You can test the acl entry by trying to point your browser to www.123.com. You should get an access denied message from squid as we added .123.com into the blacklist.txt file. After making changes to any configuration file, you must make squid reread its config files using| # | squid -k reconfigure |
|
Aug 25 10:14:02 hugin kernel: pid 672 (squid), uid 100: exited on signal 6 (core dumped) Aug 25 10:14:02 hugin squid[438]: Squid Parent: child process 672 exited due to signal 6 |
/boot/loader.conf to correct the problem:|
kern.ipc.msgmnb=8192 kern.ipc.msgmni=40 kern.ipc.msgseg=512 kern.ipc.msgssz=64 kern.ipc.msgtql=2048 |
Author: overrider