Linux HTTP代理Squid 基本变更配置及目标白名单方式限制转发

1、文件管理转发白名单

sudo touch /etc/squid/whitelistip

sudo touch /etc/squid/whitelistdomain

复制代码
# 目的地ip地址
acl whitelistip dst "/etc/squid/whitelistip"
http_access allow whitelistip

# 目的地域名限制,可使用.xxx.com 放开整个子域名
acl whitelistdomain dstdomain "/etc/squid/whitelistdomain"
http_access allow whitelistdomain

2、限制来源ip

sudo touch /etc/squid/whitelistsrcip

复制代码
# 可以使用ip段如:12.12.12.1/24
acl whitelistsrcip src "/etc/squid/whitelistsrcip"
http_access allow whitelistsrcip

3、日志存储

复制代码
# 详细:https://wiki.squid-cache.org/SquidFaq/SquidLogs#accesslog
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %{host}>h
# 日志路径
access_log /data/logs/squid/access.log combined

4、监听端口

复制代码
# 自己定
http_port 8999

5、端口白名单

默认配置放开了很多ip,可以根据情况只放开80,443等自己要用的,把其他的注释了

复制代码
acl SSL_ports port 443
acl Safe_ports port 443
acl Safe_ports port 80
相关推荐
AI浩5 小时前
【Labelme数据操作】LabelMe标注批量复制工具 - 完整教程
运维·服务器·前端
石像鬼₧魂石5 小时前
如何配置Fail2Ban的Jail?
linux·学习·ubuntu
sunxunyong6 小时前
doris运维命令
java·运维·数据库
Guheyunyi6 小时前
智慧消防管理系统如何重塑安全未来
大数据·运维·服务器·人工智能·安全
椰子今天很可爱6 小时前
五种I/O模型与多路转接
linux·c语言·c++
Lueeee.6 小时前
Linux kernel Makefile 语法
linux
爱吃山竹的大肚肚8 小时前
EasyPOI 大数据导出
java·linux·windows
极地星光9 小时前
dmesg 工具的核心功能与作用
linux
雾削木9 小时前
k230 Pyhton三角形识别
运维·服务器·网络·stm32·智能路由器
福尔摩斯张10 小时前
C++核心特性精讲:从C语言痛点出发,掌握现代C++编程精髓(超详细)
java·linux·c语言·数据结构·c++·驱动开发·算法