Octopus.Script exported 2020-08-13 by bobjwalker belongs to ‘SSL’ category.
Export the PEM and Key from an SSL certificate to the File System. This is useful in Linux for securing websites or Docker containers
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
Root SSL Export Path
sslExportPath =
The base directory the key and pem file will be saved to
PEM File Name
sslPemFile =
The filename to write the PEM to
Key File Name
sslKeyFile =
The filename to write the Key to
SSL Certificate Variable
sslCertificate =
The name of the SSL certificate Variable
Script body
Steps based on this template will execute the following PowerShell script.
$CertName = $OctopusParameters["sslCertificate.Name"]
Write-Host "Writing PEM and Key files for $Certname"
New-Item -ItemType directory $sslExportPath -Force -Verbose
"Certificate Pem:"
$pemPath = join-path $sslExportPath $sslPemFile
$OctopusParameters["sslCertificate.CertificatePem"] | out-file $pemPath -Force -Verbose
"-" * 30
"Certificate Key: "
$keypath = join-path $sslExportPath $sslKeyFile
$OctopusParameters["sslCertificate.PrivateKeyPem"] | out-file $keyPath -Force -Verbose
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "9e7f1836-c7c5-4d52-bd9e-0948114b2a0e",
"Name": "SSL - Write Certificate Pem and Key to the Filesystem",
"Description": "Export the PEM and Key from an SSL certificate to the File System. This is useful in Linux for securing websites or Docker containers",
"Version": 7,
"ExportedAt": "2020-08-13T07:41:35.949Z",
"ActionType": "Octopus.Script",
"Author": "bobjwalker",
"Packages": [],
"Parameters": [
{
"Id": "c9cdd622-1a9a-4e5e-9eaa-ad738b76b356",
"Name": "sslExportPath",
"Label": "Root SSL Export Path",
"HelpText": "The base directory the key and pem file will be saved to",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "9211d56c-068e-47c5-9613-0f77eda72dca",
"Name": "sslPemFile",
"Label": "PEM File Name",
"HelpText": "The filename to write the PEM to",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "39dbe4a6-60c5-4bd2-8ad9-03a28f7148f0",
"Name": "sslKeyFile",
"Label": "Key File Name",
"HelpText": "The filename to write the Key to",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "65d6687e-badf-4772-ac14-70bd2790cd4d",
"Name": "sslCertificate",
"Label": "SSL Certificate Variable",
"HelpText": "The name of the SSL certificate Variable",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "Certificate"
}
}
],
"Properties": {
"Octopus.Action.RunOnServer": "false",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptBody": "\n$CertName = $OctopusParameters[\"sslCertificate.Name\"] \nWrite-Host \"Writing PEM and Key files for $Certname\"\n\nNew-Item -ItemType directory $sslExportPath -Force -Verbose\n\n\"Certificate Pem:\"\n$pemPath = join-path $sslExportPath $sslPemFile\n$OctopusParameters[\"sslCertificate.CertificatePem\"] | out-file $pemPath -Force -Verbose\n\n\"-\" * 30\n\n\"Certificate Key: \"\n$keypath = join-path $sslExportPath $sslKeyFile\n$OctopusParameters[\"sslCertificate.PrivateKeyPem\"] | out-file $keyPath -Force -Verbose\n"
},
"Category": "SSL",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/ssl-write-certificate-pem-and-key.json",
"Website": "/step-templates/9e7f1836-c7c5-4d52-bd9e-0948114b2a0e",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAF3BJREFUeNrsXU9MG1maNxhsTChwG8YEHBRMevinCXSzSkaCtEYifYnSUkeTaEfayVxm0pfV7N7mtOpTa09zm17tJZnT9BxmlfSkpY5yCaxWHTKaoGU6ySj8UYKJEuPEA8Sh3BgbDPtzvUmtMdS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