Squid : Basic Authentication2024/05/28 |
Set Basic Authentication to limit access to Squid.
|
|
[1] | Install a package which includes htpasswd. |
root@prox:~# apt -y install apache2-utils
|
[2] | Configure Squid to set Basic Authentication. |
root@prox:~#
vi /etc/squid/squid.conf # line 678 : add follows for basic authentication auth_param basic program /usr/lib/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 -Bc /etc/squid/.htpasswd ubuntu New password: # set password Re-type new password: Adding password for user ubuntu |
Proxy Client Setting : Ubuntu
|
[3] | Configure Ubuntu Proxy Client for Basic Authentication. |
root@client:~#
vi /etc/profile.d/proxy.sh # create new file # username:password@proxyserver:port MY_PROXY_URL="http://ubuntu:password@prox.srv.world:3128" HTTP_PROXY=$MY_PROXY_URL HTTPS_PROXY=$MY_PROXY_URL FTP_PROXY=$MY_PROXY_URL http_proxy=$MY_PROXY_URL https_proxy=$MY_PROXY_URL ftp_proxy=$MY_PROXY_URL export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
root@client:~#
source /etc/profile.d/proxy.sh
# or it's possible to set proxy settings for each application, not System wide # for apt
root@client:~#
vi /etc/apt/apt.conf # create new file Acquire::http::proxy "http://ubuntu:password@prox.srv.world:3128/"; Acquire::https::proxy "https://ubuntu:password@prox.srv.world:3128/"; Acquire::ftp::proxy "ftp://ubuntu:password@prox.srv.world:3128/"; # for curl
[root@client ~]#
vi ~/.curlrc # create new file proxy=prox.srv.world:3128 proxy-user=ubuntu:password # for wget
root@client:~#
vi /etc/wgetrc # add to last line http_proxy = prox.srv.world:3128 https_proxy = prox.srv.world:3128 ftp_proxy = prox.srv.world:3128 proxy_user = ubuntu proxy_passwd = password |
Proxy Client Setting : Windows
|
[4] | For Windows Clients, none of specific settings, when starting web browser, proxy server requires authentication like follows, then input username and password. |
Sponsored Link |
|