使用 s_client 进行代理身份验证

问题描述 投票:0回答:4

注意:这不是 openssl s_client using a proxy 的重复,因为我对代理身份验证特别感兴趣,而不是使用代理的能力。

我正在使用

openssl s_client
检查目标服务器的证书,以了解连接如何/在何处工作或不工作。由于我位于公司代理后面,我可以使用
-proxy
标志指定代理服务器,但是我需要将身份验证详细信息(用户名/密码)传递给该代理 - 而且我还没有弄清楚如何做到这一点。

openssl s_client -proxy my.proxy.server:8080 -connect my.target.host

成功连接到代理服务器,但是,可以理解的是,会导致错误

s_client: HTTP CONNECT failed: 407 Unauthorized

user:[email protected]
http://user:[email protected]
的形式传递代理服务器都会导致错误
s_client: -proxy argument malformed or ambiguous

如何将代理身份验证传递给 s_client?我很难相信它支持代理但不支持经过身份验证的代理。

我正在使用 openssl 版本 1.1.1a。

proxy openssl proxy-authentication
4个回答
1
投票

只是为了跟进 @Arnaud Grandville 的答案:OpenSSL v3 beta 1 现已发布,它包含代理身份验证选项。但是,您必须自己编译它。

不幸的是,在 v3 beta 1 中,HTTP 代码存在一些问题,因此您无法按原样使用其网站上的代码。任何想要从源代码编译的人都可以使用以下命令来获取具有有效代理身份验证的 OpenSSL 安装:

git clone --branch openssl-3.0.0-beta1 https://github.com/openssl/openssl.git
cd openssl
git fetch
git checkout 6a1f9cd -- crypto/http/http_client.c
./Configure
make
make install

编辑:对于更高版本,由于错误已修复,因此不再需要此操作。例如,对于 3.0.5 版本,您可以简单地运行:

git clone --branch openssl-3.0.5 https://github.com/openssl/openssl.git
cd openssl
./Configure
make
make install

0
投票

您可以使用 escape-from-intranet https://github.com/quaddy-services/escape-from-intranet#introduction

并指定

主机=my.proxy.server
端口=8080

在应用程序中并使用

openssl s_client -proxy localhost:3128 -connect my.target.host

您本地运行的应用程序将使用您的凭据丰富真正的代理调用。

(如果您有透明代理,则需要在“决策”菜单中将默认代理决策切换为“代理”)


0
投票

openssl v3.0 将支持

proxy_user
proxy_pass
选项。

暂时没有解决办法,proxy之后的语法是

 host + ':' + service
 host + ':' + '*'
 host + ':'
        ':' + service  
 '*'  + ':' + service
 host
 service

参见。 BIO_parse_hostserv


0
投票

从 OpenSSL v3.2.0 开始,您可以执行以下操作:

openssl s_client -proxy my.proxy.server:8080 -proxy_user user -proxy_pass pass:pass -connect my.target.host

请注意指定密码时使用

pass:
前缀。这是为了防止出现错误
Invalid password argument, missing ':' within the first 5 chars
(请参阅:https://github.com/openssl/openssl/issues/19089#issuecomment-1230167594

© www.soinside.com 2019 - 2024. All rights reserved.