Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.17k stars 559 forks source link

Allow setting web certificates location in the config file #1191

Open damascene opened 4 years ago

damascene commented 4 years ago

Some of us may want to use specific certificate for the web server for various reasons . one example is using the certificates generated by certbot instead of using the built in method: Those certficates are located at this location. /etc/letsencrypt/live/$domainname/

I think it would be useful to have a config option in MeshCentral settings file that specify location of the web certificates similar to the ones in Apache and Nginx

Files provided by certbot includes:

For more information: https://certbot.eff.org/docs/using.html#where-are-my-certificates

Ylianst commented 4 years ago

Good request. For each of the 3 files above, could you view them with a text editor and provide the exact content of the file without the private Base64 data. For example, file privkey.pem contains

---this header---
(my cert data in base64)
---this footer---

Make sure the header and footers are exact and remove (put XXX) for any private data. I would like to create the same 3 files with my own certificate data, but exactly the same format as your files. That way, I can test that everything works.

uldiseihenbergs commented 4 years ago

On my system: privkey.pem -----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----

fullchain.pem: -----BEGIN CERTIFICATE----- -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- -----END CERTIFICATE-----

cert.pem: -----BEGIN CERTIFICATE----- -----END CERTIFICATE-----

chain.pem: -----BEGIN CERTIFICATE----- -----END CERTIFICATE-----

Ylianst commented 4 years ago

Perfect! Thanks!

OutbackMatt commented 4 years ago

I've gotten around this issue by using a symlinks from my lets encrypt live folders to the Meshcentral data folder

live folder is just symlinks anyway from the current certificate

uldiseihenbergs commented 4 years ago

@OutbackMatt to which files are you creating these symlinks? if i just copy all 4 files mentioned above to MC data folder, MC starts using them?

OutbackMatt commented 4 years ago

You only need the top two, privkey.pem and fullchain.pem I rename them to webserver-cert-private.key and webserver-cert-public.crt

I leave them in their default location, and use symlinks so that I don't need to copy the certificates every time they are replaced - it is all automatic