简体   繁体   English

配置 HTTPS 正向代理时出错(AH02268:下游服务器需要客户端证书,但未配置)

[英]Error configuring a HTTPS forward proxy (AH02268: downstream server wanted client certificate but none are configured)

I think I'm doing several mistakes together, but I'm stuck and I'm going out crazy.我想我一起犯了几个错误,但我被困住了,我要疯了。 And I guess the question has already been posed, but, even searching a lot, I could not find this exact case posted anywhere.而且我猜这个问题已经提出了,但是,即使搜索了很多,我也找不到这个确切的案例发布在任何地方。

The task I'm working to is calling a remote HTTPS server through a proxy:我正在做的任务是通过代理调用远程 HTTPS 服务器:

wget http://localhost/remote?wsdl

points to指着

https://someserver.com/service?wsdl

In a diagram:在图表中:

       (http)            (https)
client ------> localhost -------> someserver.com

Using the wonderful Apache web server (really, not kidding).使用出色的 Apache web 服务器(真的,不是开玩笑)。

The certificate exchange occurs between the proxy and the remote server and I already installed the client certificate with the private key onboard of the proxy.证书交换发生在代理和远程服务器之间,我已经使用代理板载的私钥安装了客户端证书。 The customer gave me the certificates in a .p12 file.客户在.p12文件中给了我证书。

Trying to test the wanted webservice with SoapUI and the same certificates, I got the expected behavior (everything is working fine).尝试使用SoapUI和相同的证书测试所需的 web 服务,我得到了预期的行为(一切正常)。 But now I have to call services from a middleware.但是现在我必须从中间件调用服务。 For this I'm configuring a SSL Proxy with Apache.为此,我正在使用 Apache 配置 SSL 代理。

I tried to do this in 2 ways, both unsuccessful:我尝试以两种方式做到这一点,但均不成功:

1) Defining a proxy and defining the SSL parameters respectively in two files: 1)在两个文件中分别定义一个proxy和定义SSL参数:

/etc/apache2/conf.d/mods-available/ssl.conf
/etc/apache2/conf.d/mods-available/proxy.conf

The first file contains:第一个文件包含:

# /etc/apache2/conf.d/mods-available/ssl.conf
SSLPassPhraseDialog  exec:/usr/local/etc/apache2/pwf.sh # to avoid manuallly entering passphrase
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300

SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin

ErrorLog /var/log/ssl_error_log
TransferLog /var/log/ssl_access_log
LogLevel warn

SSLEngine off
SSLProtocol all -SSLv2

SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES
SSLCertificateFile /usr/local/etc/apache2/ssl.crt/certificate.pem
SSLCertificateKeyFile /usr/local/etc/apache2/ssl.key/server.key
SSLCertificateChainFile /usr/local/etc/apache2/ssl.crt/chain.pem

CustomLog /var/log/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

And the second file contains:第二个文件包含:

# /etc/apache/conf.d/mods-available/proxy.conf
SetEnv proxy-sendcl 1

SSLProxyEngine On

ProxyPass /remote https://someserver.com/service
ProxyPassReverse /remote https://someserver.com/service

I enabled these modules via:我通过以下方式启用了这些模块:

sudo a2enmod proxy & a2enmod ssl

2) Defining a Virtual Host 2) 定义虚拟主机

/etc/apache2/conf.d/sites-available/remote.conf 

this method being mutually exclusive with the previous way:此方法与前一种方法互斥:

# 
# remote.local
<VirtualHost SOMEIP:443>

    ProxyRequests on
    DocumentRoot /var/www/html/remote

    ServerName someserver.com

    SSLEngine on
    SSLProxyEngine on
    SSLCertificateFile /usr/local/etc/apache2/ssl.crt/certificate.pem
    SSLCertificateKeyFile /usr/local/etc/apache2/ssl.key/server.key
    SSLCertificateChainFile /usr/local/etc/apache2/ssl.crt/chain.pem
    ProxyPreserveHost On

    ErrorLog ${APACHE_LOG_DIR}/error_remote.log
    CustomLog ${APACHE_LOG_DIR}/access_remote.log combined

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    <Location /remote>
        ProxyPass https://someserver.com/service
        ProxyPassReverse https://someserver.com/service
        Order allow,deny
        Allow from all
    </Location>

</VirtualHost>

I enabled this with:我启用了这个:

sudo a2ensite remote

In any of the two ways I try, I get these (identical) errors when I try to access the local URL:在我尝试的两种方法中的任何一种中,当我尝试访问本地 URL 时都会收到这些(相同的)错误:

[Thu Jun 11 18:39:15.724705 2020] [ssl:warn] [pid 30578] AH02268: Proxy client certificate callback: (localhost:80) downstream server wanted client certificate but none are configured
[Thu Jun 11 18:39:15.794381 2020] [proxy_http:error] [pid 30578] (20014)Internal error (specific information not available): [client ::1:49118] AH01102: error reading status line from remote server someserver.com:443
[Thu Jun 11 18:39:15.794585 2020] [proxy:error] [pid 30578] [client ::1:49118] AH00898: Error reading from remote server returned by /remote/

The chain of certificates is OK:证书链没问题:

openssl crl2pkcs7 -nocrl -certfile chain.pem | openssl pkcs7 -print_certs -noout

Shows me all the certificate issuer and subject for CA, intermediate and server certificate:向我显示 CA、中间和服务器证书的所有证书颁发者和主题:

openssl verify -CAfile ca.pem -untrusted chain.pem certificate.pem 

certificate.pem: OK

Any suggestion will be appreciated, thanks in advance.任何建议将不胜感激,在此先感谢。

I missed to configure the certificate for the Reverse Proxy, namely the section我错过了为反向代理配置证书,即部分

SSLProxyMachineCertificateFile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不中断客户端与服务器之间的https隧道的情况下配置apache反向代理? - How apache reverse proxy can be configured without breaking the https tunnel between client & server? 在客户端区域中配置WHMCS 500服务器错误 - Configuring WHMCS 500 Server Error In Client Area 如何在自签名服务器和客户端证书上调用 https get 方法 - How to call the https get method on a self signed server and client certificate 在android应用中配置SSL客户端证书以在Tomcat上的Web服务器中进行客户端身份验证 - Configuring SSL client certificate in android app for client authentication in web server on tomcat Flask App获取AH01630:客户端被Apache中的服务器配置错误拒绝 - Flask App Getting AH01630: client denied by server configuration error in Apache 访问 web.htaccess 时出错 AH01797:客户端被服务器配置拒绝 - error accessing web htaccess AH01797: client denied by server configuration 如何解决或消除“ AH01630:客户端被服务器配置拒绝”错误? - How to resolve or eliminate `AH01630: client denied by server configuration` error? AH00526:Wamp服务器启动错误 - AH00526:Wamp server starting error 使用Apache使用多个证书配置反向代理https - configuring reverse proxy https with multiple certificates with Apache 使用https将Apache配置为Tomcat的反向代理 - Configuring Apache as reverse proxy to Tomcat using https
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM