部署了大量机器,需要做squid代理用

直接上码
# 一、######### Local shell #########
# sshpass 免于ssh首次登录远程机器需要交互输入密码的繁琐。 
# sshpass -p SERVER_PASSWD ssh/scp params command
# sshpass :-p 远程服务器密码
# ssh: -o "StrictHostKeyChecking no"   默认准许登录密钥认证
sshpass -p "SERVER_PASSWD" ssh -o "StrictHostKeyChecking no" -p SERVER_SSH_PORT SERVER_USER@SERVER_IP 'curl "http://zhangzhipeng2023.cn/squid/install-squid.sh" | bash'
# 二、####### install-squid.sh (remote)##########
# 存放于:http://zhangzhipeng2023.cn/squid/install-squid.sh
# 1.  静默安装squid, -y:默认yes
yum install -y squid
# 2.  下载并替换本地squid配置文件, -O:文件保存路径
wget -O "/etc/squid/squid.conf" "http://zhangzhipeng2023.cn/squid/squid.conf"
# 3.  检查参数
squid -k parse
# 4.  初始化缓存
squid -z
# 5.  htpasswd 生成squid 代理 用户名、密码, -c:创建密码文件,-b 使用参数传递设置密码
htpasswd -c -b /usr/lib/squid/passwd PROXY_USER PROXY_PASSWD
# 6.  启动squid服务
service squid restart

# 7.  开机启动
####---
# 三、####### squid.conf(remote) ##########
#### 存放于:http://zhangzhipeng2023.cn/squid/squid.conf
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
# http_access allow all
# 配置:代理账号 密码,授权用户
auth_param basic program /usr/lib/squid/ncsa_auth /usr/lib/squid/passwd
acl auth_user proxy_auth REQUIRED
http_access allow auth_user

# Squid normally listens to port 3128
http_port 3128
# Uncomment and adjust the following to add a disk cache directory.
cache_mem 96 MB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /tmp/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
# 配置高匿,不允许设置任何多余头信息,保持原请求header。
request_header_access Via deny all
request_header_access X-Forwarded-For deny all

关键词:ssh shell无密码登录 忽略登录提示 yum静默安装 yum默认允许 yum默认yes

【原创】 shell一键配置squid高匿代理服务器 high-Anonymity相关推荐

  1. 一文教你用squid将闲置的服务器搭建成爬虫使用的高匿代理服务器

    废话:我有一台centos7的服务器,吃灰了很久,本来用来部署博客网站的,但是也完全利用不起来,浪费我的钱啊!接下来我要让它成为一个高匿的爬虫代理服务器. 场景: 为什么要搭建这个东西,而不直接使用爬 ...

  2. 【爬虫】 Squid 3.5.20 安装与配置 高匿代理

    Squid 介绍 Squid是一个缓存internet数据的一个软件,它接收用户的下载申请,并自动处理所下载的数据.也就是说,当一个用户象要下载一个主页时,它向Squid发出一个申请,要Squid替它 ...

  3. python爬取高匿代理IP(再也不用担心会进小黑屋了)

    一起进步 为什么要用代理IP 很多数据网站,对于反爬虫都做了一定的限制,这个如果写过一些爬虫程序的小伙伴应该都深有体会,其实主要还是IP进了小黑屋了,那么为了安全,就不能使用自己的实际IP去爬取人家网 ...

  4. windows 配置squid反向代理服务器

    windows 配置squid反向代理服务器 发现Window版本的Squid 和 Linux 配置有点不一样 一.配置squid\etc目录 1.squid.conf.default 拷贝一份重新命 ...

  5. Windows下配置Squid反向代理服务器

    Squid是一款类Unix系统下非常流行的服务器软件,其最重要的功能就是在客户端和服务端之间建立缓存.因而Squid可以用作反向代理,部署多级缓存或者搭建CDN等,无论名称是什么,本质上都是一样的.目 ...

  6. tomcat catalina localhost 没有项目_实用shell脚本--一键配置tomcat定期日志清理功能

    概述 日志文件包含了关于系统中发生的事件的有用信息,在排障过程中或者系统性能分析时经常被用到.对于忙碌的服务器,日志文件大小会增长极快,服务器会很快消耗磁盘空间,这成了个问题.除此之外,处理一个单个的 ...

  7. [软件工具][原创]pcl引用库一键配置到VisualStudio中支持vs2015-v2022使用教程

    你还在手动配置pcl吗?那你out了,由于pcl的include,lib太多很容易配置出错,为了解决配置效率低下配置出错问题,我们制作了一个全系列支持pcl配置工具,大家只要安装好pcl并保证有PCL ...

  8. 搭建ADSL自动拨号高匿代理池

    搭建ADSL自动拨号高匿代理池 adsl这种服务器网上有很多, 各位自己选择一个服务商购买就行. 搭建服务器环境: centos7 64位 首先购买后,连上服务器先进行拨号, 我这里的拨号命令是 pp ...

  9. 开箱即用的高匿代理抓取工具

    golang-proxy v3.0 golang-proxy是一个开箱即用的高匿代理抓取工具, 它是语言无关的 项目地址: https://github.com/storyicon/golang-pr ...

最新文章

  1. 代码片段管理工具_VS代码片段:提高编码效率的最强大工具
  2. 开发到底喜欢看怎样的需求文档?
  3. 三十二、Java集合中的ArrayList
  4. CodeReview学习与总结
  5. 第三方登录如何给前台返回token_如何设计优雅的第三方账号登录?
  6. Linux中文件权限的一些知识
  7. SAP S/4HANA product search generated SQL statement的生产原理介绍
  8. chrome浏览器开发模式实现跨域
  9. Sentinel初始化监控_分布式系统集群限流_线程数隔离_削峰填谷_流量控制_速率控制_服务熔断_服务降级---微服务升级_SpringCloud Alibaba工作笔记0031
  10. java怎么改运行图标,java修改进程图标
  11. 自制固件iOS4.1刷机、解锁教程
  12. Java实现学生管理系统代码
  13. Akka-CQRS(15)- Http标准安全解决方案:OAuth2+JWT
  14. 小众绿软|游戏:Lode Runner 2(3D挖金子,英文版)(LodeRunner2)
  15. 最牛茅台投资人的一席真言
  16. 软文推广丨什么是软文推广?
  17. 互联网晚报 | 11/21 星期一 | 31省平均工资发布;​九城不排除重新接盘暴雪魔兽世界;iPhone14Pro发货再次延期...
  18. 深入了解 Animation Scripting 动画脚本
  19. 一文解释电路中常用电子元器件应用和选型01
  20. Windows10下载安装openjdk11及配置环境变量

热门文章

  1. java基于springboot+vue+elementui的饭店点菜外卖平台 前后端分离
  2. 【优化布局】基本蚁狮算法在WSN节点部署中的应用matlab源码
  3. GTX1060和RTX2060的差距 哪个好
  4. 侵入式容器 Boost.Intrusive
  5. Python爬虫:URL管理器及其实现方式、网页下载器、网页解析器原理及其实现原理!
  6. Error: Redirected when going from “/***“ to “/***“ via a navigation guard
  7. TI CC2538 做ZigBee协调器控制飞利浦 Hue 调色灯
  8. 值得一看!Shopee营销节日,把握爆单时机
  9. 信工实验参考——《通信原理实验1——话音信号的PCM编译码综合实验》
  10. 根据pdf模板生成新的pdf文件(Java)