ASUS Router – Adding a valid cert

When using the HTTPS login of the router, it would utilise a self-signed cert. To have a valid cert from sites like Let’s Encrypt, you can install it using the following command from the following link:
https://berwari.net/blog/2018/01/02/installing-ssl-certificate-on-your-asus-router/
Updated using this link https://www.snbforums.com/threads/create-and-install-a-root-ca-and-self-signed-ssl-certificate.39424/

The key parts of the commands:
1. Cleanup of existing pem files
cd /etc
rm *.pem
2. cleanup of existing certificate (twice)
nvram set https_crt_save=0
nvram unset https_crt_file
service restart_httpd
nvram unset https_crt_file
service restart_httpd
nvram get https_crt_file
(this should show nothing)
rm *.pem
3. Install new certificate
nvram set https_crt_save=1
4. Copy certificate.crt and private.key content into pem files
press CTRL + D twice to end editing
service stop_httpd
(creating the files with httpd active was creating problems and they were being overwritten by httpd. Turn it off.)
cat > cert.pem
cat > key.pem
cat *.pem
(displays the two files – needed for comparison and makes sure that the files saved as expected)
4. Restart and generate cert file
service start_httpd
nvram get https_crt_file
(this should show your cert file)
5. Now reboot the router by typing reboot into SSH