Total de visualizações de página

segunda-feira, 25 de abril de 2016

Use Basic Authentication2014/07/24


Use Basic Authentication
2014/07/24
 
Set Basic Authentication and limit squid for users to require authentication.
[1]Install a package which includes htpasswd.
[root@prox ~]# 
yum -y install httpd-tools
[2]Configure Squid to set Basic Auth.
[root@prox ~]# 
vi /etc/squid/squid.conf
acl CONNECT method CONNECT
# line 26: 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
# add a user : create a new file with "-c" ( add the "-c" option only for the initial registration )

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

New password: 
# set password

Re-type new password: 
# confirm

Adding password for user cent
[root@prox ~]# 
systemctl restart squid 
Configure Proxy Client : CentOS
[3]Configure CentOS Proxy Client for Basic Auth.
[root@client ~]# 
vi /etc/profile
# add follows to the end

# username:password@proxyserver:port

MY_PROXY_URL="http://cent:password@prox.server.world:8080/"
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
# it's OK all, but it's possible to set proxy settings for each application like follows.

# for yum

[root@client ~]# 
vi /etc/yum.conf
# add follows to the end

proxy=http://prox.server.world:8080/
proxy_username=cent
proxy_password=password
# for wget

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

http_proxy = http://prox.server.world:8080/
https_proxy = http://prox.server.world:8080/
ftp_proxy = http://prox.server.world:8080/
proxy_user = cent
proxy_passwd = password
Configure 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.

Nenhum comentário:

Postar um comentário