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

migrating SNI changes to SSH Project #119

Merged
merged 59 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
748bd87
Create legacy IIS to IISU/WinCert upgrade scripts and documentation
keyfactor-ddunn Aug 10, 2023
4d8e575
Initial changes for creating and importing pfx files to accept specif…
Feb 29, 2024
9be2ad6
Added ReEnrollment jobs to WinSQL
Mar 14, 2024
fc7d525
Update generated README
Mar 18, 2024
5e8ec1a
Updated some documentation.
Mar 26, 2024
56396f1
Added additional exception handleing for SQL Management jobs. Update…
Mar 26, 2024
316e4ec
Changed 'MaxAllowed' back to '5' and documented what that value repre…
Mar 27, 2024
5384f6d
Updated the readme-source documentation
Mar 27, 2024
8fbc6c7
Update generated README
Mar 27, 2024
d9d4417
Modified how runspaces are created for local machines access . Added…
Apr 16, 2024
4b7b26e
Improved some trace log information.
Apr 17, 2024
3eb72af
Added error trapping when attepting to get the last exit code from a …
Apr 17, 2024
e6f2f1f
Corrected some misspelled words in the ReadMe.
Apr 22, 2024
67aff5a
Update generated README
Apr 22, 2024
268c18b
Update generated README
Apr 25, 2024
bfc9fdc
Merge pull request #102 from Keyfactor/TestingBranch
fiddlermikey Apr 30, 2024
13e8533
POC for Macys - do not use for production.
May 29, 2024
3ce27b4
Minor changes
May 29, 2024
1a5353d
Added store path and addstore for certs with no private keys
May 29, 2024
c50a384
Merge branch '58570-Add_Cert_With_No_PW' into MacysPOC
rcpokorny May 29, 2024
6e74572
Merge pull request #104 from Keyfactor/MacysPOC
rcpokorny May 29, 2024
5be3649
#ab58570 Added additional error trapping and logging. Also modified …
May 31, 2024
278fa47
AB#58570 Added additional error trapping and logging. Also modified …
May 31, 2024
ce61ae2
Merge branch '58570-Add_Cert_With_No_PW' of https://github.com/Keyfac…
May 31, 2024
7c35815
Merge pull request #105 from Keyfactor/58570-Add_Cert_With_No_PW
fiddlermikey Jun 3, 2024
955b3ab
Merge remote-tracking branch 'dev4/ddunn-iis-upgrade-scripts' into 55…
doebrowsk Jun 28, 2024
85b63a6
move migration files together
doebrowsk Jun 28, 2024
6753d85
59831 error getting iisu bound certs (#106)
rcpokorny Jul 3, 2024
488f88a
Resolved merge conflicts
Jul 3, 2024
77ea006
additional legacy migration notes
doebrowsk Jul 11, 2024
1e66b7d
add migration readme and readme-pre to link to migration
doebrowsk Jul 11, 2024
21053b5
Update generated README
Jul 11, 2024
a0683be
Merge branch 'release-2.4' into 55511-migrate-legacy-IIS
doebrowsk Jul 11, 2024
2e3cfe7
update 2.4.3 changelog
doebrowsk Jul 11, 2024
a2a6056
Merge branch '55511-migrate-legacy-IIS' of https://github.com/keyfact…
doebrowsk Jul 11, 2024
59b6db0
Merge pull request #108 from Keyfactor/55511-migrate-legacy-IIS
fiddlermikey Jul 25, 2024
c1c09f3
Merge branch 'main' into release-2.4
fiddlermikey Jul 25, 2024
f0a2bc8
Merge pull request #111 from Keyfactor/release-2.4
fiddlermikey Aug 6, 2024
5adb87b
fix WinRM paramater spelling for WinCert store type migration script
doebrowsk Aug 21, 2024
0d8d033
delete records from additional dependent tables
doebrowsk Aug 26, 2024
26303fb
Merge pull request #114 from Keyfactor/62371-delete-dependent-records
doebrowsk Aug 26, 2024
b464a7a
update changelog for 2.4.4
doebrowsk Aug 26, 2024
942b0f6
fix WinRM capitalization in migration script for creating WinCert type
doebrowsk Sep 3, 2024
cb7d3c7
Merge pull request #115 from Keyfactor/61960-fix-migration-parameter
fiddlermikey Sep 4, 2024
084bb01
Merge pull request #116 from Keyfactor/release-2.4
fiddlermikey Sep 4, 2024
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
c3912ab
Merge branch '48867-Add_SSH' into 62847-Update_SNI_Flags
rcpokorny Oct 8, 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
2 changes: 1 addition & 1 deletion .github/workflows/keyfactor-starter-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
call-starter-workflow:
uses: keyfactor/actions/.github/workflows/starter.yml@v2
uses: keyfactor/actions/.github/workflows/starter.yml@dual-platform-without-doctool
secrets:
token: ${{ secrets.V2BUILDTOKEN}}
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
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

2.4.3
* Adding Legacy IIS Migration scripting and Readme guide

2.4.2
* Correct false positive error when completing an IIS inventory job.
* Revert to specifying the version of PowerShell to use when establishing a local PowerShell Runspace.
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 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 @@ -23,15 +24,21 @@

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;
}

public List<Certificate> GetCertificatesFromStore(RemoteSettings settings, string storePath)

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'

Check failure on line 41 in IISU/ClientPSCertStoreInventory.cs

View workflow job for this annotation

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

Inconsistent accessibility: parameter type 'RemoteSettings' is less accessible than method 'ClientPSCertStoreInventory.GetCertificatesFromStore(RemoteSettings, string)'
{
try
{
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