server_configuration:squid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
server_configuration:squid [2021/04/15 06:36] davidserver_configuration:squid [2021/04/15 13:13] (current) david
Line 1: Line 1:
 +====== Squid Proxy ======
 +
 +''squid'' is a popular proxy server, if one wishes to access the outside world pretending to be the droplet in wherever it is... Handy for various things.
 +  - [[http://etutorials.org/Server+Administration/Squid.+The+definitive+guide/|Squid. The definitive guide - etutorials.org]]
 +
 +===== Install =====
 +
 <code> <code>
 apt-get update && apt-get upgrade -y apt-get update && apt-get upgrade -y
 apt-get install squid3 apt-get install squid3
  
 +# Backup original configuration to file named squid.conf.factory
 cp -v /etc/squid/squid.conf{,.factory} cp -v /etc/squid/squid.conf{,.factory}
- 
- 
 </code> </code>
  
-Firewall+===== Firewall Configuration =====
  
 See notes under: [[server_configuration:firewall|Firewall]] See notes under: [[server_configuration:firewall|Firewall]]
 +
 <code> <code>
 ufw status ufw status
 ufw allow squid ufw allow squid
-ufw reload 
 ufw status ufw status
 </code> </code>
  
 +
 +===== Configure Squid =====
 +
 +View the existing squid conf (with comments/documentation cut out)
 +<code>
 +cat /etc/squid/squid.conf | grep -v -e '^\#' -e '^$'
 +</code>
 +
 +Configure password store using apache, see docs online... I didn't set this up yet (I limited by IP).
 <code> <code>
   400  apt-get install apache2-utils   400  apt-get install apache2-utils
Line 26: Line 41:
 </code> </code>
  
-View the existing squid conf (with comments/documentation cut out)+Toggle blanket allow/deny rule (debugging to see if its your rule, or your application trying to connect which isn't configured properly)
 <code> <code>
-cat /etc/squid/squid.conf | grep -v -e '^\#' -e '^$'+sed -i 's,http_access deny all,http_access allow all,g' /etc/squid/squid.conf 
 + 
 +sed -'s,http_access allow all,http_access deny all,g/etc/squid/squid.conf
 </code> </code>
 +
  
 <code> <code>
-sed -i 's,http_access deny all,http_access allow all,g' /etc/squid/squid.conf+# Add rule (BEFORE line matching sed pattern) 
 +sed -i '/http_access deny all/i http_access allow my_allow_ip' /etc/squid/squid.conf 
 +sed -i '/http_access allow my_allow_ip/i acl my_allow_ip src xxx.xxx.xxx.xxx' /etc/squid/squid.conf
  
-sed -i 's,http_access allow all,http_access deny all,g' /etc/squid/squid.conf+# Delete rule by sed pattern 
 +sed -i '/acl my_allow_ip src xxx.xxx.xxx.xxx/d' /etc/squid/squid.conf 
 +</code>
  
 +<code>
 +# Test config
 +squid -k parse
 +
 +# Refresh configuration
 +squid -k reconfigure
 </code> </code>
 +
 +===== Stopping =====
  
 <code> <code>
 +# Kill squid
 sudo squid -k shutdown sudo squid -k shutdown
 +
 +# Restart Daemon: http://etutorials.org/Server+Administration/Squid.+The+definitive+guide/Chapter+5.+Running+Squid/5.5+Running+Squid+as+a+Daemon+Process/
 +squid -s
 +</code>
 +
 +More from: http://etutorials.org/Server+Administration/Squid.+The+definitive+guide/Chapter+5.+Running+Squid/5.8+Stopping+Squid/
 +
 +<code>
 +ps aux | grep squid
 +</code>
 +
 +Check cache usage:
 +<code>
 +sudo du -h /var/spool/
 </code> </code>
  • server_configuration/squid.1618468579.txt.gz
  • Last modified: 2021/04/15 06:36
  • by david