AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[squid](unix)

Martin Hope
David Co
Asked: 2022-04-05 15:48:10 +0800 CST

squid url_regex 不匹配字符

  • 1

我有一个 url_regex acl:^http(s)://bitbucket.org/example/*

但是,它与网址匹配:http(s)://bitbucket.org/example_test/*

这似乎没有考虑 ^http(s)://bitbucket.org/example/* 末尾的“/”

我想将任何内容与子文件夹匹配示例进行匹配。例如:bitbucket.org/example/case_1 bitbucket.org/example/case_2 但不是,bitbucket.org/example_bad/case_3

它似乎是正则表达式的特殊混合,它没有考虑“/”——

谁能看到这里有什么问题?

ubuntu squid
  • 1 个回答
  • 70 Views
Martin Hope
rgov
Asked: 2021-10-25 11:08:23 +0800 CST

即使上游服务器无法访问,也从 Squid 缓存中提供 HTTPS 响应

  • 1

我已经配置了 Squid,ssl_bump以便它可以在中间人 HTTPS 连接中缓存回复,如下所示:

http_port 3128 ssl-bump \
  cert=/etc/squid/certs/squid-ca-cert-and-key.pem \
  generate-host-certificates=on dynamic_cert_mem_cache_size=16MB

acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all

我希望 Squid 在尝试连接到上游服务器之前接受客户端的连接并尝试从其缓存中提供响应。

但是,它首先尝试连接到服务器,如果服务器不可访问(例如,因为网络离线),则返回 503 错误:

1635102093.658     13 172.17.0.1 NONE/200 0 CONNECT deb.nodesource.com:443 - HIER_NONE/- -
1635102093.673      0 172.17.0.1 NONE/503 4110 GET https://deb.nodesource.com/setup_12.x - HIER_NONE/- text/html

当网络可用且上游主机可达时,Squid 将愉快地从其内存缓存中提供服务:

1635102172.772    101 172.17.0.1 NONE/200 0 CONNECT deb.nodesource.com:443 - HIER_DIRECT/18.2.197.72 -
1635102172.792      1 172.17.0.1 TCP_MEM_HIT/200 14319 GET https://deb.nodesource.com/setup_12.x - HIER_NONE/- text/plain
squid
  • 1 个回答
  • 156 Views
Martin Hope
Mulle
Asked: 2019-08-16 08:43:31 +0800 CST

使用基本身份验证配置 SQUID 透明代理

  • 0

我正在尝试将 SQUID(Ubuntu 18.04 上的 3.5.27)配置为透明代理。更进一步,它应该处理身份验证和请求日志记录,但我一开始很简单,但已经卡住了。

我正在本地网络上工作。在 SQUID 服务器 (jarvis) 的 5000 端口上运行着一个简单的网络服务器。从我网络上的另一台计算机上,我试图访问http://jarvis:5000(显然在关闭 iptables 时有效)。

IPTABLES 配置适用于

iptables -t nat -A PREROUTING -i enp1s0 -p tcp -j REDIRECT --to-port 3128

我的 squid.conf 尽可能简单

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/htpasswd
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128 transparent
visible_hostname jarvis

