Skip to content

Commit 4284d11

Browse files
committed
Update pipeline templates
1 parent dcfa876 commit 4284d11

File tree

5 files changed

+47
-16
lines changed

5 files changed

+47
-16
lines changed

templates/AppLockerProject/.github/workflows/publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v1
1414
- name: Install Prerequisites
15-
run: .\build\vsts-prerequisites.ps1
15+
run: .\build\prerequisites.ps1 -BuildWorker -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1)
1616
shell: powershell
1717
- name: Validate Configuration Data
18-
run: .\build\vsts-validate.ps1 -TestType ConfigurationData
18+
run: .\build\validate.ps1 -TestType ConfigurationData -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
1919
shell: powershell
2020
- name: Build
21-
run: .\build\vsts-build.ps1 -IncludeRsop
21+
run: .\build\build.ps1 -IncludeRsop -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -SourcePath (Join-Path $env:GITHUB_WORKSPACE configurationdata) -OutputPath (Join-Path $env:GITHUB_WORKSPACE output)
2222
shell: powershell
2323
- uses: actions/upload-artifact@v3
2424
with:
2525
name: build-artifacts
2626
path: |
2727
.\output\rsop
2828
.\output\policies
29-
- name: Validate Integration Tests
30-
run: .\build\vsts-validate.ps1 -TestType Integration
31-
shell: powershell
3229
- name: Publish
33-
run: .\build\vsts-publish.ps1
30+
run: .\build\publish.ps1
31+
shell: powershell
32+
- name: Validate Integration Tests
33+
run: .\build\validate.ps1 -TestType Integration -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
3434
shell: powershell

templates/AppLockerProject/.github/workflows/validate.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ jobs:
88
steps:
99
- uses: actions/checkout@v1
1010
- name: Install Prerequisites
11-
run: .\build\vsts-prerequisites.ps1
11+
run: .\build\prerequisites.ps1 -BuildWorker -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1)
1212
shell: powershell
13-
- name: Validate
14-
run: .\build\vsts-validate.ps1 -TestType ConfigurationData
13+
- name: Validate Configuration Data
14+
run: .\build\validate.ps1 -TestType ConfigurationData -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
1515
shell: powershell
1616
- name: Build
17-
run: .\build\vsts-build.ps1 -IncludeRsop
17+
run: .\build\build.ps1 -IncludeRsop -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -SourcePath (Join-Path $env:GITHUB_WORKSPACE configurationdata) -OutputPath (Join-Path $env:GITHUB_WORKSPACE output)
1818
shell: powershell
1919
- uses: actions/upload-artifact@v3
2020
with:
2121
name: build-artifacts
2222
path: |
2323
.\output\rsop
24-
.\output\policies
24+
.\output\policies

templates/AppLockerProject/build/publish.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $modPath = Resolve-Path -Path $psdependConfig.PSDependOptions.Target
1212
$modOld = $env:PSModulePath
1313
$pathSeparator = [System.IO.Path]::PathSeparator
1414
$env:PSModulePath = "$modPath$pathSeparator$modOld"
15+
$rsops = Get-DatumRsopCache
1516

1617
foreach ($policy in (Get-ChildItem -Path (Join-Path -Path $OutputPath -ChildPath Policies) -Recurse -Filter *.xml))
1718
{
@@ -24,6 +25,12 @@ foreach ($policy in (Get-ChildItem -Path (Join-Path -Path $OutputPath -ChildPath
2425
$null = New-GPO -Name $policy.BaseName -Comment "Auto-updated applocker policy" -Domain $policy.Directory.Name
2526
}
2627

28+
$rsop = $rsops | Where-Object { $_.Name -eq $policy.BaseName }
29+
foreach ($link in $rsop.Links)
30+
{
31+
Set-GPLink -Name $rsop.PolicyName -Target $link.OrgUnitDn -LinkEnabled $link.Enabled -Enforced $link.Enforced -Order $link.Order -Domain $policy.Directory.Name -Confirm:0
32+
}
33+
2734
$policyFound = $searcher.FindOne()
2835

2936
Set-AppLockerPolicy -XmlPolicy $policy.FullName -Ldap $policyFound.Path
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
PolicyName: Pol1
2-
Domain: þdomainfqdnþ
1+
PolicyName: "[x={ $Node.Name }=]"
2+
Domain: "[x={ $File.Directory.BaseName } =]"
3+
Links:
4+
- OrgUnitDn: "OU=Prod,DC=contoso,DC=com"
5+
LinkOrder: 1
6+
Enforced: yes # unspecified, no
7+
Enabled: no # unspecified, yes
8+
- OrgUnitDn: "OU=Test,DC=contoso,DC=com"
9+
LinkOrder: 1
10+
Enforced: yes # unspecified, no
11+
Enabled: yes # unspecified, no
312
Apps:
413
- Git
5-
- Obs
14+
- Obs

templates/AppLockerProject/configurationdata/readme.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,22 @@ The idea is to describe content that is relevant for each domain.
2929
## Policies
3030

3131
Grouped by the domain, each policy should be a single yml file that contains
32-
the Name, Domain and subscribed Apps for that policy.
32+
the Name, Domain, optional GPLinks and subscribed Apps for that policy.
33+
34+
Through the use of Datum.InvokeCommand, we can run scripts during the build
35+
process, or rather: When generating the RSOP for the build.
36+
37+
```yaml
38+
PolicyName: "[x={ $Node.Name }=]"
39+
Domain: "[x={ $File.Directory.BaseName } =]"
40+
Links:
41+
- OrgUnitDn: "OU=Prod,DC=contoso,DC=com"
42+
LinkOrder: 1
43+
Enforced: yes # unspecified, no
44+
Enabled: no # unspecified, yes
45+
Apps:
46+
- Git
47+
```
3348

3449
## Generics
3550

0 commit comments

Comments
 (0)