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
相关推荐
优秀的老黄21 分钟前
Docker部署RabbitMQ
linux·运维·docker·中间件·容器·centos·rabbitmq
Lin_Aries_042123 分钟前
容器使用卷
linux·运维·docker·云原生·容器·eureka
Liang_GaRy1 小时前
心路历程-Linux的特殊权限
linux·运维·服务器
0wioiw01 小时前
Docker(⑤Kali Linux-HexStrike AI安装)
linux·服务器
wifi chicken1 小时前
Linux Netfilter 之 如何完成一个自制的防火墙实例
linux·kernel·tcpip·netfiler
非凡ghost1 小时前
AOMEI Partition Assistant磁盘分区工具:磁盘管理的得力助手
linux·运维·前端·数据库·学习·生活·软件需求
山君爱摸鱼1 小时前
Linux网络配置
linux·运维
寒士obj1 小时前
Docker的使用及核心命令
运维·docker·容器
Galeoto1 小时前
how to setup k3s on an offline ubuntu
linux·运维·ubuntu
zqy02271 小时前
HTTP的Web服务测试在Python中的实现
python·网络协议·http