Skip to content

Commit fc5f40e

Browse files
efioccaspbsolubleElena FioccaKeyfactor
authored
Release: 1.0.2
Co-authored-by: Sean <1661003+spbsoluble@users.noreply.github.com> Co-authored-by: Elena Fiocca <efiocca@keyfactor.com> Co-authored-by: Keyfactor <keyfactor@keyfactor.github.io>
1 parent 3830f4b commit fc5f40e

File tree

9 files changed

+99
-15
lines changed

9 files changed

+99
-15
lines changed

AxisIPCamera/Client/AxisHttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public CertificateData ListCertificates()
232232
/// <summary>
233233
/// Gets the default keystore configured on the device.
234234
/// </summary>
235-
/// <returns>Keystore Enum</returns>
235+
/// <returns>Keystore struct</returns>
236236
public Constants.Keystore GetDefaultKeystore()
237237
{
238238
try

AxisIPCamera/Inventory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Text.RegularExpressions;
1112

1213
using Microsoft.Extensions.Logging;
1314
using Newtonsoft.Json;
@@ -47,7 +48,8 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
4748
_logger.MethodEntry();
4849

4950
_logger.LogTrace($"Begin Inventory for Client Machine {config.CertificateStoreDetails.ClientMachine}...");
50-
_logger.LogDebug($"Inventory Config: {JsonConvert.SerializeObject(config)}");
51+
string jsonConfig = JsonConvert.SerializeObject(config);
52+
_logger.LogDebug($"Inventory Config: {jsonConfig.Replace(config.ServerPassword,"**********")}");
5153

5254
_logger.LogTrace("Create HTTPS client to connect to device");
5355
var client = new AxisHttpClient(config, config.CertificateStoreDetails, Resolver);
@@ -63,7 +65,7 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
6365
// Get the default keystore
6466
_logger.LogTrace("Retrieve the default keystore");
6567
Constants.Keystore defaultKeystore = client.GetDefaultKeystore();
66-
string defaultKeystoreString = Enum.GetName(typeof(Constants.Keystore), defaultKeystore);
68+
string defaultKeystoreString = defaultKeystore.ToString();
6769
_logger.LogDebug($"Inventory - Default keystore: {defaultKeystoreString}");
6870

6971
// Create new list of client certs that are only tied to the default keystore

AxisIPCamera/Management.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
7777
// to determine if job should overwrite an existing certificate in the store, for example a renewal.
7878

7979
// Retrieve management config from Command
80-
_logger.LogDebug($"Management Config {JsonConvert.SerializeObject(config)}");
80+
string jsonConfig = JsonConvert.SerializeObject(config);
81+
_logger.LogDebug($"Management Config: {jsonConfig.Replace(config.ServerPassword,"**********")}");
8182
_logger.LogDebug($"Client Machine: {config.CertificateStoreDetails.ClientMachine}");
8283

8384
// Get needed information from config

AxisIPCamera/Model/Certificate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class Certificate
2828
{
2929
[JsonProperty("alias")] public string Alias { get; set; }
3030
[JsonProperty("certificate")] public string CertAsPem { get; set; }
31-
[JsonProperty("keystore")] public Constants.Keystore Keystore { get; set; }
31+
[JsonProperty("keystore")] public Constants.Keystore Keystore { get; init; }
3232
public Constants.CertificateUsage Binding { get; set; } = Constants.CertificateUsage.Other;
3333
}
3434

AxisIPCamera/Model/Constants.cs

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using System;
99
using System.IO;
10+
using Newtonsoft.Json;
1011
using Org.BouncyCastle.OpenSsl;
1112
using Org.BouncyCastle.Pkcs;
1213

@@ -55,11 +56,15 @@ public enum CertificateUsage
5556
Undefined
5657
}
5758

