GIS数据共享:官方网站

Linux

当前位置:首页 > 操作系统 > Linux

使用squid将Linux做成代理服务器并设定密码

使用squid将Linux做成代理服务器并设定密码

安装和配置squid

安装

sudo yum install squid -y

修改配置

sudo vi /etc/squid/squid.conf
找到以下几行并注释
http_access deny CONNECT !SSL_ports
http_access deny !Safe_ports
http_access deny to_localhost

启动

sudo systemctl start squid

重启

sudo systemctl restart squid

查看日志

tail -f /var/log/squid/access.log

image.png

squid加密

生成密码

用openssl来生成密码,并且附加username:password对到文件/etc/squid/htpasswd文件中,并且显示出来。

如果你还没有安装openssl,可使用如下语法安装:

sudo yum install openssl openssl-devel

生成用户名密码的语法如下:

printf "USERNAME:$(openssl passwd PASSWORD)\n" | sudo tee -a /etc/squid/htpasswd

例如:创建一个用户名称为wangxch,并且密码为Pz$lPk76,你将要运行:

printf "wangxch:$(openssl passwd -crypt 'Pz$lPk76')\n" | sudo tee -a /etc/squid/htpasswd

/etc/squid/squid.conf尾部添加如下:

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/htpasswd
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
# ...
http_access allow localnet
http_access allow localhost
http_access allow authenticated
# And finally deny all other access to this proxy
http_access deny all

重启squid

sudo systemctl restart squid


扫码查看

上一篇:centos系统版本升级

下一篇:已经是最后一篇

相关内容

文章评论

表情

共 0 条评论,查看全部
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~

评论排行榜

热门标签