KB help in configuring REST-API with HTTPS and verification for remote network device management.
Customer might observe challenges while configuring REST-API with HTTPS and performing verification.
Below steps can be performed to configure REST-API with HTTPS for remote network device management
Step 1:- Generate private key for certificate
request security pki generate-key-pair size 2048 certificate-id testname1
username@router>> request security pki generate-key-pair size 2048 certificate-id testname1
Generated key pair testname1, key size 2048 bits
Step 2 Generate the certification and verify the certification
request security pki local-certificate generate-self-signed certificate-id testname1 subject CN=XXXXXXXXX domain-name company-name.com ip-address X.X.X.X
username@router> ...te-id testname1 subject CN=XXXXXXXXX domain-name COMPANY-DOMAIN.com ip-address X.X.X.X
Self-signed certificate generated and loaded successfully
username@router> show security pki local-certificate certificate-id testname1
LSYS: root-logical-system
Certificate identifier: testname1
Issued to: XXXXXXXXX, Issued by: CN =XXXXXXXXX
Validity:
Not before: 02- 8-2025 12:46 UTC
Not after: 02- 7-2030 12:46 UTC
Public key algorithm: rsaEncryption(2048 bits)
Keypair Location: Keypair generated locally
username@router>
Step 3. Add below configuration on device and commit the new configuration
set system services rest https port 3443
set system services rest https server-certificate testname1
set system services rest control allowed-sources 10.1.1.1
set system services rest control connection-limit 100
set system services rest enable-explorer
Step 4 Generate PEM file type from locally generated Cert
request security pki local-certificate export certificate-id testname1 type pem filename /var/tmp/testname1.pem
username@router>> ...est security pki local-certificate export certificate-id testname1 type pem filename /var/tmp/testname1.pem
certificate exported successfully
Copy to testname1.pem to REST API CLIENT with scp
TO VALIDATE TO GET SOFTWARE INFORMATION from remote linux server.
username@virtual-machine:~$ curl --cacert testname1.pem https://X.X.X.X:3443/rpc/get-software-information -u "username:password" -H "Content-Type:application/xml" -H "Accept: application/xml"
<software-information>
<host-name>router</host-name>
<product-model>ACX7024</product-model>
<product-name>acx7024</product-name>
<junos-version>24.2R1.18-EVO</junos-version>
<yocto-version>4.0.14</yocto-version>
<kernel-version>5.15.76-yocto-standard-juniper-02085-gce2d521ddcf4</kernel-version>
<package-information>
<name>junos-evo-install-acx-f-x86-64-24.2R1.18-EVO</name>
<comment>JUNOS-EVO OS 64-bit [junos-evo-install-acx-f-x86-64-24.2R1.18-EVO]</comment>
</package-information>
</software-information>
username@labroot-virtual-machine:~$