On an enterprise network shown in Figure 1, the FW is located at the edge to function as the egress gateway. The FW uses CMPv2 to apply for a local certificate for the first time from the CA server located on the public network. The local certificate will be automatically downloaded to the device storage.
This example provides only the configurations on FW. For the configurations on the CA server, see the CA server product manual.
The configuration roadmap is as follows:
To complete the configuration, you need the following data:
CA name
Subject of the CA certificate
Reference and secret values of the MAC
Obtained from the CMPv2 server in out-of-band mode.
<sysname> system-view [sysname] sysname FW [FW] interface GigabitEthernet 0/0/1 [FW-GigabitEthernet0/0/1] ip address 10.2.0.2 255.255.255.0 [FW-GigabitEthernet0/0/1] quit [FW] interface GigabitEthernet 0/0/2 [FW-GigabitEthernet0/0/2] ip address 10.1.0.2 255.255.255.0 [FW-GigabitEthernet0/0/2] quit [FW] ip route-static 10.3.0.0 255.255.255.0 10.2.0.1
[FW] firewall zone trust [FW-zone-trust] set priority 85 [FW-zone-trust] add interface GigabitEthernet 0/0/2 [FW-zone-trust] quit [FW] firewall zone untrust [FW-zone-untrust] set priority 5 [FW-zone-untrust] add interface GigabitEthernet 0/0/1 [FW-zone-untrust] quit
# Create a 2048-bit RSA key pair named rsa_cmp and allow it to be exported.
[FW] pki rsa local-key-pair create rsa_cmp exportable Info: The name of the new key-pair will be: rsa_cmp The size of the public key ranges from 2048 to 4096. Input the bits in the modules:2048 Generating key-pairs... ...........+++ ...........+++
# Configure the PKI entity user01.
[FW] pki entity user01 [FW-pki-entity-user01] common-name hello [FW-pki-entity-user01] country cn [FW-pki-entity-user01] email user@test.abc.com [FW-pki-entity-user01] fqdn test.abc.com [FW-pki-entity-user01] ip-address 10.2.0.2 [FW-pki-entity-user01] state jiangsu [FW-pki-entity-user01] organization huawei [FW-pki-entity-user01] organization-unit info [FW-pki-entity-user01] quit
# Create the CMP session named cmp.
[FW] pki cmp session cmp
# Specify the pki entity name referenced by the CMP session.
[FW-pki-cmp-session-cmp] cmp-request entity user01
# Configure a CA name, for example, C=cn,ST=beijing,L=SD,O=BB,OU=BB,CN=BB.
The field order in the CA name must be the same as that in the CA certificate; otherwise, the server considers the CA name invalid.
[FW-pki-cmp-session-cmp] cmp-request ca-name "C=cn,ST=beijing,L=SD,O=BB,OU=BB,CN=BB"
# Configure the URL for certificate application.
[FW-pki-cmp-session-cmp] cmp-request server url http://10.3.0.1:8080
# Specify the RSA key pair used for certificate application and configure the device to update the RSA key pair together with the certificate.
[FW-pki-cmp-session-cmp] cmp-request rsa local-key-pair rsa_cmp regenerate
# Use the MAC for initial certificate application. Set the MAC reference value to 1234 and secret value to 123456.
[FW-pki-cmp-session-cmp] cmp-request message-authentication-code 1234 123456 [FW-pki-cmp-session-cmp] quit [FW] pki cmp initial-request session cmp [FW] Info: Initializing configuration. Info: Creatting initial request packet. Info: Connectting to CMPv2 server. Info: Sending initial request packet. Info: Waitting for initial response packet. Info: Creatting confirm packet. Info: Connectting to CMPv2 server. Info: Sending confirm packet. Info: Waitting for confirm packet from server. Info: CMPv2 operation finish.
The CA and local certificates are named cmp_ca1.cer and cmp_ir.cer and stored in the device storage.
[FW] pki import-certificate ca filename cmp_ca1.cer
The CA's Subject is /C=cn/ST=beijing/L=BB/O=BB/OU=BB/CN=BB
The CA's fingerprint is:
MD5 fingerprint:3AC7 54FD E272 09BE 9008 84EE D1FC 118E
SHA1 fingerprint:492A 8E0B BED2 BE10 C097 9039 99FE F7E1 9AA5 B658
Is the fingerprint correct?(Y/N):y
Info: Succeeded in importing file.
# Import the local certificate to memory.
[FW] pki import-certificate local filename cmp_ir.cer
Info: Succeeded in importing file.
# Configure the certificate that proves the device itself, which is the certificate to be updated, cmp_ir.cer.
[FW] pki cmp session cmp [FW-pki-cmp-session-cmp] cmp-request authentication-cert cmp_ir.cer
# Enable automatic certificate update.
[FW-pki-cmp-session-cmp] certificate auto-update enable
# Configure the device to update the certificate when 60% of the certificate validity period has elapsed.
[FW-pki-cmp-session-cmp] certificate update expire-time 60 [FW-pki-cmp-session-cmp] quit
FW configuration file
# sysname FW # pki entity user01 country CN state jiangsu organization huawei organization-unit info common-name hello fqdn user@test.abc.com ip-address 10.2.0.2 email user@user@test.abc.com # interface GigabitEthernet0/0/1 ip address 10.2.0.2 255.255.255.0 interface GigabitEthernet0/0/2 ip address 10.1.0.2 255.255.255.0 # pki cmp session cmp cmp-request ca-name "C=cn,ST=beijing,L=SD,O=BB,OU=BB,CN=BB" cmp-request authentication-cert cmp_ir.cer cmp-request entity user01 cmp-request server url http://10.3.0.1:8080 cmp-request rsa local-key-pair rsa_cmp regenerate cmp-request message-authentication-code 1234 %$%$DO<zV;5|h,-E`1#||f`(4~UJ%$%$ certificate auto-update enable certificate update expire-time 60 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/2 firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 # ip route-static 10.3.0.0 255.255.255.0 10.2.0.1 # return