Search code examples
ssloctopus-deploy

How to set the octopus deploy SSL binding through commandline/powershell


I'm trying to refresh the Octopus Deploy Web server SSL certificate automatically so that no manual interaction is needed for it to run (using Let's Encrypt as certificate provider).

The manager easily configures this after creating the certificate, but I'd like to use the script to also set the certificate. I know Octopus configures most, if not all, through a command line interface so was wondering if there is an undocumented way of doing this.


Solution

  • Something similar to:

    "netsh.exe" http delete sslcert ipport=0.0.0.0:443
    "netsh.exe" http add sslcert ipport=0.0.0.0:443 appid={E2096A4C-2391-4BE1-9F17-E353F930E7F1} certhash=02B86C370FCE251242DA461BCDBA2138BAFC6C1C certstorename=My
    "C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe" configure --webForceSSL "True"
    "C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe" configure --webListenPrefixes "https://localhost/"
    "C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe" service --stop --start
    

    The Octopus Server Manager interacts with the Octopus installation via the command-line. And before it does so, it offers the option to view the commands that are about to be executed.

    In this case, if you configure your HTTPS binding via the Octopus Manager:

    enter image description here

    Then before executing Click 'Show script':

    enter image description here

    You will see commands similar to those above. You should be able to parameterize these in your scripts.