Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ members = [
"resources/windows_firewall",
"resources/windows_service",
"resources/WindowsUpdate",
"adapters/group_policy_template",
"tools/dsctest",
"tools/test_group_resource",
"xtask",
Expand Down Expand Up @@ -57,6 +58,7 @@ default-members = [
"resources/windows_firewall",
"resources/windows_service",
"resources/WindowsUpdate",
"adapters/group_policy_template",
"tools/dsctest",
"tools/test_group_resource",
"xtask",
Expand Down Expand Up @@ -90,6 +92,7 @@ Windows = [
"resources/windows_firewall",
"resources/windows_service",
"resources/WindowsUpdate",
"adapters/group_policy_template",
"tools/dsctest",
"tools/test_group_resource",
"xtask",
Expand Down Expand Up @@ -211,6 +214,8 @@ regex = { version = "1.13.1" }
registry = { version = "1.3" }
# dsc
rmcp = { version = "2.2.0" }
# group_policy_template
roxmltree = { version = "0.20.0" }
# dsc_lib
rt-format = { version = "0.3" }
# dsc, dsc-lib, dsc-bicep-ext, dscecho, registry, dsc-lib-registry, runcommandonset, sshdconfig
Expand Down Expand Up @@ -284,7 +289,8 @@ windows = { version = "0.62", features = [
"Win32_System_Ole",
"Win32_System_Services",
"Win32_System_Variant",
"Win32_System_UpdateAgent"
"Win32_System_UpdateAgent",
"Win32_Globalization"
] }

# build-only dependencies
Expand Down
14 changes: 14 additions & 0 deletions adapters/group_policy_template/.project.data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Name": "group_policy_template",
"Kind": "Adapter",
"IsRust": true,
"SupportedPlatformOS": "Windows",
"Binaries": [
"group_policy_template"
],
"CopyFiles": {
"Windows": [
"group_policy_template.dsc.resource.json"
]
}
}
20 changes: 20 additions & 0 deletions adapters/group_policy_template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "group_policy_template"
version = "0.1.0"
edition = "2024"

[package.metadata.i18n]
available-locales = ["en-us"]
default-locale = "en-us"
load-path = "locales"

[dependencies]
roxmltree = { workspace = true }
rust-i18n = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }

[target.'cfg(windows)'.dependencies]
dsc-lib-registry = { workspace = true }
windows = { workspace = true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
"type": "Microsoft.Adapter/GroupPolicyTemplate",
"version": "0.1.0",
"kind": "adapter",
"description": "Adapts Windows Group Policy ADMX templates into DSC resources.",
"tags": [
"Windows",
"GroupPolicy"
],
"adapter": {
"list": {
"executable": "group_policy_template",
"args": [
"list"
]
},
"inputKind": "single"
},
"get": {
"executable": "group_policy_template",
"args": [
"get",
{
"jsonInputArg": "--input",
"mandatory": true
},
{
"resourceTypeArg": "--resource-type"
},
{
"resourcePathArg": "--resource-path"
}
]
},
"set": {
"executable": "group_policy_template",
"args": [
"set",
{
"jsonInputArg": "--input",
"mandatory": true
},
{
"resourceTypeArg": "--resource-type"
},
{
"resourcePathArg": "--resource-path"
}
],
"implementsPretest": false,
"return": "state",
"requireSecurityContext": "elevated"
},
"exitCodes": {
"0": "Success",
"1": "Invalid arguments",
"2": "Invalid input",
"3": "ADMX, ADML, or registry operation failed"
}
}
50 changes: 50 additions & 0 deletions adapters/group_policy_template/locales/en-us.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
_version = 1

[main]
windowsOnly = "The Group Policy Template adapter is only supported on Windows."
missingOperation = "Missing operation. Expected list, get, or set."
unknownOperation = "Unknown operation: '%{operation}'. Expected list, get, or set."
missingArgument = "Missing required argument '%{argument}'."

[admx]
readDirectory = "Failed to read policy definitions directory '%{path}': %{error}"
readFile = "Failed to read '%{path}': %{error}"
parseFile = "Failed to parse '%{path}': %{error}"
serializeResource = "Failed to serialize an adapted resource: %{error}"
skipTemplate = "Skipped policy template '%{path}': %{error}"
resourceNotFound = "Adapted resource '%{resource}' was not found in '%{path}'."
missingPolicyAttribute = "Policy '%{policy}' is missing required attribute '%{attribute}'."
missingPolicyValue = "Policy '%{policy}' is missing '%{value}'."
emptyPolicyValue = "A policy value does not contain a registry value."
unsupportedValueType = "Unsupported ADMX registry value type '%{value_type}'."
missingElementId = "A policy element is missing its required id."
unsupportedElementType = "Unsupported ADMX policy element type '%{element_type}'."
invalidPolicyClass = "Unsupported ADMX policy class '%{class}'."
missingValueName = "A registry value list item is missing its valueName."
invalidPath = "The ADMX path is invalid."
admlNotFound = "No ADML file was found for template '%{template}' and locale '%{locale}'."
systemRootNotFound = "The SystemRoot environment variable is not defined."
invalidNumber = "Invalid numeric policy value '%{value}': %{error}"
invalidBinary = "Invalid binary policy value '%{value}': %{error}"

[schema]
scopeTitle = "Scope"
scopeDescription = "Specifies whether policy settings apply to all users through HKEY_LOCAL_MACHINE or the current user through HKEY_CURRENT_USER."
enabledTitle = "Enabled"

[registry]
invalidInput = "Invalid JSON input: %{error}"
invalidScope = "The scope must be either 'allUsers' or 'currentUser'."
unknownPolicy = "Policy property '%{policy}' does not exist on adapted resource '%{resource}'."
policyNotBoolean = "Policy property '%{policy}' must be a Boolean."
invalidPolicyValue = "Policy property '%{policy}' must be a Boolean or an object."
policyHasNoToggle = "Policy '%{policy}' has no enabled or disabled registry value; configure its child settings instead."
unknownElement = "Element '%{element}' does not exist on policy '%{policy}'."
elementHasNoValueName = "Policy element '%{element}' does not define a registry value name."
listNotObject = "List element '%{element}' must be an object."
listValueNotString = "Every value in list element '%{element}' must be a string."
invalidElementValue = "The value for policy element '%{element}' does not match its ADMX definition."
scopeNotSupported = "Policy '%{policy}' does not support scope '%{scope}'."
unrecognizedValue = "Registry value '%{value_name}' under '%{key}' does not match the policy's enabled or disabled value."
operationFailed = "Registry operation failed: %{error}"
serializeResult = "Failed to serialize the resource state: %{error}"
Loading
Loading