Skip to content

Commit de6ddb8

Browse files
author
Michael Henderson
committed
firx PR#130 merge conflict
2 parents 52d9fdb + 2407107 commit de6ddb8

20 files changed

+722
-358
lines changed

.github/workflows/keyfactor-starter-workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ on:
1111

1212
jobs:
1313
call-starter-workflow:
14-
uses: keyfactor/actions/.github/workflows/starter.yml@dual-platform-without-doctool
14+
uses: keyfactor/actions/.github/workflows/starter.yml@3.1.2
1515
secrets:
1616
token: ${{ secrets.V2BUILDTOKEN}}
1717
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
1818
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
1919
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}
20+
scan_token: ${{ secrets.SAST_TOKEN }}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
SET NOCOUNT ON
2+
3+
BEGIN TRY
4+
BEGIN TRANSACTION
5+
6+
DECLARE @IISUShortName VARCHAR(50) = 'IISU'
7+
DECLARE @SniFlagParameter VARCHAR(50) = 'SniFlag'
8+
9+
DECLARE @StoreTypeId INT
10+
11+
-- get store type id
12+
SELECT @StoreTypeId = storetypes.[StoreType]
13+
FROM [cms_agents].[CertStoreTypes] AS storetypes
14+
WHERE @IISUShortName = storetypes.[ShortName]
15+
16+
-- get list of cert stores guids of that type
17+
SELECT certstores.[Id]
18+
INTO #StoreGuids
19+
FROM [cms_agents].[CertStores] AS certstores
20+
WHERE @StoreTypeId = certstores.[CertStoreType]
21+
22+
-- get list of certstoreinventoryitems matching on store guid
23+
SELECT inventory.[Id], inventory.[EntryParameters]
24+
INTO #InventoryItems
25+
FROM [cms_agents].[CertStoreInventoryItems] AS inventory
26+
INNER JOIN #StoreGuids ON #StoreGuids.[Id] = inventory.[CertStoreId]
27+
28+
-- update entry parameters to new setting
29+
UPDATE [cms_agents].[CertStoreTypeEntryParameters]
30+
SET [DisplayName] = 'SSL Flags',
31+
[Type] = '0',
32+
[DefaultValue] = '0',
33+
[Options] = NULL
34+
WHERE [StoreTypeId] = @StoreTypeId
35+
AND [Name] = @SniFlagParameter
36+
37+
-- perform batch processing on certstoreinventoryitems to alter their EntryParameters to change the SNiFlag value to be a simple character instead of lots of text
38+
-- replace 0 - No SNI
39+
UPDATE inventoryitems
40+
SET inventoryitems.[EntryParameters] = REPLACE(inventory.[EntryParameters], '0 - No SNI', '0')
41+
FROM [cms_agents].[CertStoreInventoryItems] AS inventoryitems
42+
INNER JOIN #InventoryItems ON inventoryitems.[Id] = #InventoryItems.[Id]
43+
WHERE inventoryitems.[EntryParameters] LIKE '%0 - No SNI%'
44+
45+
-- replace 1 - SNI Enabled
46+
UPDATE inventoryitems
47+
SET inventoryitems.[EntryParameters] = REPLACE(inventory.[EntryParameters], '1 - SNI Enabled', '1')
48+
FROM [cms_agents].[CertStoreInventoryItems] AS inventoryitems
49+
INNER JOIN #InventoryItems ON inventoryitems.[Id] = #InventoryItems.[Id]
50+
WHERE inventoryitems.[EntryParameters] LIKE '%1 - SNI Enabled%'
51+
52+
-- replace 2 - Non SNI Binding
53+
UPDATE inventoryitems
54+
SET inventoryitems.[EntryParameters] = REPLACE(inventory.[EntryParameters], '2 - Non SNI Binding', '2')
55+
FROM [cms_agents].[CertStoreInventoryItems] AS inventoryitems
56+
INNER JOIN #InventoryItems ON inventoryitems.[Id] = #InventoryItems.[Id]
57+
WHERE inventoryitems.[EntryParameters] LIKE '%2 - Non SNI Binding%'
58+
59+
-- replace 3 - SNI Binding
60+
UPDATE inventoryitems
61+
SET inventoryitems.[EntryParameters] = REPLACE(inventory.[EntryParameters], '3 - SNI Binding', '3')
62+
FROM [cms_agents].[CertStoreInventoryItems] AS inventoryitems
63+
INNER JOIN #InventoryItems ON inventoryitems.[Id] = #InventoryItems.[Id]
64+
WHERE inventoryitems.[EntryParameters] LIKE '%3 - SNI Binding%'
65+
66+
COMMIT TRANSACTION
67+
END TRY
68+
69+
BEGIN CATCH
70+
IF (@@TRANCOUNT > 0)
71+
BEGIN
72+
ROLLBACK TRANSACTION;
73+
END
74+
75+
SELECT
76+
ERROR_MESSAGE() AS ErrorMessage,
77+
ERROR_SEVERITY() AS Severity,
78+
ERROR_STATE() AS ErrorState;
79+
END CATCH
80+

