AlmaLinux 9
Sponsored Link

Squid : Basic Authentication2023/03/07

Set Basic Authentication and limit Squid for users to require authentication.
[1] Install a package which includes htpasswd.
[root@prox ~]#
dnf -y install httpd-tools
[2] Configure Squid to set Basic Authentication.
[root@prox ~]#
vi /etc/squid/squid.conf
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
# line 28 : add follows for Basic auth
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 5 hours
acl password proxy_auth REQUIRED
http_access allow password

[root@prox ~]#
systemctl restart squid

# add a user : create a new file with [-c] option

[root@prox ~]#
htpasswd -c /etc/squid/.htpasswd alma

New password:    
# set password

Re-type new password:
Adding password for user alma
Proxy Client : AlmaLinux
[3] Configure AlmaLinux Proxy Client for Basic Authentication.
[root@client ~]#
vi /etc/profile.d/
# create new
# username:password@proxyserver:port



export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy

[root@client ~]#
source /etc/profile.d/
# or it's possible to set proxy settings for each application, not System wide
# for dnf

[root@client ~]#
vi /etc/dnf/dnf.conf
# add to the end
# for curl

[root@client ~]#
vi ~/.curlrc
# create new
# for wget

[root@client ~]#
vi /etc/wgetrc
# add to the end

http_proxy =
https_proxy =
ftp_proxy =
proxy_user = alma
proxy_passwd = password
Proxy Client : Windows
[4] For Windows Clients, none of specific settings, but when access to a web, proxy server requires authentication like follows, then input username and password.
Matched Content