Skip to content

Commit 0de9397

Browse files
committed
chore(enroll): Add config for CA Type
1 parent de57d91 commit 0de9397

8 files changed

Lines changed: 440 additions & 17 deletions

File tree

GoDaddy.Tests/GoDaddyCAPlugin.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public void GoDaddyCAPlugin_ValidateProductInfo_DV_InvalidParameters_ReturnFailu
119119
{
120120
{ EnrollmentConfigConstants.SlotSize, "5" },
121121
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
122+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
122123
// DV
123124
{ EnrollmentConfigConstants.LastName, "Doe" },
124125
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -158,6 +159,7 @@ public void GoDaddyCAPlugin_ValidateProductInfo_OV_InvalidParameters_ReturnFailu
158159
{
159160
{ EnrollmentConfigConstants.SlotSize, "5" },
160161
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
162+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
161163
// DV
162164
{ EnrollmentConfigConstants.LastName, "Doe" },
163165
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -204,6 +206,7 @@ public void GoDaddyCAPlugin_ValidateProductInfo_EV_InvalidParameters_ReturnFailu
204206
{
205207
{ EnrollmentConfigConstants.SlotSize, "5" },
206208
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
209+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
207210
// DV
208211
{ EnrollmentConfigConstants.LastName, "Doe" },
209212
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -276,6 +279,7 @@ public void GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
276279
{
277280
{ EnrollmentConfigConstants.SlotSize, "5" },
278281
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
282+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
279283
// DV
280284
{ EnrollmentConfigConstants.LastName, "Doe" },
281285
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -371,6 +375,7 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
371375
{
372376
{ EnrollmentConfigConstants.SlotSize, "5" },
373377
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
378+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
374379
// DV
375380
{ EnrollmentConfigConstants.LastName, "Doe" },
376381
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -469,6 +474,7 @@ public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
469474
{
470475
{ EnrollmentConfigConstants.SlotSize, "5" },
471476
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
477+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
472478
// DV
473479
{ EnrollmentConfigConstants.LastName, "Doe" },
474480
{ EnrollmentConfigConstants.FirstName, "John" },
@@ -535,6 +541,7 @@ public void GoDaddyCAPlugin_Integration_Enroll_ReturnSuccess()
535541
{
536542
{ EnrollmentConfigConstants.SlotSize, "5" },
537543
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
544+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
538545
// DV
539546
{ EnrollmentConfigConstants.LastName, "Doe" },
540547
{ EnrollmentConfigConstants.FirstName, "John" },

GoDaddy.Tests/GoDaddyEnrollment.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void EnrollmentStrategyFactory_Enrollment_ValidParameters_ReturnSuccess()
7777
RegistrationNumber = "123456789",
7878

7979
// AnyGateway REST config
80-
PriorCertSN = "123456789ABCDEF"
80+
PriorCertSN = "123456789ABCDEF",
8181
};
8282

8383
FakeGoDaddyClient fakeClient = new FakeGoDaddyClient();
@@ -258,6 +258,7 @@ public void EnrollmentBuilder_ValidParameters_ReturnSuccess()
258258
{
259259
{ EnrollmentConfigConstants.SlotSize, "5" },
260260
{ EnrollmentConfigConstants.CertificateValidityInYears, "2" },
261+
{ EnrollmentConfigConstants.RootCAType, "GODADDY_SHA_2" },
261262
// DV
262263
{ EnrollmentConfigConstants.LastName, "Doe" },
263264
{ EnrollmentConfigConstants.FirstName, "John" },

GoDaddy/Client/EnrollmentBuilder.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public IEnrollmentRequestBuilder WithEnrollmentProductInfo(EnrollmentProductInfo
8787
EnrollmentConfigConstants.LastName,
8888
EnrollmentConfigConstants.Phone,
8989

90+
EnrollmentConfigConstants.RootCAType,
9091
EnrollmentConfigConstants.CertificateValidityInYears,
9192
EnrollmentConfigConstants.SlotSize,
9293
});
@@ -113,6 +114,7 @@ public IEnrollmentRequestBuilder WithEnrollmentProductInfo(EnrollmentProductInfo
113114
EnrollmentConfigConstants.OrganizationCountry,
114115
EnrollmentConfigConstants.OrganizationPhone,
115116

117+
EnrollmentConfigConstants.RootCAType,
116118
EnrollmentConfigConstants.CertificateValidityInYears,
117119
EnrollmentConfigConstants.SlotSize,
118120
});
@@ -140,6 +142,7 @@ public IEnrollmentRequestBuilder WithEnrollmentProductInfo(EnrollmentProductInfo
140142
EnrollmentConfigConstants.RegistrationNumber,
141143
EnrollmentConfigConstants.JobTitle,
142144

145+
EnrollmentConfigConstants.RootCAType,
143146
EnrollmentConfigConstants.CertificateValidityInYears,
144147
EnrollmentConfigConstants.SlotSize,
145148
});
@@ -180,15 +183,28 @@ public IEnrollmentRequestBuilder WithEnrollmentProductInfo(EnrollmentProductInfo
180183
throw new ArgumentException($"Unable to parse integer value for product parameter: {parameter}");
181184
}
182185
}
186+
else if (fieldInfo.FieldType.IsEnum)
187+
{
188+
if (Enum.TryParse(fieldInfo.FieldType, productInfo.ProductParameters[parameter], out var enumValue))
189+
{
190+
_logger.LogTrace($"{fieldInfo.Name} is an enum - setting value to {enumValue}");
191+
fieldInfo.SetValue(_theEnrollmentRequest, enumValue);
192+
}
193+
else
194+
{
195+
_logger.LogError($"Unable to parse enum value for product parameter: {parameter} - valid values are: {string.Join(", ", Enum.GetNames(fieldInfo.FieldType))}");
196+
throw new ArgumentException($"Unable to parse enum value for product parameter: {parameter} - valid values are: {string.Join(", ", Enum.GetNames(fieldInfo.FieldType))}");
197+
}
198+
}
183199
else if (fieldInfo == null)
184200
{
185-
_logger.LogError($"Failed to find property for product parameter: {parameter}");
186-
throw new ArgumentException($"Failed to find property for product parameter: {parameter}");
201+
_logger.LogError($"Failed to find field for product parameter: {parameter}");
202+
throw new ArgumentException($"Failed to find field for product parameter: {parameter}");
187203
}
188204
else
189205
{
190-
_logger.LogError($"Invalid property type for product parameter: {parameter}");
191-
throw new ArgumentException($"Invalid property type for product parameter: {parameter}");
206+
_logger.LogError($"Invalid field type for product parameter: {parameter}");
207+
throw new ArgumentException($"Invalid field type for product parameter: {parameter}");
192208
}
193209
}
194210

GoDaddy/GoDaddyCAPluginConfig.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,25 @@ public class Config
3939

4040
public static class EnrollmentConfigConstants
4141
{
42-
public const string JobTitle = "JobTitle";
43-
public const string CertificateValidityInYears = "CertificateValidityInYears";
4442
public const string LastName = "LastName";
4543
public const string FirstName = "FirstName";
4644
public const string Email = "Email";
4745
public const string Phone = "Phone";
48-
public const string SlotSize = "SlotSize";
46+
4947
public const string OrganizationName = "OrganizationName";
5048
public const string OrganizationAddress = "OrganizationAddress";
5149
public const string OrganizationCity = "OrganizationCity";
5250
public const string OrganizationState = "OrganizationState";
5351
public const string OrganizationCountry = "OrganizationCountry";
5452
public const string OrganizationPhone = "OrganizationPhone";
53+
54+
public const string JobTitle = "JobTitle";
5555
public const string RegistrationAgent = "RegistrationAgent";
5656
public const string RegistrationNumber = "RegistrationNumber";
57+
58+
public const string RootCAType = "RootCAType";
59+
public const string SlotSize = "SlotSize";
60+
public const string CertificateValidityInYears = "CertificateValidityInYears";
5761
}
5862

5963
public static Dictionary<string, PropertyConfigInfo> GetPluginAnnotations()
@@ -206,6 +210,13 @@ public static Dictionary<string, PropertyConfigInfo> GetTemplateParameterAnnotat
206210
Hidden = false,
207211
DefaultValue = "",
208212
Type = "String"
213+
},
214+
[EnrollmentConfigConstants.RootCAType] = new PropertyConfigInfo()
215+
{
216+
Comments = "The certificate's root CA - Depending on certificate expiration date, SHA_1 not be allowed. Will default to SHA_2 if expiration date exceeds sha1 allowed date. Options are GODADDY_SHA_1, GODADDY_SHA_2, STARFIELD_SHA_1, or STARFIELD_SHA_2.",
217+
Hidden = false,
218+
DefaultValue = "GODADDY_SHA_2",
219+
Type = "String"
209220
}
210221
};
211222
}

README.md

Lines changed: 101 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center" style="border-bottom: none">
2-
GoDaddy
2+
GoDaddy AnyCA Gateway Plugin
33
</h1>
44

55
<p align="center">
@@ -16,6 +16,10 @@
1616
<b>Support</b>
1717
</a>
1818
·
19+
<a href="#installation">
20+
<b>Installation</b>
21+
</a>
22+
·
1923
<a href="#license">
2024
<b>License</b>
2125
</a>
@@ -26,7 +30,7 @@
2630
</p>
2731

2832

29-
The GoDaddy AnyCA REST plugin extends the capabilities of the [GoDaddy Certificate Authority (CA)](https://www.godaddy.com/web-security/ssl-certificate) to Keyfactor Command via the Keyfactor AnyCA REST Gateway. The plugin represents a fully featured AnyCA REST Plugin with the following capabilies:
33+
The GoDaddy AnyCA REST plugin extends the capabilities of the [GoDaddy Certificate Authority (CA)](https://www.godaddy.com/web-security/ssl-certificate) to Keyfactor Command via the Keyfactor . The plugin represents a fully featured AnyCA REST Plugin with the following capabilies:
3034
* CA Sync:
3135
* Download all certificates issued to the customer by the GoDaddy CA.
3236
* Certificate enrollment for all published GoDaddy Certificate SKUs:
@@ -40,17 +44,18 @@ The GoDaddy AnyCA REST plugin extends the capabilities of the [GoDaddy Certifica
4044

4145
## Compatibility
4246

43-
The GoDaddy AnyCA REST plugin is compatible with the Keyfactor AnyCA REST Gateway 24.2 and later.
47+
The GoDaddy AnyCA Gateway plugin is compatible with the Keyfactor AnyCA Gateway REST 24.2 and later.
4448

4549
## Support
46-
The GoDaddy AnyCA REST plugin is open source and community supported, meaning that there is **no SLA** applicable.
50+
The GoDaddy AnyCA Gateway plugin is open source and community supported, meaning that there is **no SLA** applicable.
4751

4852
> To report a problem or suggest a new feature, use the **[Issues](../../issues)** tab. If you want to contribute actual bug fixes or proposed enhancements, use the **[Pull requests](../../pulls)** tab.
4953
5054
## Requirements
55+
5156
1. **GoDaddy Account**
5257

53-
To use the GoDaddy AnyCA REST plugin, a production GoDaddy account must be created and fully configured. To create a new account, follow [GoDaddy's official documentation](https://www.godaddy.com/help/create-a-godaddy-account-16618). Make sure that your [account Profile is fully configured](https://www.godaddy.com/help/update-my-godaddy-account-profile-27250) with at least the following fields:
58+
To use the GoDaddy AnyCA REST plugin, a production GoDaddy account must be created and configured fully. To create a new account, follow [GoDaddy's official documentation](https://www.godaddy.com/help/create-a-godaddy-account-16618). Make sure that your [account Profile is configured fully](https://www.godaddy.com/help/update-my-godaddy-account-profile-27250) with at least the following fields:
5459
* Full Name
5560
* Address
5661
* Organization
@@ -65,7 +70,7 @@ The GoDaddy AnyCA REST plugin is open source and community supported, meaning th
6570

6671
3. **GoDaddy API Key**
6772

68-
The GoDaddy AnyCA REST plugin uses the [GoDaddy API](https://developer.godaddy.com/doc/endpoint/certificates) to perform all certificate operations. GoDaddy offers an environment for testing (OTE) and an environment for production use (Production). To configure the plugin, follow the [official GoDaddy documentation](https://developer.godaddy.com/getstarted) to create a [production API key](https://developer.godaddy.com/keys). To configure the AnyCA REST Gateway, you'll need the following parameters handy:
73+
The GoDaddy AnyCA REST plugin uses the [GoDaddy API](https://developer.godaddy.com/doc/endpoint/certificates) to perform all certificate operations. GoDaddy offers an environment for testing (OTE) and an environment for production use (Production). To configure the plugin, follow the [official GoDaddy documentation](https://developer.godaddy.com/getstarted) to create a [production API key](https://developer.godaddy.com/keys). To configure the , you'll need the following parameters handy:
6974

7075
* API URL (https://api.godaddy.com or https://api.ote-godaddy.com)
7176
* API Key
@@ -79,7 +84,97 @@ The GoDaddy AnyCA REST plugin is open source and community supported, meaning th
7984

8085
## Installation
8186

87+
1. Install the AnyCA Gateway REST per the [official Keyfactor documentation](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/InstallIntroduction.htm).
88+
89+
2. On the server hosting the AnyCA Gateway REST, download and unzip the latest [GoDaddy AnyCA Gateway REST plugin](https://github.com/Keyfactor/godaddy-anycagateway/releases/latest) from GitHub.
90+
91+
3. Copy the unzipped directory (usually called `net6.0`) to the Extensions directory:
92+
93+
```shell
94+
Program Files\Keyfactor\AnyCA Gateway\AnyGatewayREST\net6.0\Extensions
95+
```
96+
97+
> The directory containing the GoDaddy AnyCA Gateway REST plugin DLLs (`net6.0`) can be named anything, as long as it is unique within the `Extensions` directory.
98+
99+
4. Restart the AnyCA Gateway REST service.
100+
101+
5. Navigate to the AnyCA Gateway REST portal and verify that the Gateway recognizes the GoDaddy plugin by hovering over the ⓘ symbol to the right of the Gateway on the top left of the portal.
102+
103+
## Configuration
104+
105+
1. Follow the [official AnyCA Gateway REST documentation](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCA-Gateway.htm) to define a new Certificate Authority, and use the notes below to configure the **Gateway Registration** and **CA Connection** tabs:
106+
107+
* **Gateway Registration**
108+
109+
110+
GoDaddy has four available Certificate Authorities:
111+
112+
- GoDaddy SHA-1 (GODADDY_SHA_1)
113+
- [Root Certificate](https://certs.godaddy.com/repository/gd-class2-root.crt)
114+
- [Intermediate Certificate](https://certs.godaddy.com/repository/gd_intermediate.crt.pem)
115+
- GoDaddy SHA256 (GODADDY_SHA_2)
116+
- [Root Certificate](https://certs.godaddy.com/repository/gdroot-g2.crt)
117+
- [Intermediate Certificate](https://certs.godaddy.com/repository/gdig2.crt.pem)
118+
- Starfield SHA-1 (STARFIELD_SHA_1)
119+
- [Root Certificate](https://certs.godaddy.com/repository/sf-class2-root.crt)
120+
- [Intermediate Certificate](https://certs.godaddy.com/repository/sf_intermediate.crt.pem)
121+
- Starfield SHA256 (STARFIELD_SHA_2)
122+
- [Root Certificate](https://certs.godaddy.com/repository/sfroot-g2.crt)
123+
- [Intermediate Certificate](https://certs.godaddy.com/repository/sfig2.crt.pem)
124+
125+
Each defined Certificate Authority in the AnyCA REST can support one certificate authority. Since GoDaddy has four available Certificate Authorities, if you require certificate enrollment from multiple GoDaddy Certificate Authorities, you must define multiple Certificate Authorities in the AnyCA Gateway REST. This will manifest in Command as one GoDaddy CA per defined Certificate Authority.
126+
127+
128+
129+
* **CA Connection**
130+
131+
Populate using the configuration fields collected in the [requirements](#requirements) section.
132+
133+
134+
135+
* **ApiKey** - The API Key for the GoDaddy API
136+
* **ApiSecret** - The API Secret for the GoDaddy API
137+
* **BaseUrl** - The Base URL for the GoDaddy API - Usually either https://api.godaddy.com or https://api.ote-godaddy.com
138+
* **ShopperId** - The Shopper ID of the GoDaddy account to use for the API calls (ex: 1234567890) - has a max length of 10 digits
139+
* **Enabled** - Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.
140+
141+
2. Define [Certificate Profiles](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCP-Gateway.htm) and [Certificate Templates](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCA-Gateway.htm) for the Certificate Authority as required. One Certificate Profile must be defined per Certificate Template. It's recommended that each Certificate Profile be named after the Product ID. The GoDaddy plugin supports the following product IDs:
142+
143+
144+
145+
* **DV_SSL**
146+
* **DV_WILDCARD_SSL**
147+
* **EV_SSL**
148+
* **OV_CS**
149+
* **OV_DS**
150+
* **OV_SSL**
151+
* **OV_WILDCARD_SSL**
152+
* **UCC_DV_SSL**
153+
* **UCC_EV_SSL**
154+
* **UCC_OV_SSL**
155+
156+
3. Follow the [official Keyfactor documentation](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCA-Keyfactor.htm) to add each defined Certificate Authority to Keyfactor Command and import the newly defined Certificate Templates.
157+
158+
4. In Keyfactor Command, for each imported Certificate Template, follow the [official documentation](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/Configuring%20Template%20Options.htm) to define enrollment fields for each of the following parameters:
159+
160+
82161
162+
* **JobTitle** - The job title of the certificate requestor
163+
* **CertificateValidityInYears** - Number of years the certificate will be valid for
164+
* **LastName** - Last name of the certificate requestor
165+
* **FirstName** - First name of the certificate requestor
166+
* **Email** - Email address of the requestor
167+
* **Phone** - Phone number of the requestor
168+
* **SlotSize** - Maximum number of SANs that a certificate may have - valid values are [FIVE, TEN, FIFTEEN, TWENTY, THIRTY, FOURTY, FIFTY, ONE_HUNDRED]
169+
* **OrganizationName** - Name of the organization to be validated against
170+
* **OrganizationAddress** - Address of the organization to be validated against
171+
* **OrganizationCity** - City of the organization to be validated against
172+
* **OrganizationState** - Full state name of the organization to be validated against
173+
* **OrganizationCountry** - 2 character abbreviation of the country of the organization to be validated against
174+
* **OrganizationPhone** - Phone number of the organization to be validated against
175+
* **RegistrationAgent** - Registration agent name assigned to the organization when its documents were filed for registration
176+
* **RegistrationNumber** - Registration number assigned to the organization when its documents were filed for registration
177+
* **RootCAType** - The certificate's root CA - Depending on certificate expiration date, SHA_1 not be allowed. Will default to SHA_2 if expiration date exceeds sha1 allowed date. Options are GODADDY_SHA_1, GODADDY_SHA_2, STARFIELD_SHA_1, or STARFIELD_SHA_2.
83178

84179
## License
85180

0 commit comments

Comments
 (0)