58-
// ** NOTE: There may be more keystore types depending on the Axis camera model
59-
public enum Keystore
59+
/** NOTE: Keystore IDs are device-specific and not stable across Axis camera models.
60+
* New camera/firmware can introduce new Keystore IDs. Cameras can also have multiple
61+
* keystores of the same type (i.e. SE0, SE1, TPM0, TPM1, etc.)
62+
* Therefore, treat the Keystore ID as an opaque string, not a fixed enum.
63+
*/
64+
[JsonConverter(typeof(KeystoreJsonConverter))]
65+
public readonly record struct Keystore(string Value)
6066
{
61-
TEE0, // Trusted Environment
62-
SE0 // Secure Element
67+
public override string ToString() => Value;
6368
}
6469

6570
public enum ApiType
@@ -212,5 +217,35 @@ public static void ValidateCsr(string csrPem)
212217
throw new Exception($"CSR Validation failed: {ex.Message}");
213218
}
214219
}
220+
221+
/// <summary>
222+
/// Custom JSON converter to tell Newtonsoft how to parse the record struct 'Keystore' type.
223+
/// </summary>
224+
private sealed class KeystoreJsonConverter : JsonConverter<Keystore>
225+
{
226+
public override Keystore ReadJson(
227+
JsonReader reader,
228+
Type objectType,
229+
Keystore existingValue,
230+
bool hasExistingValue,
231+
JsonSerializer serializer)
232+
{
233+
if (reader.TokenType == JsonToken.String)
234+
{
235+
return new Keystore(reader.Value!.ToString()!);
236+
}
237+
238+
throw new JsonSerializationException(
239+
$"Unexpected token {reader.TokenType} when parsing Keystore");
240+
}
241+
242+
public override void WriteJson(
243+
JsonWriter writer,
244+
Keystore value,
245+
JsonSerializer serializer)
246+
{
247+
writer.WriteValue(value.Value);
248+
}
249+
}
215250
}
216251
}

