Skip to content

Commit

Permalink
ab#57392
Browse files Browse the repository at this point in the history
  • Loading branch information
leefine02 authored and leefine02 committed May 13, 2024
1 parent dbcd5ef commit c5586ec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions CitrixAdcOrchestratorJobExtension/CitrixAdcStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,27 @@ private string GenerateKeyPairName(string alias)
return alias;
}

public void BindServices(string alias, string serviceNames, string serviceSniCerts)
{
string[] serviceNameList = serviceNames.Split(',');
string[] serviceSniCertList = serviceSniCerts.Split(',');

if (serviceNameList.Length != serviceSniCertList.Length)
throw new Exception("Number of Service Names must match number of SNI Services");

for (int i = 0; i < serviceNameList.Length; i++)
{
sslservice_sslcertkey_binding binding = new sslservice_sslcertkey_binding()
{
certkeyname = alias,
servicename = serviceNameList[i],
snicert = Convert.ToBoolean(serviceSniCertList[i])
};

sslservice_sslcertkey_binding.add(_nss, binding);
};
}

public void UpdateBindings(string keyPairName, string virtualServerName, string sniCert)
{
try
Expand Down
9 changes: 9 additions & 0 deletions CitrixAdcOrchestratorJobExtension/Management.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using System.IO;
using static Org.BouncyCastle.Math.EC.ECCurve;
using com.citrix.netscaler.nitro.resource.config.pq;
using com.citrix.netscaler.nitro.resource.config.ssl;
using com.citrix.netscaler.nitro.service;

namespace Keyfactor.Extensions.Orchestrator.CitricAdc
{
Expand Down Expand Up @@ -144,6 +146,8 @@ private JobResult ProcessJob(CitrixAdcStore store, ManagementJobConfiguration jo
_logger.LogDebug("Begin Add...");
var virtualServerName = (string)jobConfiguration.JobProperties["virtualServerName"];
var sniCert = (string)jobConfiguration.JobProperties["sniCert"];
var serviceName = (string)jobConfiguration.JobProperties["serviceName"];
var serviceSniCert = (string)jobConfiguration.JobProperties["serviceSniCert"];

dynamic properties = JsonConvert.DeserializeObject(jobConfiguration.CertificateStoreDetails.Properties.ToString());
var linkToIssuer = properties.linkToIssuer == null || string.IsNullOrEmpty(properties.linkToIssuer.Value) ? false : Convert.ToBoolean(properties.linkToIssuer.Value);
Expand All @@ -165,6 +169,11 @@ private JobResult ProcessJob(CitrixAdcStore store, ManagementJobConfiguration jo
PerformAdd(store, jobConfiguration.JobCertificate, keyPairName, virtualServerName,
jobConfiguration.Overwrite, sniCert, linkToIssuer);
_logger.LogDebug("End Add/Enrollment...");

if (!string.IsNullOrEmpty(serviceName))
{
store.BindServices(jobConfiguration.JobCertificate.Alias, serviceName, serviceSniCert);
}
}
else
{
Expand Down

0 comments on commit c5586ec

Please sign in to comment.