Migration-Scripts/Legacy-IIS/CreateIISUCertStoreType.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ BEGIN TRY
358358
)
359359
VALUES
360360
(
361-
@current_storetype_id, -- StoreTypeId
361+
@current_storetype_id, -- StoreTypeId
362362
'SniFlag', -- Name
363-
'SNI Support', -- DisplayName
364-
2, -- Type
363+
'SSL Flags', -- DisplayName
364+
0, -- Type
365365
14, -- RequiredWhen
366366
NULL, -- DependsOn
367-
'0 - No SNI', -- DefaultValue
368-
'0 - No SNI,1 - SNI Enabled,2 - Non SNI Binding,3 - SNI Binding' -- Options
367+
'0', -- DefaultValue
368+
NULL -- Options
369369
);
370370

371371
-- create Protocol entry parameter

README.md

Lines changed: 543 additions & 352 deletions
Large diffs are not rendered by default.

docsource/content.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Overview
2+
3+
The WinCertStore Orchestrator remotely manages certificates in a Windows Server local machine certificate store. Users are able to determine which store they wish to place certificates in by entering the correct store path. For a complete list of local machine cert stores you can execute the PowerShell command:
4+
5+
Get-ChildItem Cert:\LocalMachine
6+
7+
The returned list will contain the actual certificate store name to be used when entering store location.
8+
9+
By default, most certificates are stored in the “Personal” (My) and “Web Hosting” (WebHosting) stores.
10+
11+
This extension implements four job types: Inventory, Management Add/Remove, and Reenrollment.
12+
13+
WinRM is used to remotely manage the certificate stores and IIS bindings. WinRM must be properly configured to allow the orchestrator on the server to manage the certificates. Setting up WinRM is not in the scope of this document.
14+
15+
**Note:**
16+
In version 2.0 of the IIS Orchestrator, the certificate store type has been renamed and additional parameters have been added. Prior to 2.0 the certificate store type was called “IISBin” and as of 2.0 it is called “IISU”. If you have existing certificate stores of type “IISBin”, you have three options:
17+
1. Leave them as is and continue to manage them with a pre 2.0 IIS Orchestrator Extension. Create the new IISU certificate store type and create any new IIS stores using the new type.
18+
1. Delete existing IIS stores. Delete the IISBin store type. Create the new IISU store type. Recreate the IIS stores using the new IISU store type.
19+
1. Convert existing IISBin certificate stores to IISU certificate stores. There is not currently a way to do this via the Keyfactor API, so direct updates to the underlying Keyfactor SQL database is required. A SQL script (IIS-Conversion.sql) is available in the repository to do this. Hosted customers, which do not have access to the underlying database, will need to work Keyfactor support to run the conversion. On-premises customers can run the script themselves, but are strongly encouraged to ensure that a SQL backup is taken prior running the script (and also be confident that they have a tested database restoration process.)
20+
21+
**Note: There is an additional (and deprecated) certificate store type of “IIS” that ships with the Keyfactor platform. Migration of certificate stores from the “IIS” type to either the “IISBin” or “IISU” types is not currently supported.**
22+
23+
**Note: If Looking to use GMSA Accounts to run the Service Keyfactor Command 10.2 or greater is required for No Value checkbox to work**
24+
25+
## Requirements
26+
27+
### Security and Permission Considerations
28+
29+
From an official support point of view, Local Administrator permissions are required on the target server. Some customers have been successful with using other accounts and granting rights to the underlying certificate and private key stores. Due to complexities with the interactions between Group Policy, WinRM, User Account Control, and other unpredictable customer environmental factors, Keyfactor cannot provide assistance with using accounts other than the local administrator account.
30+
31+
For customers wishing to use something other than the local administrator account, the following information may be helpful:
32+
33+
* The WinCert extensions (WinCert, IISU, WinSQL) create a WinRM (remote PowerShell) session to the target server in order to manipulate the Windows Certificate Stores, perform binding (in the case of the IISU extension), or to access the registry (in the case of the WinSQL extension).
34+
35+
* When the WinRM session is created, the certificate store credentials are used if they have been specified, otherwise the WinRM session is created in the context of the Universal Orchestrator (UO) Service account (which potentially could be the network service account, a regular account, or a GMSA account)
36+
37+
* WinRM needs to be properly set up between the server hosting the UO and the target server. This means that a WinRM client running on the UO server when running in the context of the UO service account needs to be able to create a session on the target server using the configured credentials of the target server and any PowerShell commands running on the remote session need to have appropriate permissions.
38+
39+
* Even though a given account may be in the administrators group or have administrative privileges on the target system and may be able to execute certificate and binding operations when running locally, the same account may not work when being used via WinRM. User Account Control (UAC) can get in the way and filter out administrative privledges. UAC / WinRM configuration has a LocalAccountTokenFilterPolicy setting that can be adjusted to not filter out administrative privledges for remote users, but enabling this may have other security ramifications.
40+
41+
* The following list may not be exhaustive, but in general the account (when running under a remote WinRM session) needs permissions to:
42+
- Instantiate and open a .NET X509Certificates.X509Store object for the target certificate store and be able to read and write both the certificates and related private keys. Note that ACL permissions on the stores and private keys are separate.
43+
- Use the Import-Certificate, Get-WebSite, Get-WebBinding, and New-WebBinding PowerShell CmdLets.
44+
- Create and delete temporary files.
45+
- Execute certreq commands.
46+
- Access any Cryptographic Service Provider (CSP) referenced in re-enrollment jobs.
47+
- Read and Write values in the registry (HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server) when performing SQL Server certificate binding.
48+
49+
## Note Regarding Client Machine
50+
51+
If running as an agent (accessing stores on the server where the Universal Orchestrator Services is installed ONLY), the Client Machine can be entered, OR you can bypass a WinRM connection and access the local file system directly by adding "|LocalMachine" to the end of your value for Client Machine, for example "1.1.1.1|LocalMachine". In this instance the value to the left of the pipe (|) is ignored. It is important to make sure the values for Client Machine and Store Path together are unique for each certificate store created, as Keyfactor Command requires the Store Type you select, along with Client Machine, and Store Path together must be unique. To ensure this, it is good practice to put the full DNS or IP Address to the left of the | character when setting up a certificate store that will be accessed without a WinRM connection.
52+
53+
Here are the settings required for each Store Type previously configured.

docsource/iisu.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Overview
2+
3+
The IIS Bound Certificate Certificate Store Type, identified by its short name 'IISU,' is designed for the management of certificates bound to IIS (Internet Information Services) servers. This store type allows users to automate and streamline the process of adding, removing, and reenrolling certificates for IIS sites, making it significantly easier to manage web server certificates.
4+
5+
### Key Features and Representation
6+
7+
The IISU store type represents the IIS servers and their certificate bindings. It specifically caters to managing SSL/TLS certificates tied to IIS websites, allowing bind operations such as specifying site names, IP addresses, ports, and enabling Server Name Indication (SNI). By default, it supports job types like Inventory, Add, Remove, and Reenrollment, thereby offering comprehensive management capabilities for IIS certificates.
8+
9+
### Limitations and Areas of Confusion
10+
11+
- **Caveats:** It's important to ensure that the Windows Remote Management (WinRM) is properly configured on the target server. The orchestrator relies on WinRM to perform its tasks, such as manipulating the Windows Certificate Stores. Misconfiguration of WinRM may lead to connection and permission issues.
12+
13+
- **Limitations:** Users should be aware that for this store type to function correctly, certain permissions are necessary. While some advanced users successfully use non-administrator accounts with specific permissions, it is officially supported only with Local Administrator permissions. Complexities with interactions between Group Policy, WinRM, User Account Control, and other environmental factors may impede operations if not properly configured.
14+
15+
- **Custom Alias and Private Keys:** The store type does not support custom aliases for individual entries and requires private keys because IIS certificates without private keys would be invalid.
40.7 KB
Loading
50.3 KB
Loading
39.6 KB
Loading
42.6 KB
Loading

0 commit comments

Comments
 (0)