首页 > 系统服务 > 详细

Linux与云计算——第二阶段 第一十一章:代理Proxy服务器架设—Squid进行基础认证

时间:2016-08-11 22:58:45      阅读:251      评论:0      收藏:0      [点我收藏+]

Linux与云计算——第二阶段Linux服务器架设

第一十一章:代理Proxy服务器架设—Squid进行基础认证

基础认证

配置基础认证并且限制用户必须使用认证

[1] 安装软件包以便包含htpasswd.

[root@server ~]# yum -y install httpd-tools

[2] 配置Squid设置Basic Auth.

[root@server ~]# vi /etc/squid/squid.conf

acl CONNECT method CONNECT

# line 26: 添加以下行来开启认证

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@server ~]# htpasswd -c /etc/squid/.htpasswd jeffrey

[root@server ~]# systemctl restart squid

[3] 配置客户端.

[root@client ~]# vi /etc/profile

# add follows to the end

# username:password@proxyserver:port

MY_PROXY_URL="http://jeffrey:redhat@server.example.com: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

# 针对YUM

[root@client ~]# vim /etc/yum.conf

# 在后面添加

proxy=http://server.example.com:8080/

proxy_username=jeffrey

proxy_password=redhat

# 针对wget

[root@client ~]# vi /etc/wgetrc

# 在后面添加

http_proxy = http://server.example.com:8080/

https_proxy = http://server.example.com:8080/

ftp_proxy = http://server.example.com:8080/

proxy_user = jeffrey

proxy_passwd = redhat


本文出自 “11830455” 博客,请务必保留此出处http://11840455.blog.51cto.com/11830455/1837027

Linux与云计算——第二阶段 第一十一章:代理Proxy服务器架设—Squid进行基础认证

原文:http://11840455.blog.51cto.com/11830455/1837027

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!