我已經在 Ubuntu 上安裝了 Apache,安裝了 GNUTLS 模組,一切正常:
root@ilnwad15:~# apache2 -v
Server version: Apache/2.2.22 (Ubuntu)
Server built: Jul 12 2013 13:37:15
現在,我希望在連接埠 1443 上,如果客戶端憑證的 CA 不是我伺服器上的 CA,那麼它將被阻止。
這就是我在 /etc/apache2/apache2.conf 上配置它的方式
Listen *:443
Listen *:1443
<VirtualHost *:443>
GnuTLSEnable on
GnuTLSKeyFile /etc/apache2/certs/ilnwad15.tlv.sap.corp.key
GnuTLSCertificateFile /etc/apache2/certs/ilnwad15.tlv.sap.corp.crt
DocumentRoot /disk2/var/www/html
GnuTLSPriorities EXPORT
ServerName ilnwad15
</VirtualHost>
<VirtualHost *:1443>
GnuTLSEnable on
GnuTLSKeyFile /etc/apache2/certs/ilnwad15.tlv.sap.corp.key
GnuTLSCertificateFile /etc/apache2/certs/ilnwad15.tlv.sap.corp.crt
GnuTLSPriorities EXPORT
GnuTLSClientCAFile /etc/apache2/certs/ca.pem
GNUTLSClientVerify require
DocumentRoot /disk2/var/www/html
ServerName ilnwad15
</VirtualHost>
現在它所做的是,當發送沒有證書的請求時,會出現內部錯誤。
[root@ilnwadv56 ~]# wget --save-headers --no-check-certificate HTTPs://ilnwad15.tlv.sap.corp:1443
--2013-12-18 17:23:01-- https://ilnwad15.tlv.sap.corp:1443/
Resolving ilnwadv62... 172.16.162.21
Connecting to ilnwadv62|172.16.162.21|:18080... connected.
WARNING: cannot verify ilnwad15.tlv.sap.corp's certificate, issued by `/C=IL/L=Raanana/O=SAP/OU=AccAD/CN=Dummy device':
Unable to locally verify the issuer's authority.
WARNING: certificate common name `dummy.service.com' doesn't match requested host name `ilnwad15.tlv.sap.corp'.
Proxy request sent, awaiting response... 500 Server Error
2013-12-18 17:23:01 ERROR 500: Server Error.
但是,當請求的憑證其 CA 與伺服器 CA 不符時,我會收到 200 OK,Internet Explorer
而不會收到 403 Forbidden。這樣做時wget
我得到了failed: Service Unavailable to establish SSL connection.
[root@ilnwadv56 ~]# wget --save-headers --no-check-certificate --certificate=/sapmnt/accad/other/client.crt --private-key=/sapmnt/accad/other/client.key HTTPs://ilnwad15.tlv.sap.corp:443
--2013-12-18 17:46:17-- https://ilnwad15.tlv.sap.corp/
Resolving ilnwadv62... 172.16.162.21
Connecting to ilnwadv62|172.16.162.21|:18080... connected.
Proxy tunneling failed: Service UnavailableUnable to establish SSL connection.
有誰知道我的錯在哪裡?提前致謝。
答案1
好的,首先,感謝所有試圖提供幫助的人(特別是@MadHatter)。問題是我使用了代理,所以我不得不這樣做unset https_proxy
,問題得到了解決。
現在,它工作正常。發送虛擬證書時(不通過 提供任何證書wget
)
wget --save-headers --no-check-certificate HTTPS://ilnwad15.tlv.sap.corp:1443
--2013-12-22 10:37:02-- https://ilnwad15.tlv.sap.corp:1443/
Resolving ilnwad15.tlv.sap.corp... 172.16.60.21
Connecting to ilnwad15.tlv.sap.corp|172.16.60.21|:1443... connected.
OpenSSL: error:1409442F:SSL routines:SSL3_READ_BYTES:tlsv1 alert insufficient security
Unable to establish SSL connection.
當給予正確的證書。
wget --save-headers --certificate=/sapmnt/accad/other/ilnwad15.tlv.sap.corp.crt --private-key=/sapmnt/accad/other/ilnwad15.tlv.sap.corp.key --no-check-certificate HTTPS://ilnwad15.tlv.sap.corp:1443
--2013-12-22 10:33:59-- https://ilnwad15.tlv.sap.corp:1443/
Resolving ilnwad15.tlv.sap.corp... 172.16.60.21
Connecting to ilnwad15.tlv.sap.corp|172.16.60.21|:1443... connected.
WARNING: cannot verify ilnwad15.tlv.sap.corp's certificate, issued by /C=IL/ST=Central District/L=Raanana/O=SAP AG/OU=AccAD/CN=AccAD CA/[email protected]:
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4598 (4.5K) [text/html]
Saving to: `index.html'
100%[======================================>] 4,598 --.-K/s in 0s
2013-12-22 10:33:59 (38.5 MB/s) - `index.html' saved [4598/4598]
謝謝! :D