Certificate replace - upload field does nothing

cloud
reliability
known
(Pm Swetz) #1

On the Library->Certificates page when opening an existing cert and choosing the replace option the replace certificate dialog opens but there is no way to actually add the cert. Clicking in the certificate file input does nothing, the upload button does nothing. There is no way to actually add the new certificate that works. This is a production critical bug as our certs expire in a few days and out clients will lose the ability to log into our applications if that happens. There are no errors in the js console. I tried to html hack the page but could only get a non-working file input to show up under the certificate input field, it does not do anything however.

(Paul Calvert) #3

Hi @PMSwetz,

Thanks for getting in touch.

Coincidentally, another user has just raised this with us too. I have created an issue for our engineers to investigate further.

The workaround, for now, would be to use the API to perform the upload and replace for you, a script such as the one here would do the job.

# You can this dll from your Octopus Server/Tentacle installation directory or from
# https://www.nuget.org/packages/Octopus.Client/

Add-Type -Path 'Octopus.Client.dll' 

$apikey = 'API-MYAPIKEY' # Get this from your profile
$octopusURI = 'http://MY-OCTOPUS' # Your server address

$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey 
$repository = New-Object Octopus.Client.OctopusRepository $endpoint

$certificateName = "Acme HTTPS"

$currentCertificate = $repository.Certificates.FindByName($certificateName);

$replacementPfxPath = "D:\somewhere\replacement.pfx"
$pfxBase64 = [Convert]::ToBase64String((Get-Content -Path $replacementPfxPath -Encoding Byte)) 
$pfxPassword = "Password!"

$replacementCertificate = $repository.Certificates.Replace($currentCertificate, $pfxBase64, $pfxPassword);

I hope this helps.

Best regards,
Paul