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
相关推荐
de_wizard6 小时前
Linux 下安装 Golang环境
linux·运维·golang
相醉为友6 小时前
001 Linux个性操作记录——交叉编译工具链高兼容性调用函数备用
linux·运维·服务器
人间打气筒(Ada)6 小时前
「码动四季·开源同行」docker容器单机编排docker-compose
运维·docker·容器·docker-compose·容器编排·批量·docker compose
wanhengidc6 小时前
算力服务器都有哪些功能
大数据·运维·服务器·智能手机
云智慧AIOps社区7 小时前
ITIL 5 已来:轻帆云IT服务管理平台以“AI 原生 + 全生命周期”重构数智化服务管理
运维·人工智能·aiops·it服务管理·itsm平台·cmdb配置管理·it服务管理系统
夹芯饼干7 小时前
Linux命令(第三节课)
linux·运维·服务器
haokan_Jia7 小时前
3.30软考高项-每日5题
运维
oushaojun27 小时前
现代linux gpio编程接口(by deepseek)
linux·libgpiod
last demo7 小时前
企业级开源监控zabbit
运维·开源·zabbix
皓木.7 小时前
软件测试Linux
linux·运维·服务器