1

I have setup squid proxy in my AWS linux instance and it is working as expected. here is the working squid.conf file.

acl artifactory dstdomain xyz.abc.defg.com
acl codebuild_us_east_1 src 34.228.4.208/28
acl localnet src 1.2.3.4/5     # RFC1918 possible internal network

acl SSL_ports port 443 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 CONNECT method CONNECT

http_access deny !Safe_ports http_access deny CONNECT !SSL_ports

http_access allow artifactory http_access deny all

Squid normally listens to port 3128

http_port 3128

Leave coredumps in the first cache dir

coredump_dir /var/spool/squid

Add any of your own refresh_pattern entries above these.

refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|?) 0 0% 0 refresh_pattern . 0 20% 4320

But I am struggling to add basic http/s authentication to my squid proxy. I am adding below code at the very start of the config also I tried it at other places in conf but no luck

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 24 hours
auth_param basic casesensitive off
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all
dns_v4_first on
forwarded_for delete
via off

When I add auth related config to this squid.conf file it fails to start the service with below error

sh-4.2$ sudo service squid restart
Redirecting to /bin/systemctl restart squid.service
Job for squid.service failed because the control process exited with error code. See "systemctl status squid.service" and "journalctl -xe" for details.

Detailed error

sh-4.2$ systemctl status squid.service
● squid.service - Squid caching proxy
   Loaded: loaded (/usr/lib/systemd/system/squid.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-11-11 07:39:39 UTC; 55s ago
  Process: 1241 ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF (code=exited, status=0/SUCCESS)
  Process: 1250 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, status=1/FAILURE)
  Process: 1244 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited, status=0/SUCCESS)
 Main PID: 1138 (code=killed, signal=TERM)
Dhiraj
  • 111
  • 1

0 Answers0