簡體   English   中英

配置 HTTPS 正向代理時出錯(AH02268:下游服務器需要客戶端證書,但未配置)

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

我想我一起犯了幾個錯誤,但我被困住了,我要瘋了。 而且我猜這個問題已經提出了,但是,即使搜索了很多,我也找不到這個確切的案例發布在任何地方。

我正在做的任務是通過代理調用遠程 HTTPS 服務器:

wget http://localhost/remote?wsdl

指着

https://someserver.com/service?wsdl

在圖表中:

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

使用出色的 Apache web 服務器(真的,不是開玩笑)。

證書交換發生在代理和遠程服務器之間,我已經使用代理板載的私鑰安裝了客戶端證書。 客戶在.p12文件中給了我證書。

嘗試使用SoapUI和相同的證書測試所需的 web 服務,我得到了預期的行為(一切正常)。 但是現在我必須從中間件調用服務。 為此,我正在使用 Apache 配置 SSL 代理。

我嘗試以兩種方式做到這一點,但均不成功:

1)在兩個文件中分別定義一個proxy和定義SSL參數:

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

第一個文件包含:

# /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"

第二個文件包含:

# /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

我通過以下方式啟用了這些模塊:

sudo a2enmod proxy & a2enmod ssl

2) 定義虛擬主機

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

此方法與前一種方法互斥:

# 
# 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>

我啟用了這個:

sudo a2ensite remote

在我嘗試的兩種方法中的任何一種中,當我嘗試訪問本地 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/

證書鏈沒問題:

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

向我顯示 CA、中間和服務器證書的所有證書頒發者和主題:

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

certificate.pem: OK

任何建議將不勝感激,在此先感謝。

我錯過了為反向代理配置證書,即部分

SSLProxyMachineCertificateFile

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM