Certify automatic ssl certificate and renewal

This section contains user-submitted tutorials.
Post Reply
alescan
Normal user
Normal user
Posts: 52
Joined: 2014-11-11 17:29
Location: Italy
Contact:

Certify automatic ssl certificate and renewal

Post by alescan » 2019-11-20 18:18

Hi everyone,
I recentrly discovered https://certifytheweb.com/ (The SSL Certificate Manager for Windows, powered by Let's Encrypt) and made a simple script to automatize the renewal process.
You only have to modify the crt and key path and set it in the post-request script page of the program.

Code: Select all

param($result)
$latest = $result.ManagedItem.CertificatePath
openssl pkcs12 -in $latest -out E:\path\to\private\key\public.key -nocerts -nodes -passin pass:
openssl pkcs12 -in $latest -out E:\path\to\public\crt\public.crt -nokeys -passin pass:
Restart-Service -Name hMailServer -Force
Hope can help some of you!

Bye!
HMS 5.6.7 B2425 on Win Server 2016 Standard with SQL Server 2019

bajlek
Normal user
Normal user
Posts: 47
Joined: 2017-05-02 20:54

Re: Certify automatic ssl certificate and renewal

Post by bajlek » 2019-12-31 00:49

I need to edit that to this:

Code: Select all

param($result)
$env:path = $env:path + ";C:\Program Files\OpenSSL-Win64\bin"
$latest = $result.ManagedItem.CertificatePath

openssl pkcs12 -in $latest -out 'C:\Program Files (x86)\hMailServer\ssl\cert\mykey.pem' -nocerts -nodes -passin pass:
openssl pkcs12 -in $latest -out 'C:\Program Files (x86)\hMailServer\ssl\cert\mycert.pem' -nokeys -nodes -chain -passin pass:

Restart-Service -Name hMailServer -Force
I also set PATH in user variables, but it wont even work for powershell so it need to be set up in script. ANd my path have spaces - careful with that.
Reference: https://stackoverflow.com/questions/455 ... ystem-path

Post Reply