INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Command line to [re]load SSL certificates  (Read 964 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Command line to [re]load SSL certificates
« on: February 12, 2021, 06:07:31 am »

Hi,
Following up on the new Share feature, it would be useful to have a command-line option to load and activate SSL certificates on MC.
This would allow automating the 3-month renewal cycle of LetsEncrypt certificates. Something like this:
MC27 /SSL [path]PublicCert.pem [path]PrivateCert.pem

Thanks!
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Command line to [re]load SSL certificates
« Reply #1 on: February 13, 2021, 02:13:47 pm »

Alternatively, MC could store the Certificate filepath instead of importing the files (or copy the certificates to %appdata%).
Just updating the files and restarting MC would then work for renewal.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Command line to [re]load SSL certificates
« Reply #2 on: February 13, 2021, 02:24:50 pm »

+1

Yes please. This is effectively blocking me from using TLS on my MC server.

I should note: It might also make sense to build the certbot functionality into MC entirely. They could do all that for you and give you just a checkbox and fields to configure MC to automatically work with Let's Encrypt. That would make it more approachable for regular folk, which is (after all) the goal of Let's Encrypt.

But Let's Encrypt and certbot are all open-sourcey and whatnot. JRiver could just hide all that complexity (like they hide the complexity of using LAME). Then MC could serve the port-80/443 domain validation file (just long enough to complete the renew when it needs to do it), and all that and make it easy for everyone.

In any case, I'll set it up with certbot, but not till I have a way to automate MC's ingestion of the renewed Certs. Because doing that manually every 3 months is the stupid.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Command line to [re]load SSL certificates
« Reply #3 on: February 13, 2021, 02:36:43 pm »

I should note: It might also make sense to build the certbot functionality into MC entirely.

That would be even better. They support the ACME API which is now widely used, and there are C++ libs out there:
https://letsencrypt.org/docs/client-options/
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5233
  • "Linux Merit Badge" Recipient
Re: Command line to [re]load SSL certificates
« Reply #4 on: February 13, 2021, 03:41:17 pm »

Alternatively, MC could store the Certificate filepath instead of importing the files (or copy the certificates to %appdata%).
Just updating the files and restarting MC would then work for renewal.

This would be my preferred solution.  Just storing the path would be by far the easiest thing for users to automate around (unless they go whole hog and build in letsencrypt requests or something, but that seems like a lot of work).  Just reading the file from a set path on disk is what most of the other software I use that relies on certs does.  When I update my certs everything else in my stack just notices there's a new cert file at the file path and uses it, but getting JRiver to update requires manual intervention every time, so I've given up for now and just put JRiver behind a reverse proxy instead which has some limitations in my setup so I'd be glad of a more seamless native ssl experience.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Command line to [re]load SSL certificates
« Reply #5 on: February 13, 2021, 03:50:43 pm »

Just reading the file from a set path on disk is what most of the other software I use that relies on certs does.

I agree. This would be my preferred solution as well. If they need to cache/store it somewhere internally for performance (or whatever) reasons, then whatever files you have it set to in the UI should just be re-read on startup each time and updated.

I already script MC to restart itself once per day, and so long as I time my LetsEncrypt automation for around the same middle-of-the-night time, it would "just work".

PS. If you are looking for a way to do the rest of this automatically, and you don't have a good firewall setup, the LetsEncrypt support in Sophos UTM is fantastic, it turns out. I set mine up in about 2 minutes, and it works perfectly. And, I've looked, and it seems to be relatively straightforward to script it to automatically download the Certs.

Sophos UTM is awesome, and free for home use: https://secure2.sophos.com/en-us/products/free-tools/sophos-utm-home-edition/download.aspx
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14401
  • I won! I won!
Re: Command line to [re]load SSL certificates
« Reply #6 on: April 29, 2021, 01:29:32 am »

My 90-Days was up so I had to renew my SSL Certificate.  I used "Certify the Web" (had to port forward 80 to my PC & turn off windows firewall for the process... which makes me nervous).... but it seems I did not have to load the certs into MC again.  , eg, this link works for me:

https://mymc.dyndns.info:52200/MCWS/v1/Share/Get?File=csK49RCqIPDwjpv9yjqnbBRMJ%2BpTKSA604sIhcEcq9peENnDtTBX2wPDn3SDEMaVpwvrymOQ52dznKJZz4zE%2FTG3k%2Fl1%2Ft8nAXhLdg%3D%3D

I presumed I would have "new" certs but it all seems to work?
Logged
JRiver CEO Elect

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Command line to [re]load SSL certificates
« Reply #7 on: April 29, 2021, 01:36:59 am »

Your current certificate was not changed, it says it was issued on Feb 11 and is valid until May 13. You still need to load the new one into MC.

You can see this by clicking the lock icon to the left of the URL on the browser.
Logged

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14401
  • I won! I won!
Re: Command line to [re]load SSL certificates
« Reply #8 on: April 29, 2021, 02:31:03 am »

Thanks - Updated to the new CRT and KEY in MC and the details are now correct.
Logged
JRiver CEO Elect
Pages: [1]   Go Up