Support defining policies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 523
- Forks
- 75
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 24
Description
Summary of the new feature / enhancement
Looking at existing Azure policies defined in https://github.com/Azure/azure-policy/blob/master/samples/GuestConfiguration/package-samples/configurations/AzureWindowsBaseline/AzureWindowsBaseline.mof, it seems that it may be useful to have a common Policy resource that can leverage use another resource for the actual get and set, but has a way within the config to have a custom test:
Here's an example policy in mof:
instance of ASM_Registry as $ASM_Registry26ref
{
RuleId = "{a002b800-92a4-45cb-bbee-76c91739ddff}";
AzId = "AZ-WIN-00175";
BaselineId = "{982a79a8-1c46-4fdf-8cfd-60afedf7ad96}";
OriginalBaselineId = "{9c2bc3d1-8668-48e5-ac5f-281718d52174}";
Name = "Disable SMB v1 server";
Severity = "Critical";
Hive = "HKEY_LOCAL_MACHINE";
Path = "SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters";
Value = "SMB1";
Type = "REG_DWORD";
ExpectedValue = "0";
RemediateValue = "0";
Remediate = true;
AnalyzeOperation = "EQUALSORNOTEXISTS";
ServerTypeFilter = "ServerType = [Domain Controller, Domain Member, Workgroup Member]";
OSFilter = "OSVersion = [WS2008, WS2008R2, WS2012, WS2012R2, WS2016]";
Enabled = true;
ResourceID = "Disable SMB v1 server";
ModuleName = "AzureOSBaseline";
ModuleVersion = "1.0";
ConfigurationName = "AzureOSBaseline";
};
Here's what it could look like in DSCv3:
name: Disable SMB v1 server
type: Microsoft.DSC/Policy
properties:
audit:
resource:
type: Microsoft.Windows/Registry
properties:
keyPath: HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
valueName: SMB1
expected:
valueData:
DWord: 0
analyzeOperation: EqualsOrNotExist
remediation:
apply:
_exist: false
In this example if the SMB1 property exists or doesn't equal 0, then the remediation is to delete it.
Proposed technical implementation details (optional)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked Azure policy example at samples/GuestConfiguration/package-samples/configurations/AzureWindowsBaseline/AzureWindowsBaseline.mof and compare it with the proposed DSCv3 YAML shape. Done means DSCv3 supports a policy resource that delegates get and set behavior while defining custom audit and remediation logic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100