Skip to content

Commit 34598ef

Browse files
committed
1.0.3: Add SNI flag as configurable parameter
1 parent da3c29c commit 34598ef

File tree

6 files changed

+38
-68
lines changed

6 files changed

+38
-68
lines changed

IISWithBindings/Jobs/Management.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private AnyJobCompleteInfo PerformAddition(AnyJobConfigInfo config)
121121
Logger.Trace($"Begin Add for Cert Store {$@"\\{config.Store.ClientMachine}\{config.Store.StorePath}"}");
122122

123123
using (Runspace runspace = RunspaceFactory.CreateRunspace(connInfo))
124-
{
124+
{
125125
runspace.Open();
126126
PowerShellCertStore psCertStore = new PowerShellCertStore(config.Store.ClientMachine, config.Store.StorePath, runspace);
127127
using (PowerShell ps = PowerShell.Create())
@@ -162,10 +162,17 @@ function InstallPfxToMachineStore([byte[]]$bytes, [string]$password, [string]$st
162162
Get-WebBinding -Name ""{0}"" -IPAddress ""{1}"" -Port ""{2}"" -Protocol ""{3}"" |
163163
ForEach-Object {{ Remove-WebBinding -BindingInformation $_.bindingInformation }}
164164
165-
New-WebBinding -Name ""{0}"" -IPAddress ""{1}"" -HostHeader ""{4}"" -Port ""{2}"" -Protocol ""{3}""
165+
New-WebBinding -Name ""{0}"" -IPAddress ""{1}"" -HostHeader ""{4}"" -Port ""{2}"" -Protocol ""{3}"" -SslFlags ""{7}""
166166
Get-WebBinding -Name ""{0}"" -Port ""{2}"" -Protocol ""{3}"" |
167167
ForEach-Object {{ $_.AddSslCertificate(""{5}"", ""{6}"") }}
168-
}}", storePath.SiteName, storePath.IP, storePath.Port, storePath.Protocol, storePath.HostName, x509Cert.Thumbprint, config.Store.StorePath);
168+
}}", storePath.SiteName, //{0}
169+
storePath.IP, //{1}
170+
storePath.Port, //{2}
171+
storePath.Protocol, //{3}
172+
storePath.HostName, //{4}
173+
x509Cert.Thumbprint, //{5}
174+
config.Store.StorePath, //{6}
175+
(int)storePath.SniFlag); //{7}
169176

170177
ps.AddScript(funcScript);
171178
ps.Invoke();

IISWithBindings/PowerShellCertStore.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private void Initalize()
6262
{
6363
using (PowerShell ps = PowerShell.Create())
6464
{
65+
6566
ps.Runspace = Runspace;
6667
//todo: accept StoreType and Store Name enum for which to open
6768
string certStoreScript = $@"

IISWithBindings/StorePath.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ class StorePath
2323
[JsonProperty("protocol")]
2424
[DefaultValue("https")]
2525
public string Protocol { get; set; }
26-
2726
[JsonProperty("spnwithport")]
2827
[DefaultValue(false)]
2928
public bool SPNPortFlag { get; set; }
29+
[JsonProperty("sniflag")]
30+
[DefaultValue(SniFlag.None)]
31+
public SniFlag SniFlag { get; set; }
3032

3133
public StorePath()
3234
{
@@ -46,4 +48,12 @@ public string FormatForIIS()
4648
return $@"{IP}:{Port}:{HostName}";
4749
}
4850
}
51+
52+
enum SniFlag
53+
{
54+
None = 0,
55+
SNI = 1,
56+
NoneCentral = 2,
57+
SniCentral = 3
58+
}
4959
}

0 commit comments

Comments
 (0)