Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

62847 update sni flags #118

Merged
merged 30 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
042cb55
Updated Readme, changelog and modified Alias.
Sep 6, 2024
4f4ef75
Update generated README
Sep 6, 2024
da1550c
Added Unit Test project. Updated code for ssl flags and adding bindi…
Sep 10, 2024
1a5e9e5
Merge branch '62847-Update_SNI_Flags' of https://github.com/Keyfactor…
Sep 10, 2024
87a0928
Updated error messages.
Sep 11, 2024
a3c06be
Fixed SNI Flag value from Int to string
Sep 11, 2024
c8035c3
updated test case
Sep 11, 2024
118c583
Updated some error messages and added new unit tests.
Sep 12, 2024
cdf0815
Cleaned up some code and added unit test.
Sep 16, 2024
2767e44
Updated code to reflect issues while testing.
Sep 21, 2024
b236b0b
Removed renewal logic based upon thumbprint and is now being updated …
Sep 21, 2024
60b921f
Added Extension Names to all implementations.
Sep 23, 2024
f1438bd
Updated ReadMe document describing SNI Support changes.
Oct 1, 2024
aa0b9b7
chore(doctool): Boilerplate documentation and integration-manifest.js…
m8rmclaren Oct 17, 2024
92fc5e3
chore(ci): Add scan token
m8rmclaren Oct 17, 2024
b767cfc
Update generated docs
Oct 17, 2024
38881c6
Merge branch '62847-Update_SNI_Flags' of github.com:Keyfactor/iis-orc…
m8rmclaren Oct 17, 2024
0931a80
chore(doctool): Generate screenshots
m8rmclaren Oct 17, 2024
8b7474d
update migration script and add new script for changing SniFlag to SS…
doebrowsk Nov 15, 2024
68865eb
Update generated docs
Nov 15, 2024
124142b
Merge pull request #121 from Keyfactor/ab#63169-migrate-new-parameters
rcpokorny Nov 25, 2024
5837a34
update SSL Flags name in integration manifest
doebrowsk Nov 25, 2024
2ba6840
Update generated docs
Nov 25, 2024
12f1910
Update keyfactor-starter-workflow.yml
fiddlermikey Nov 27, 2024
c9d3cb5
Update generated docs
Nov 27, 2024
fb27d4a
Update integration-manifest.json
fiddlermikey Nov 27, 2024
17d55f6
Update generated docs
Nov 27, 2024
3c3ef83
fix release_project property
fiddlermikey Nov 27, 2024
0bb56dc
Update generated docs
Nov 27, 2024
d340184
fix release_dir property
Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/keyfactor-starter-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ on:

