Description

This article describes the steps to import self-signed certificate created on SRX in Firefox web-browser on Ubuntu OS. 
Refer creation of self-signed-certificate  on SRX.

Solution

For importing this certificate in Firefox web-browser on Ubuntu OS, follow the steps below: 

Step1: Export the certificate from the SRX device in .pem format and the key-pair 
root@SRX# run request security pki local-certificate export certificate-id SRXasCA filename /var/tmp/SRXasCA.pem
certificate exported successfully

root@SRX# run request security pki key-pair export certificate-id SRXasCA filename /var/tmp/SRXasCA.key type pem passphrase Juniper@12345
key-pair exported successfully

root@SRX# run file list /var/tmp/ | match SRX
SRXasCA.key
SRXasCA.pem


Step2: Move these files to the Ubuntu machine (you can use SCP or other similar methods)
labroot@Ubuntu20:~$ ls | grep SRX
SRXasCA.key
SRXasCA.pem

Firefox browser on the Ubuntu OS needs a .crt file, therefore make a copy of the certificate in .crt format
labroot@Ubuntu20:~$sudo cp SRXasCA.pem SRXasCA.crt

Now, you should see the below files: 
labroot@Ubuntu20:~$ ls | grep SRX
SRXasCA.crt
SRXasCA.key
SRXasCA.pem

Step3: Move the key-pair to the /etc/ssl/private/ directory on the Ubuntu machine.
labroot@Ubuntu20:~$ sudo cp SRXasCA.key /etc/ssl/private/

Step4: Create a new directory under /usr/share/ca-certificate directory. 
This directory can be named as anything of your choice, however we have created a directory named “extra”.
labroot@Ubuntu20:~$ sudo mkdir /usr/share/ca-certificate/extra

Step5: Copy the ".CRT" certificate file from Step 2 to /usr/share/ca-certificate/extra and /usr/share/ca-certificate/Mozilla directory.
labroot@Ubuntu20:~$ sudo cp SRXasCA.crt /usr/share/ca-certificates/extra/
labroot@Ubuntu20:~$ sudo cp SRXasCA.crt /usr/share/ca-certificates/mozilla/

Step6: Reconfigure CA certificate
labroot@Ubuntu20:~$ sudo dpkg-reconfigure ca-certificates
Select the newly added cert and follow the instruction on the wizard
Pasted Graphic.png

Ensure that the requires certificates are selected (have an asterisk), you can do this by pressing ‘spacebar’
Pasted Graphic 1.png

Make sure that both the SRXasCA.crt files are selected (under directories extra/ and mozilla/)
Pasted Graphic 2.png
Then press ’Tab’ to select ‘OK’ and press ‘Enter’

Step7: Next update the CA certificate by running following command:
labroot@Ubuntu20:~$ sudo update-ca-certificates 
Updating certificates in /etc/ssl/certs...
2 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

Step8: Now open the Firefox web-browser and go to Certificate Manager > Authorities > Import 
Select the “.crt” file and then select “Trust this CA to identify websites” and Click “OK”
Pasted Graphic 3.png

Now, the certificate is successfully imported. 

Modification History

2023-11-18 : Article Created