[LINUX] Manipulate multiple proxies with Squid

A rough explanation of the environment

trouble

--Since smartphones cannot connect well with a proxy with authentication, they are always connected to a proxy built on Azure, so additional Azure communication charges will be incurred. --Some sites cannot be seen by authenticated Proxy: Youtube and other daily necessities

To solve

A Proxy was built locally using Squid, and the Proxy server destination to be connected as a proxy can be selected according to the time zone and the access destination site.

Example of environment with authenticated Proxy at 192.168.1.1:8080 and external Proxy at 0.0.0.0:8888 Excerpt of important settings

/etc/squid/squid.conf


(Omission)
cache_peer 192.168.1.1 parent 8080 0 no-query no-netdb-exchange no-digest login=User name:Password proxy-only
cache_peer 0.0.0.0     parent 8888 0 no-query no-netdb-exchange no-digest default

acl sorting time SMTWHF 1:00-6:00
acl blacklist dstdomain "/usr/local/etc/squid/blacklist"

(Omission)

#Connect directly to the local environment without going through a higher-level proxy
acl developersegments1 dst 192.168.1.1/24
always_direct allow developersegments1

never_direct allow all

#Do not cache
cache deny all

# 1:00 to 6:192 when accessing a site listed on the blacklist at 00.168.1.Proxy connection to 1**Don't let me**
cache_peer_access 192.168.1.1 deny blacklist sorting

blacklist


.qiita.com
.youtube.com

.[domain]Can target the entire domain with

If you connect to the port set with this, it will be preferentially connected to 192.168.1.1 without ** authentication **, and if you try to access the site set to blacklist from 1:00 to 6:00, it will be 0.0.0.0. Connected to proxy.

Recommended Posts

Manipulate multiple proxies with Squid
Multiple selections with Jupyter
Multiple regression analysis with Keras
Manipulate various databases with Python
Animate multiple graphs with matplotlib
Control multiple robots with jupyter-lab
Launch multiple instances with Postgresql 11.x
Scraping multiple pages with Beautiful Soup
Connect to multiple databases with SQLAlchemy
Load multiple JavaScript files with PyWebView
Set multiple WSGIPythonPath with Apache + mod_wsgi
Post multiple Twitter images with python
Manipulate colors with pip install color
Animate multiple still images with Python
Comment out multiple lines with csh
Extract specific multiple columns with pandas
Switch between multiple models with M5StickV
Extract multiple elements with Numpy array
Multiple integrals with Python and Sympy
[Python] Creating multiple windows with Tkinter