AxisIPCamera/Reenrollment.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public JobResult ProcessJob(ReenrollmentJobConfiguration config, SubmitReenrollm
4242
_logger.MethodEntry();
4343

4444
_logger.LogTrace($"Begin Reenrollment for Client Machine {config.CertificateStoreDetails.ClientMachine}");
45-
_logger.LogDebug($"Reenrollment Config: {JsonConvert.SerializeObject(config)}");
45+
string jsonConfig = JsonConvert.SerializeObject(config);
46+
_logger.LogDebug($"Reenrollment Config: {jsonConfig.Replace(config.ServerPassword,"**********")}");
4647

4748
// Log each key-value pair in the Job Properties for debugging
4849
_logger.LogDebug("Begin Job Properties ---");
@@ -109,7 +110,7 @@ public JobResult ProcessJob(ReenrollmentJobConfiguration config, SubmitReenrollm
109110
// Get the default keystore
110111
_logger.LogTrace("Retrieve the default keystore");
111112
Constants.Keystore defaultKeystore = client.GetDefaultKeystore();
112-
string defaultKeystoreString = Enum.GetName(typeof(Constants.Keystore), defaultKeystore);
113+
string defaultKeystoreString = defaultKeystore.ToString();
113114
_logger.LogDebug($"Reenrollment - Default keystore: {defaultKeystoreString}");
114115

115116
_logger.LogTrace("Generating self-signed cert with private key on device");

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v1.0.2
2+
- fix(logs): Removed logging of plaintext cert store Server Password
3+
- fix(keystore): Updated Keystore type to be dynamic instead of a fixed Enum to allow compatibility across different cameras/firmware
4+
15
v1.0.1
26
- chore(docs): Add screenshots to docs
37

README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,37 @@ the Keyfactor Command Portal
187187

188188
![AxisIPCamera Custom Fields Tab](docsource/images/AxisIPCamera-custom-fields-store-type-dialog.png)
189189

190+
191+
###### Server Username
192+
Enter the username of the configured "service" user on the camera
193+
194+
195+
> [!IMPORTANT]
196+
> This field is created by the `Needs Server` on the Basic tab, do not create this field manually.
197+
198+
199+
200+
201+
###### Server Password
202+
Enter the password of the configured "service" user on the camera
203+
204+
205+
> [!IMPORTANT]
206+
> This field is created by the `Needs Server` on the Basic tab, do not create this field manually.
207+
208+
209+
210+
211+
###### Use SSL
212+
Select True or False depending on if SSL (HTTPS) should be used to communicate with the camera. This should always be "True"
213+
214+
![AxisIPCamera Custom Field - ServerUseSsl](docsource/images/AxisIPCamera-custom-field-ServerUseSsl-dialog.png)
215+
![AxisIPCamera Custom Field - ServerUseSsl](docsource/images/AxisIPCamera-custom-field-ServerUseSsl-validation-options-dialog.png)
216+
217+
218+
219+
220+
190221
##### Entry Parameters Tab
191222

192223
| Name | Display Name | Description | Type | Default Value | Entry has a private key | Adding an entry | Removing an entry | Reenrolling an entry |
@@ -197,21 +228,29 @@ the Keyfactor Command Portal
197228

198229
![AxisIPCamera Entry Parameters Tab](docsource/images/AxisIPCamera-entry-parameters-store-type-dialog.png)
199230

231+
232+
##### Certificate Usage
233+
The Certificate Usage to assign to the cert after enrollment. Can be left 'Other' to be assigned later.
234+
235+
![AxisIPCamera Entry Parameter - CertUsage](docsource/images/AxisIPCamera-entry-parameters-store-type-dialog-CertUsage.png)
236+
![AxisIPCamera Entry Parameter - CertUsage](docsource/images/AxisIPCamera-entry-parameters-store-type-dialog-CertUsage-validation-options.png)
237+
238+
239+
200240
</details>
201241

202242
## Installation
203243

204244
1. **Download the latest AXIS IP Camera Universal Orchestrator extension from GitHub.**
205245

206-
Navigate to the [AXIS IP Camera Universal Orchestrator extension GitHub version page](https://github.com/Keyfactor/axis-ipcamera-orchestrator/releases/latest). Refer to the compatibility matrix below to determine whether the `net6.0` or `net8.0` asset should be downloaded. Then, click the corresponding asset to download the zip archive.
246+
Navigate to the [AXIS IP Camera Universal Orchestrator extension GitHub version page](https://github.com/Keyfactor/axis-ipcamera-orchestrator/releases/latest). Refer to the compatibility matrix below to determine the asset should be downloaded. Then, click the corresponding asset to download the zip archive.
207247

208248
| Universal Orchestrator Version | Latest .NET version installed on the Universal Orchestrator server | `rollForward` condition in `Orchestrator.runtimeconfig.json` | `axis-ipcamera-orchestrator` .NET version to download |
209249
| --------- | ----------- | ----------- | ----------- |
210250
| Older than `11.0.0` | | | `net6.0` |
211251
| Between `11.0.0` and `11.5.1` (inclusive) | `net6.0` | | `net6.0` |
212-
| Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `Disable` | `net6.0` |
213-
| Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `LatestMajor` | `net8.0` |
214-
| `11.6` _and_ newer | `net8.0` | | `net8.0` |
252+
| Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `Disable` | `net6.0` || Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `LatestMajor` | `net8.0` |
253+
| `11.6` _and_ newer | `net8.0` | | `net8.0` |
215254

216255
Unzip the archive containing extension assemblies to a known location.
217256

integration-manifest.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"update_catalog": true,
1010
"link_github": true,
1111
"description": "The Axis IP Camera Orchestrator Extension is used to inventory, manage Trust certs, and enroll for client certificates that can be bound to endpoints.",
12+
"short_description": "The Axis IP Camera Orchestrator Extension is used to inventory, manage Trust certs, and enroll for client certificates that can be bound to endpoints.",
1213
"about": {
1314
"orchestrator": {
1415
"UOFramework": "10.1",
@@ -90,3 +91,4 @@
9091
}
9192
}
9293
}
94+

0 commit comments

Comments
 (0)