本文檔介紹如何在Cisco Adaptive Security Appliance(ASA)上對VPN使用者提供的證書使用線上證書狀態協定(OCSP)驗證。提供了兩個OCSP伺服器(Microsoft Windows Certificate Authority [CA]和OpenSSL)的配置示例。「驗證」部分描述資料包級別的詳細流程,「故障排除」部分重點介紹典型錯誤和問題。
思科建議您瞭解以下主題:
本文中的資訊係根據以下軟體和硬體版本:
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
客戶端使用遠端訪問VPN。此訪問可以是Cisco VPN Client(IPSec)、Cisco AnyConnect Secure Mobility(SSL/Internet Key Exchange Version 2 [IKEv2])或WebVPN(門戶)。為了登入,客戶端提供正確的證書以及在ASA本地配置的使用者名稱/密碼。客戶端證書通過OCSP伺服器進行驗證。
ASA配置為SSL訪問。使用者端正在使用AnyConnect進行登入。ASA使用簡單證書註冊協定(SCEP)來請求證書:
crypto ca trustpoint WIN2012
revocation-check ocsp
enrollment url http://10.147.25.80:80/certsrv/mscep/mscep.dll
crypto ca certificate map MAP 10
subject-name co administrator
建立證書對映以標識其主題名稱包含單詞administrator(不區分大小寫)的所有使用者。這些使用者已繫結到名為RA:
webvpn
enable outside
anyconnect image disk0:/anyconnect-win-3.1.02040-k9.pkg 1
anyconnect enable
tunnel-group-list enable
certificate-group-map MAP 10 RA
VPN配置需要成功授權(即經過驗證的證書)。它還要求本地定義的使用者名稱(身份驗證aaa)具有正確的憑據:
username cisco password xxxxxxx
ip local pool POOL 192.168.11.100-192.168.11.105 mask 255.255.255.0
aaa authentication LOCAL
aaa authorization LOCAL
group-policy MY internal
group-policy MY attributes
vpn-tunnel-protocol ikev1 ikev2 l2tp-ipsec ssl-client ssl-clientless
tunnel-group RA type remote-access
tunnel-group RA general-attributes
address-pool POOL
default-group-policy MY
authorization-required
tunnel-group RA webvpn-attributes
authentication aaa certificate
group-alias RA enable
以下過程介紹了如何為Microsoft伺服器配置角色服務:
如果需要,可以新增帶策略的Web服務。
OCSP服務使用證書對OCSP響應進行簽名。必須在Microsoft伺服器上生成特殊證書,並且必須包括:
需要此證書以防止OCSP驗證循環。ASA不使用OCSP服務嘗試檢查OCSP服務提供的證書。
以下過程介紹了如何使用聯機配置管理來配置OCSP:
OCSP的Microsoft實施符合RFC 5019適用於高容量環境的輕型線上證書狀態協定(OCSP)配置檔案(這是簡化版本的RFC 2560 X.509 Internet公鑰基礎設施線上證書狀態協定 — OCSP)。
ASA對OCSP使用RFC 2560。這兩個RFC的區別之一是RFC 5019不接受ASA傳送的簽名請求。
可以強制Microsoft OCSP服務接受這些已簽名的請求,並使用正確的已簽名的響應進行回覆。導航到Revocation Configuration > RevocationConfiguration1 > Edit Properties,然後選擇選項以啟用NONCE擴展支援。
OCSP服務現已可供使用。
雖然Cisco不建議這樣做,但是可以在ASA上禁用nonces:
BSNS-ASA5510-3(config-ca-trustpoint)# ocsp disable-nonce
現在,必須重新配置CA,以便在所有頒發的證書中包括OCSP伺服器擴展。驗證證書時,ASA使用該擴展的URL以連線到OCSP伺服器。
此範例假設已設定OpenSSL伺服器。本節僅介紹OCSP配置和CA配置所需的更改。
以下過程介紹了如何生成OCSP證書:
[ OCSPresponder ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = OCSPSigning
[ UserCerts ]
authorityInfoAccess = OCSP;URI:http://10.61.208.243
openssl ocsp -index ourCAwebPage/index.txt -port 80 -rsigner
ocspresponder.crt -rkey ocspresponder.key -CA cacert.crt -text -out
log.txt
openssl ocsp -CAfile cacert.crt -issuer cacert.crt -cert example-cert.crt
-url http://10.61.208.243 -resp_text
更多示例可在OpenSSL網站上找到。
與ASA一樣,OpenSSL支援OCSP會話;可以使用 — nonce和 — no_nonce開關控制nonce。
ASA可以覆蓋OCSP URL。即使客戶端證書包含OCSP URL,它也會被ASA上的配置覆蓋:
crypto ca trustpoint WIN2012
revocation-check ocsp
enrollment url http://10.61.209.83:80/certsrv/mscep/mscep.dll
ocsp url http://10.10.10.10/ocsp
可以顯式定義OCSP伺服器地址。此命令示例匹配主題名稱中帶有管理員的所有證書,使用OPENSSL信任點驗證OCSP簽名,並使用http://11.11.11.11/ocsp的URL傳送請求:
crypto ca trustpoint WIN2012
revocation-check ocsp
enrollment url http://10.61.209.83:80/certsrv/mscep/mscep.dll
match certificate MAP override ocsp trustpoint OPENSSL 10 url
http://11.11.11.11/ocsp
crypto ca certificate map MAP 10
subject-name co administrator
用於查詢OCSP URL的順序為:
OCSP響應可以由其他CA簽名。在這種情況下,必須使用match certificate命令才能在ASA上使用不同的信任點進行OCSP證書驗證。
crypto ca trustpoint WIN2012
revocation-check ocsp
enrollment url http://10.61.209.83:80/certsrv/mscep/mscep.dll
match certificate MAP override ocsp trustpoint OPENSSL 10 url
http://11.11.11.11/ocsp
crypto ca certificate map MAP 10
subject-name co administrator
crypto ca trustpoint OPENSSL
enrollment terminal
revocation-check none
在此示例中,ASA對包含管理員的使用者名稱的所有證書使用OCSP URL重寫。ASA被迫根據另一個信任點OPENSSL驗證OCSP響應方證書。使用者證書仍在WIN2012信任點中驗證。
由於OCSP響應方證書具有「OCSP無撤銷檢查」擴展,因此即使強制對OPENSSL信任點進行OCSP驗證,也不會驗證證書。
預設情況下,當ASA嘗試驗證使用者證書時,將搜尋所有信任點。OCSP響應方證書的驗證不同。ASA僅搜尋已找到的使用者證書的信任點(在本例中為WIN2012)。
因此,必須使用match certificate命令來強制ASA使用不同的信任點進行OCSP證書驗證(在此示例中為OPENSSL)。
根據第一個匹配的信任點(本例中為WIN2012)驗證使用者證書,然後確定用於OCSP響應方驗證的預設信任點。
如果match certificate命令中未提供特定信任點,則會根據與使用者證書相同的信任點驗證OCSP證書(在本示例中為WIN2012):
crypto ca trustpoint WIN2012
revocation-check ocsp
enrollment url http://10.61.209.83:80/certsrv/mscep/mscep.dll
match certificate MAP override ocsp 10 url http://11.11.11.11/ocsp
使用本節內容,確認您的組態是否正常運作。
以下程式說明如何使用SCEP取得憑證:
debug crypto ca
debug crypto ca messages
debug crypto ca transaction
BSNS-ASA5510-3(config-ca-crl)# crypto ca authenticate WIN2012
Crypto CA thread wakes up!
CRYPTO_PKI: Sending CA Certificate Request:
GET /certsrv/mscep/mscep.dll/pkiclient.exe?operation=GetCACert&message=
WIN2012 HTTP/1.0
Host: 10.61.209.83
CRYPTO_PKI: http connection opened
INFO: Certificate has the following attributes:
Fingerprint: 27dda0e5 e1ed3f4c e3a2c3da 6d1689c2
Do you accept this certificate? [yes/no]:
% Please answer 'yes' or 'no'.
Do you accept this certificate? [yes/no]:
yes
Trustpoint CA certificate accepted.
BSNS-ASA5510-3(config)# crypto ca enroll WIN2012為清楚起見,省略了部分輸出。
%
% Start certificate enrollment ..
% Create a challenge password. You will need to verbally provide this
password to the CA Administrator in order to revoke your certificate.
For security reasons your password will not be saved in the
configuration.
Please make a note of it.
Password: ****************
Re-enter password: ****************
% The fully-qualified domain name in the certificate will be:
BSNS-ASA5510-3.test-cisco.com
% Include the device serial number in the subject name? [yes/no]: yes
% The serial number in the certificate will be: JMX1014K16Y
Request certificate from CA? [yes/no]: yes
% Certificate request sent to Certificate Authority
BSNS-ASA5510-3(config)#
CRYPTO_PKI: Sending CA Certificate Request:
GET /certsrv/mscep/mscep.dll/pkiclient.exe?operation=GetCACert&message=
WIN2012 HTTP/1.0
Host: 10.61.209.83
CRYPTO_PKI: http connection opened
CRYPTO_PKI: Found a subject match - inserting the following cert record
into certList
BSNS-ASA5510-3(config)# show crypto ca certificatesASA不顯示大多數證書擴展。即使ASA證書包含「AIA中的OCSP URL」擴展,ASA CLI也不會顯示它。思科錯誤ID CSCui44335、「ASA ENH Certificate x509 extensions displayed(已顯示ASA增強型證書x509擴展)」請求此增強功能。
Certificate
Status: Available
Certificate Serial Number: 240000001cbf2fc89f44fe819700000000001c
Certificate Usage: General Purpose
Public Key Type: RSA (1024 bits)
Signature Algorithm: SHA1 with RSA Encryption
Issuer Name:
cn=test-cisco-DC-CA
dc=test-cisco
dc=com
Subject Name:
hostname=BSNS-ASA5510-3.test-cisco.com
serialNumber=JMX1014K16Y
CRL Distribution Points:
[1] ldap:///CN=test-cisco-DC-CA,CN=DC,CN=CDP,
CN=Public%20Key%20Services,CN=Services,CN=Configuration,
DC=test-cisco,DC=com?certificateRevocationList?base?objectClass=
cRLDistributionPoint
Validity Date:
start date: 11:02:36 CEST Oct 13 2013
end date: 11:02:36 CEST Oct 13 2015
Associated Trustpoints: WIN2012
CA Certificate
Status: Available
Certificate Serial Number: 3d4c0881b04c799f483f4bbe91dc98ae
Certificate Usage: Signature
Public Key Type: RSA (2048 bits)
Signature Algorithm: SHA1 with RSA Encryption
Issuer Name:
cn=test-cisco-DC-CA
dc=test-cisco
dc=com
Subject Name:
cn=test-cisco-DC-CA
dc=test-cisco
dc=com
Validity Date:
start date: 07:23:03 CEST Oct 10 2013
end date: 07:33:03 CEST Oct 10 2018
Associated Trustpoints: WIN2012
以下程式說明如何在使用者端上使用Web瀏覽器來取得憑證:
以下過程介紹了如何檢查OCSP驗證:
debug crypto ca為清楚起見,省略了部分輸出。
debug crypto ca messages
debug crypto ca transaction
%ASA-6-725001: Starting SSL handshake with client outside:
10.61.209.83/51262 for TLSv1 session.
%ASA-7-717025: Validating certificate chain containing 1 certificate(s).
%ASA-7-717029: Identified client certificate within certificate chain.
serial number: 240000001B2AD208B12811687400000000001B, subject name:
cn=Administrator,cn=Users,dc=test-cisco,dc=com.
Found a suitable trustpoint WIN2012 to validate certificate.
%ASA-7-717035: OCSP status is being checked for certificate. serial
number: 240000001B2AD208B12811687400000000001B, subject name:
cn=Administrator,cn=Users,dc=test-cisco,dc=com.
%ASA-6-302013: Built outbound TCP connection 1283 for outside:
10.61.209.83/80 (10.61.209.83/80) to identity:10.48.67.229/35751
(10.48.67.229/35751)
%ASA-6-717033: CSP response received.
%ASA-7-717034: No-check extension found in certificate. OCSP check
bypassed.
%ASA-6-717028: Certificate chain was successfully validated with
revocation status check.
%ASA-7-717036: Looking for a tunnel group match based on certificate maps
for peer certificate with serial number:
240000001B2AD208B12811687400000000001B, subject name: cn=Administrator,
cn=Users,dc=test-cisco,dc=com, issuer_name: cn=test-cisco-DC-CA,
dc=test-cisco,dc=com.
%ASA-7-717038: Tunnel group match found. Tunnel Group: RA, Peer
certificate: serial number: 240000001B2AD208B12811687400000000001B,
subject name: cn=Administrator,cn=Users,dc=test-cisco,dc=com,
issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,dc=com.
%ASA-6-113012: AAA user authentication Successful : local database :
user = cisco
%ASA-6-113009: AAA retrieved default group policy (MY) for user = cisco
%ASA-6-113039: Group <MY> User <cisco> IP <10.61.209.83> AnyConnect parent
session started.
BSNS-ASA5510-3(config)# show vpn-sessiondb detail anyconnect
Session Type: AnyConnect Detailed
Username : cisco Index : 4
Assigned IP : 192.168.11.100 Public IP : 10.61.209.83
Protocol : AnyConnect-Parent SSL-Tunnel DTLS-Tunnel
License : AnyConnect Premium
Encryption : AnyConnect-Parent: (1)none SSL-Tunnel: (1)RC4
DTLS-Tunnel: (1)AES128
Hashing : AnyConnect-Parent: (1)none SSL-Tunnel: (1)SHA1
DTLS-Tunnel: (1)SHA1
Bytes Tx : 10540 Bytes Rx : 32236
Pkts Tx : 8 Pkts Rx : 209
Pkts Tx Drop : 0 Pkts Rx Drop : 0
Group Policy : MY Tunnel Group : RA
Login Time : 11:30:31 CEST Sun Oct 13 2013
Duration : 0h:01m:05s
Inactivity : 0h:00m:00s
NAC Result : Unknown
VLAN Mapping : N/A VLAN : none
AnyConnect-Parent Tunnels: 1
SSL-Tunnel Tunnels: 1
DTLS-Tunnel Tunnels: 1
AnyConnect-Parent:
Tunnel ID : 4.1
Public IP : 10.61.209.83
Encryption : none Hashing : none
TCP Src Port : 51401 TCP Dst Port : 443
Auth Mode : Certificate and userPassword
Idle Time Out: 30 Minutes Idle TO Left : 29 Minutes
Client OS : Windows
Client Type : AnyConnect
Client Ver : Cisco AnyConnect VPN Agent for Windows 3.1.02040
Bytes Tx : 5270 Bytes Rx : 788
Pkts Tx : 4 Pkts Rx : 1
Pkts Tx Drop : 0 Pkts Rx Drop : 0
SSL-Tunnel:
Tunnel ID : 4.2
Assigned IP : 192.168.11.100 Public IP : 10.61.209.83
Encryption : RC4 Hashing : SHA1
Encapsulation: TLSv1.0 TCP Src Port : 51406
TCP Dst Port : 443 Auth Mode : Certificate and
userPassword
Idle Time Out: 30 Minutes Idle TO Left : 29 Minutes
Client OS : Windows
Client Type : SSL VPN Client
Client Ver : Cisco AnyConnect VPN Agent for Windows 3.1.02040
Bytes Tx : 5270 Bytes Rx : 1995
Pkts Tx : 4 Pkts Rx : 10
Pkts Tx Drop : 0 Pkts Rx Drop : 0
DTLS-Tunnel:
Tunnel ID : 4.3
Assigned IP : 192.168.11.100 Public IP : 10.61.209.83
Encryption : AES128 Hashing : SHA1
Encapsulation: DTLSv1.0 UDP Src Port : 58053
UDP Dst Port : 443 Auth Mode : Certificate and
userPassword
Idle Time Out: 30 Minutes Idle TO Left : 29 Minutes
Client OS : Windows
Client Type : DTLS VPN Client
Client Ver : Cisco AnyConnect VPN Agent for Windows 3.1.02040
Bytes Tx : 0 Bytes Rx : 29664
Pkts Tx : 0 Pkts Rx : 201
Pkts Tx Drop : 0 Pkts Rx Drop : 0
CRYPTO_PKI: Starting OCSP revocation
CRYPTO_PKI: Attempting to find OCSP override for peer cert: serial number:
2400000019F341BA75BD25E91A000000000019, subject name: cn=Administrator,
cn=Users,dc=test-cisco,dc=com, issuer_name: cn=test-cisco-DC-CA,
dc=test-cisco,dc=com.
CRYPTO_PKI: No OCSP overrides found. <-- no OCSP url in the ASA config
CRYPTO_PKI: http connection opened
CRYPTO_PKI: OCSP response received successfully.
CRYPTO_PKI: OCSP found in-band certificate: serial number:
240000001221CFA239477CE1C0000000000012, subject name:
cn=DC.test-cisco.com, issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,
dc=com
CRYPTO_PKI: OCSP responderID byKeyHash
CRYPTO_PKI: OCSP response contains 1 cert singleResponses responseData
sequence.
Found response for request certificate!
CRYPTO_PKI: Verifying OCSP response with 1 certs in the responder chain
CRYPTO_PKI: Validating OCSP response using trusted CA cert: serial number:
3D4C0881B04C799F483F4BBE91DC98AE, subject name: cn=test-cisco-DC-CA,
dc=test-cisco,dc=com, issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,
dc=com
CERT-C: W ocsputil.c(538) : Error #708h
CERT-C: W ocsputil.c(538) : Error #708h
CRYPTO_PKI: Validating OCSP responder certificate: serial number:
240000001221CFA239477CE1C0000000000012, subject name:
cn=DC.test-cisco.com, issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,
dc=com, signature alg: SHA1/RSA
CRYPTO_PKI: verifyResponseSig:3191
CRYPTO_PKI: OCSP responder cert has a NoCheck extension
CRYPTO_PKI: Responder cert status is not revoked <-- do not verify
responder cert
CRYPTO_PKI: response signed by the CA
CRYPTO_PKI: Storage context released by thread Crypto CA
CRYPTO_PKI: transaction GetOCSP completed
CRYPTO_PKI: Process next cert, valid cert. <-- client certificate
validated correctly
如果按照具有多個OCSP源的ASA中的說明配置匹配證書,則優先使用:
CRYPTO_PKI: Processing map MAP sequence 10...
CRYPTO_PKI: Match of subject-name field to map PASSED. Peer cert field: =
cn=Administrator,cn=Users,dc=test-cisco,dc=com, map rule: subject-name
co administrator.
CRYPTO_PKI: Peer cert has been authorized by map: MAP sequence: 10.
CRYPTO_PKI: Found OCSP override match. Override URL: http://11.11.11.11/ocsp,
Override trustpoint: OPENSSL
使用OCSP URL覆蓋時,調試程式為:
CRYPTO_PKI: No OCSP override via cert maps found. Override was found in
trustpoint: WIN2012, URL found: http://10.10.10.10/ocsp.
以下過程介紹了如何撤銷證書和確認撤銷狀態:
c:\certutil -crl
CertUtil: -CRL command completed succesfully.
[2013-10-13 12:49:53] Contacting 10.48.67.229.
[2013-10-13 12:49:54] No valid certificates available for authentication.
[2013-10-13 12:49:55] Certificate Validation Failure
CRYPTO_PKI: Starting OCSP revocation
CRYPTO_PKI: OCSP response received successfully.
CRYPTO_PKI: OCSP found in-band certificate: serial number:
240000001221CFA239477CE1C0000000000012, subject name:
cn=DC.test-cisco.com, issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,
dc=com
CRYPTO_PKI: OCSP responderID byKeyHash
CRYPTO_PKI: OCSP response contains 1 cert singleResponses responseData
sequence.
Found response for request certificate!
CRYPTO_PKI: Verifying OCSP response with 1 certs in the responder chain
CRYPTO_PKI: Validating OCSP response using trusted CA cert: serial number:
3D4C0881B04C799F483F4BBE91DC98AE, subject name: cn=test-cisco-DC-CA,
dc=test-cisco,dc=com, issuer_name: cn=test-cisco-DC-CA,dc=test-cisco,
dc=com
CRYPTO_PKI: verifyResponseSig:3191
CRYPTO_PKI: OCSP responder cert has a NoCheck extension
CRYPTO_PKI: Responder cert status is not revoked
CRYPTO_PKI: response signed by the CA
CRYPTO_PKI: Storage context released by thread Crypto CA
CRYPTO_PKI: transaction GetOCSP completed
CRYPTO_PKI: Received OCSP response:Oct 13 2013 12:48:03: %ASA-3-717027:
Certificate chain failed validation. Generic error occurred, serial
number: 240000001B2AD208B12811687400000000001B, subject name:
cn=Administrator,cn=Users,dc=test-cisco,dc=com.
CRYPTO_PKI: Blocking chain callback called for OCSP response (trustpoint:
WIN2012, status: 1)
CRYPTO_PKI: Destroying OCSP data handle 0xae255ac0
CRYPTO_PKI: OCSP polling for trustpoint WIN2012 succeeded. Certificate
status is REVOKED.
CRYPTO_PKI: Process next cert in chain entered with status: 13.
CRYPTO_PKI: Process next cert, Cert revoked: 13
本節提供的資訊可用於對組態進行疑難排解。
ASA在OCSP伺服器關閉時報告:
CRYPTO_PKI: unable to find a valid OCSP server.
CRYPTO PKI: OCSP revocation check has failed. Status: 1800.
封包擷取也有助於進行疑難排解。
如果OCSP伺服器上的當前時間早於ASA上的時間(可以接受較小的差異),則OCSP伺服器將傳送未經授權的響應,ASA將報告該響應:
CRYPTO_PKI: OCSP response status - unauthorized
當ASA收到來自未來時間的OCSP響應時,也會失敗。
如果伺服器上的nonces不受支援(這是Microsoft Windows 2012 R2的預設設定),則會返回未經授權的響應:
SCEP/OCSP請求的問題通常是由於Internet資訊服務7(IIS7)上的身份驗證不正確造成的。確保配置了匿名訪問:
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
25-Oct-2013 |
初始版本 |