/usr/lib/squid/basic_ncsa_auth /etc/squid/htpasswd 有效(用户名和密码之间没有冒号:

# /usr/lib/squid/basic_ncsa_auth /etc/squid/htpasswd
me itsame
OK

在我正在做的另一台机器上

curl -v -u me:itsame http://jarvis:5000

接收

GET / HTTP/1.1
> Host: jarvis:5000
> Authorization: Basic bWU6aXRzYW1l
> User-Agent: curl/7.63.0
> Accept: */*
> 
< HTTP/1.1 407 Proxy Authentication Required
< Server: squid/3.5.27
< Mime-Version: 1.0
< Date: Thu, 15 Aug 2019 16:41:13 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 3538
< X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
< Vary: Accept-Language
< Content-Language: en
* Authentication problem. Ignoring this.
< Proxy-Authenticate: Basic realm="Squid proxy-caching web server"
< X-Cache: MISS from jarvis
< X-Cache-Lookup: NONE from jarvis:0
< Via: 1.1 jarvis (squid/3.5.27)
< Connection: keep-alive

我错过了什么?

proxy squid
  • 1 个回答
  • 2141 Views
Martin Hope
Zumo de Vidrio
Asked: 2019-07-09 03:14:18 +0800 CST

HTTPS 代理中继

  • 0

在 Ubuntu 16.04 机器中,我使用 squid 3.5.12 设置了代理中继配置,如下所示:

External_proxy <-> Internal_proxy <-> 主机

此时,从外部和内部代理我都可以访问 http 和 https 网站,但从主机我只能访问 http 网站。

我squid.conf在 internal_proxy 中的当前是:

http_port 3128
logformat lmc %ts %la %>a %ul %<A %rm %ru %mt %>Hs %Ss "%{Referer}>h" "%{User-Agent}>h" %>st %<st %tr %<pt %<tt
access_log syslog:local1.info
access_log syslog:local0.info lmc
icp_port 0
cache_peer <external_proxy_IP> parent 8080 0 proxy-only originserver
acl SSL_ports port 443 
acl Safe_ports port 80
acl Safe_ports port 443
acl local_subnet src 192.168.100.0/24
acl CONNECT method CONNECT
http_access allow CONNECT local_subnet
http_access allow local_subnet Safe_ports
http_access allow local_subnet SSL_ports
http_access deny all
connect_timeout 510 minutes
request_timeout 500 minutes
cache_dir ufs /var/cache/squid 8192 16 256
shutdown_lifetime 2 seconds
hierarchy_stoplist cgi-bin ?
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
ftp_epsv off
via off
never_direct allow all
visible_hostname "internal_proxy_hostname"

当我尝试连接到某个 https 站点时,我收到以下信息:

wget https://google.com
--2019-07-08 13:08:23--  https://google.com/
Connecting to internal_proxy:3128... connected.
Proxy tunneling failed: Service UnavailableUnable to establish SSL connection.

在 internal_proxy 日志中:

TAG_NONE/503 0 CONNECT google.com:443 - HIER_NONE/- -
CONNECT google.com:443 - 503 TAG_NONE "-"

我试过这个程序:但结果是一样的。

注意:我无权访问 external_proxy 配置

squid http-proxy
  • 1 个回答
  • 2024 Views
Martin Hope
Peter
Asked: 2019-01-29 23:00:43 +0800 CST

Squid 阻止非代理用户

  • 0

我安装了正在侦听端口 3128 的 squid。现在,我想向每个尝试连接到任何 http/https 网页并且没有设置代理的用户显示一个错误网页。我需要设置什么参数?

proxy squid
  • 1 个回答
  • 44 Views
Martin Hope
acgbox
Asked: 2018-09-25 15:14:28 +0800 CST

排除 wpad 中的本地地址

  • 1

我有一个代理 Ubuntu 18.04,带有 squid 3128 和 apache2,我发布了带有选项 dhcp 252 的自动配置文件 proxy.pac。

该文件具有以下内容:

function FindProxyForURL(url, host) {return "PROXY 192.168.0.10:3128";}

我的本地网络中的某些计算机上有一些应用程序具有这些 url 供访问:

http://localhost:8080
http://192.168.0.12:8090/app/bar

问题是 squid 对这种类型的请求有限制

如何配置 proxy.pac 以排除对本地地址的请求?(例如:192.168.0.0/24 或 localhost:port)

需要注意的重要一点是,临时解决方案是手动将代理的 ip:port 放入浏览器中(在 Windows:控制面板/Internet 选项中),然后选中“不要将代理服务器用于本地地址”框,然后proxy.pac 没有意义。

dhcp squid
  • 1 个回答
  • 1373 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve