|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Linq; |
4 | | -using System.Runtime.InteropServices; |
5 | 4 | using System.Security.Cryptography.X509Certificates; |
6 | 5 | using System.Threading.Tasks; |
7 | 6 | using Certify.Management; |
@@ -55,12 +54,6 @@ public async Task<List<ActionStep>> StoreAndDeploy(IBindingDeploymentTarget depl |
55 | 54 | { |
56 | 55 | var actions = new List<ActionStep>(); |
57 | 56 |
|
58 | | - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
59 | | - { |
60 | | - actions.Add(new ActionStep { Title = "Certificate Store and Deploy Skipped", Category = "CertificateStorage", Description = "Platform not supported for certificate store, skipping" }); |
61 | | - return actions; |
62 | | - } |
63 | | - |
64 | 57 | var requestConfig = managedCertificate.RequestConfig; |
65 | 58 |
|
66 | 59 | if (!isPreviewOnly) |
@@ -116,28 +109,32 @@ public async Task<List<ActionStep>> StoreAndDeploy(IBindingDeploymentTarget depl |
116 | 109 |
|
117 | 110 | if (storedCert != null) |
118 | 111 | { |
119 | | - //get list of domains we need to create/update https bindings for |
120 | | - var dnsHosts = new List<string> { |
121 | | - requestConfig.PrimaryDomain |
122 | | - }; |
123 | | - |
124 | | - if (requestConfig.SubjectAlternativeNames != null) |
| 112 | + // if a deployment target is available (IIS, nginx etc) we will attempt to deploy the cert to the target |
| 113 | + if (deploymentTarget != null) |
125 | 114 | { |
126 | | - foreach (var san in requestConfig.SubjectAlternativeNames) |
| 115 | + //get list of domains we need to create/update https bindings for |
| 116 | + var dnsHosts = new List<string> { |
| 117 | + requestConfig.PrimaryDomain |
| 118 | + }; |
| 119 | + |
| 120 | + if (requestConfig.SubjectAlternativeNames != null) |
127 | 121 | { |
128 | | - dnsHosts.Add(san); |
| 122 | + foreach (var san in requestConfig.SubjectAlternativeNames) |
| 123 | + { |
| 124 | + dnsHosts.Add(san); |
| 125 | + } |
129 | 126 | } |
130 | | - } |
131 | 127 |
|
132 | | - dnsHosts = dnsHosts |
133 | | - .Distinct() |
134 | | - .Where(d => !string.IsNullOrEmpty(d)) |
135 | | - .ToList(); |
| 128 | + dnsHosts = dnsHosts |
| 129 | + .Distinct() |
| 130 | + .Where(d => !string.IsNullOrEmpty(d)) |
| 131 | + .ToList(); |
136 | 132 |
|
137 | | - // depending on our deployment mode we decide which sites/bindings to update: |
138 | | - var deployments = await DeployToAllTargetBindings(deploymentTarget, managedCertificate, requestConfig, certStoreName, certHash, dnsHosts, isPreviewOnly); |
| 133 | + // depending on our deployment mode we decide which sites/bindings to update: |
| 134 | + var deployments = await DeployToAllTargetBindings(deploymentTarget, managedCertificate, requestConfig, certStoreName, certHash, dnsHosts, isPreviewOnly); |
139 | 135 |
|
140 | | - actions.AddRange(deployments); |
| 136 | + actions.AddRange(deployments); |
| 137 | + } |
141 | 138 | } |
142 | 139 | else |
143 | 140 | { |
|
0 commit comments