Skip to content

Policy resource #558

@SteveL-MSFT

Description

@SteveL-MSFT

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions