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
相关推荐
知识分享小能手31 分钟前
CentOS Stream 9入门学习教程,从入门到精通,CentOS Stream 9 中的 Shell 编程 —语法详解与实战案例(11)
linux·学习·centos
mzhan01734 分钟前
Linux: gcc: pkgconf: 谁添加的-I选项
linux·make·gcc·pkgconf
未来之窗软件服务36 分钟前
幽冥大陆(四十六)人工智能自动化交互系统ASR2——东方仙盟筑基期
运维·自动化·仙盟创梦ide·东方仙盟·东方仙盟sdk·东方仙盟vos智能浏览器·东方仙盟自动化
码界奇点1 小时前
基于RAG技术的自动化知识库构建系统设计与实现
运维·自动化·毕业设计·rpa·源代码管理·python3.11
怀旧,1 小时前
【Linux系统编程】9. 进程控制(上)
linux·运维·服务器
很㗊1 小时前
BSP之以太网接口学习笔记
linux·驱动开发·笔记·学习
wadesir1 小时前
Debian dd命令详解(磁盘备份与恢复完整教程)
linux·运维·debian
峰顶听歌的鲸鱼1 小时前
15.docker:容器
运维·笔记·docker·容器·学习方法
celeste03101 小时前
shell脚本综合练习
运维·服务器·网络
飞函安全1 小时前
私有化一站式办公平台,协同办公更高效
运维·安全·信息与通信