-1

I have an Ubuntu 20.04 server and I installed Monit.

I want to secure the web interface. I followed the following instructions :

https://doc.ubuntu-fr.org/monit

$ cd /var/certs
$ sudo openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
$ sudo openssl gendh 512 >> /var/certs/monit.pem
$ sudo openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
$ sudo chmod 700 /var/certs/monit.pem

1) When I run the following command I got an error. Yet I do it with "sudo". Why is it not working ?

ubuntu@myserver /var/certs $ sudo openssl gendh 512 >> /var/certs/monit.pem
-bash: /var/certs/monit.pem: Permission denied

2) It says in the address bar "not secure", yet I am using HTTPS. Is this normal ?

enter image description here

I would also like to know what these 2 command lines are for :

$ sudo openssl gendh 512 >> /var/certs/monit.pem
$ sudo openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
mathieu
  • 1
  • 2
  • 1
    `It says in the address bar "not secure", yet I am using HTTPS. Is this normal ?` Yes it is normal. What is not normal is using an IP address for an HTTPS connection. – Greg Askew Aug 18 '20 at 12:26
  • @GregAskew It's not my site, it's Monit a monitoring service. I followed the documentation and the service at its own port – mathieu Aug 18 '20 at 12:37

1 Answers1

0

Using redirection when running a sudo command doesn't do what you expect, you have to change it to something like:

sudo bash -c "openssl gendh 512 >> /var/certs/monit.pem"

See this answer for more information.

Bert
  • 2,863
  • 12
  • 13