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
相关推荐
李日灐1 分钟前
<4>Linux 权限:从 Shell 核心原理 到 权限体系的底层逻辑 详解
linux·运维·服务器·开发语言·后端·面试·权限
寒秋花开曾相惜4 分钟前
(学习笔记)4.1 Y86-64指令集体系结构(4.1.6 一些Y86-64指令 )
linux·运维·服务器·开发语言·笔记·学习·安全
freewlt6 分钟前
TypeScript 5.5 新特性深度解析:类型系统的又一次进化
linux·ubuntu·typescript
сокол8 分钟前
【网安-Web渗透测试-Linux提权】SUID提权
linux·前端·web安全·网络安全
誰能久伴不乏10 分钟前
Qt 混合编程核心原理:C++ 与 QML 通信机制详解
linux·c++·qt·架构·状态模式
运维小斌10 分钟前
麒麟v10arm使用dnsmasq部署本地DNS服务器
linux·运维·服务器·网络
AI服务老曹18 分钟前
深度解析:基于 Docker 与 GB28181 的异构计算 AI 视频管理架构,如何实现 X86/ARM 与 GPU/NPU 的全场景兼容?
运维·docker·容器
做个文艺程序员20 分钟前
用 Codex 写运维脚本(二)—— Prompt 工程:如何精准描述你的脚本需求
运维·prompt
佳xuan23 分钟前
wsl(linux)安装miniconda及虚拟环境
linux·人工智能·conda
召田最帅boy26 分钟前
一次OOM排查实录
linux·jvm·spring boot·adb