jobs:
call-starter-workflow:
uses: keyfactor/actions/.github/workflows/starter.yml@v2
uses: keyfactor/actions/.github/workflows/starter.yml@3.1.2
secrets:
token: ${{ secrets.V2BUILDTOKEN}}
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}
scan_token: ${{ secrets.SAST_TOKEN }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2.5.0
* Added the Bindings to the end of the thumbprint to make the alias unique.
* Using new IISWebBindings commandlet to use additional SSL flags when binding certificate to website.
* Added multi-platform support for .Net6 and .Net8.
* Updated various PowerShell scripts to handle both .Net6 and .Net8 differences (specifically the absense of the WebAdministration module in PS SDK 7.4.x+)
* Fixed issue to update multiple websites when using the same cert.
* Removed renewal thumbprint logic to update multiple website; each job now updates its own specific certificate.

2.4.4
* Fix an issue with WinRM parameters when migrating Legacy IIS Stores to the WinCert type
* Fix an issue with "Delete" script in the Legacy IIS Migration that did not remove some records from dependent tables
Expand Down
21 changes: 2 additions & 19 deletions IISU/CertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,38 +181,21 @@ public static List<CurrentInventoryItem> GetIISBoundCertificates(Runspace runSpa

if (foundCert == null) continue;

var sniValue = "";
switch (Convert.ToInt16(binding.Properties["sniFlg"]?.Value))
{
case 0:
sniValue = "0 - No SNI";
break;
case 1:
sniValue = "1 - SNI Enabled";
break;
case 2:
sniValue = "2 - Non SNI Binding";
break;
case 3:
sniValue = "3 - SNI Binding";
break;
}

var siteSettingsDict = new Dictionary<string, object>
{
{ "SiteName", binding.Properties["Name"]?.Value },
{ "Port", binding.Properties["Bindings"]?.Value.ToString()?.Split(':')[1] },
{ "IPAddress", binding.Properties["Bindings"]?.Value.ToString()?.Split(':')[0] },
{ "HostName", binding.Properties["Bindings"]?.Value.ToString()?.Split(':')[2] },
{ "SniFlag", sniValue },
{ "SniFlag", binding.Properties["sniFlg"]?.Value },
{ "Protocol", binding.Properties["Protocol"]?.Value }
};

myBoundCerts.Add(
new CurrentInventoryItem
{
Certificates = new[] { foundCert.CertificateData },
Alias = thumbPrint,
Alias = thumbPrint + ":" + binding.Properties["Bindings"]?.Value.ToString(),
PrivateKeyEntry = foundCert.HasPrivateKey,
UseChainLevel = false,
ItemStatus = OrchestratorInventoryItemStatus.Unknown,
Expand Down
2 changes: 1 addition & 1 deletion IISU/CertificateStoreException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
[Serializable]
internal class CertificateStoreException : Exception
public class CertificateStoreException : Exception
{
public CertificateStoreException()
{
Expand All @@ -32,7 +32,7 @@
{
}

protected CertificateStoreException(SerializationInfo info, StreamingContext context) : base(info, context)

Check warning on line 35 in IISU/CertificateStoreException.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 35 in IISU/CertificateStoreException.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 35 in IISU/CertificateStoreException.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 35 in IISU/CertificateStoreException.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 35 in IISU/CertificateStoreException.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
{
}
}
Expand Down
9 changes: 8 additions & 1 deletion IISU/ClientPSCertStoreInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU;
using Keyfactor.Logging;
using Microsoft.Extensions.Logging;
using System;
Expand All @@ -21,9 +22,15 @@

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
abstract class ClientPSCertStoreInventory
public abstract class ClientPSCertStoreInventory
{
private ILogger _logger;

protected ClientPSCertStoreInventory()
{
_logger = LogHandler.GetClassLogger<ClientPSCertStoreInventory>();
}

public ClientPSCertStoreInventory(ILogger logger)
{
_logger = logger;
Expand Down
13 changes: 9 additions & 4 deletions IISU/ClientPSCertStoreManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal class ClientPSCertStoreManager
public class ClientPSCertStoreManager
{
private ILogger _logger;
private Runspace _runspace;
Expand All @@ -40,6 +40,11 @@ public X509Certificate2 X509Cert
get { return x509Cert; }
}

public ClientPSCertStoreManager(Runspace runSpace)
{
_logger = LogHandler.GetClassLogger<ClientPSCertStoreManager>();
_runspace = runSpace;
}

public ClientPSCertStoreManager(ILogger logger, Runspace runSpace, long jobNumber)
{
Expand Down Expand Up @@ -126,9 +131,9 @@ public JobResult ImportPFXFile(string filePath, string privateKeyPassword, strin
{
ps.Runspace = _runspace;

if (cryptoProviderName == null)
if (string.IsNullOrEmpty(cryptoProviderName))
{
if (privateKeyPassword == null)
if (string.IsNullOrEmpty(privateKeyPassword))
{
// If no private key password is provided, import the pfx file directory to the store using addstore argument
string script = @"
Expand Down Expand Up @@ -179,7 +184,7 @@ public JobResult ImportPFXFile(string filePath, string privateKeyPassword, strin
}
else
{
if (privateKeyPassword == null)
if (string.IsNullOrEmpty(privateKeyPassword))
{
string script = @"
param($pfxFilePath, $cspName, $storePath)
Expand Down
Loading
Loading