Skip to content

Commit 2e4f4b5

Browse files
1.0.0 release (#4)
* Push gem installer class. * added notify * Push updated spec test * psuh docs changes. * Update readme * Push with github actions * Update readme * Readme updates
1 parent d6df9bb commit 2e4f4b5

19 files changed

+318
-160
lines changed

.github/workflows/lint.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: "Lint testing"
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- "main"
8+
9+
jobs:
10+
setup_matrix:
11+
name: "Setup Test Matrix"
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
matrix: ${{ steps.get-matrix.outputs.matrix }}
15+
16+
steps:
17+
- name: Checkout Source
18+
uses: actions/checkout@v3
19+
20+
- name: Activate Ruby 3.2
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.2.3"
24+
bundler-cache: true
25+
26+
- name: Print bundle environment
27+
run: |
28+
echo ::group::bundler environment
29+
bundle env
30+
echo ::endgroup::
31+
32+
- name: Setup Integration Test Matrix
33+
id: get-matrix
34+
run: |
35+
echo "matrix=$(cat test_matrix.json | tr -s '\n' ' ')" >> $GITHUB_OUTPUT
36+
cat $GITHUB_OUTPUT
37+
38+
lint:
39+
name: "Lint tests (${{matrix.collection.agent_version}})"
40+
needs:
41+
- setup_matrix
42+
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
43+
44+
runs-on: ubuntu-22.04
45+
strategy:
46+
fail-fast: false
47+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
48+
49+
env:
50+
PUPPET_GEM_VERSION: ${{matrix.collection.gem_version}}
51+
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?
52+
53+
steps:
54+
- name: Checkout Source
55+
uses: actions/checkout@v3
56+
57+
- name: Activate Ruby 3.2
58+
uses: ruby/setup-ruby@v1
59+
with:
60+
ruby-version: "3.2.3"
61+
bundler-cache: true
62+
63+
- name: Print bundle environment
64+
run: |
65+
echo ::group::bundler environment
66+
bundle env
67+
echo ::endgroup::
68+
69+
- name: "Run tests"
70+
run: |
71+
bundle exec rake validate

.github/workflows/unit_tests.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: "Unit Testing"
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- "main"
8+
9+
jobs:
10+
setup_matrix:
11+
name: "Setup Test Matrix"
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
matrix: ${{ steps.get-matrix.outputs.matrix }}
15+
16+
steps:
17+
- name: Checkout Source
18+
uses: actions/checkout@v3
19+
20+
- name: Activate Ruby 3.2
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.2.3"
24+
bundler-cache: true
25+
26+
- name: Print bundle environment
27+
run: |
28+
echo ::group::bundler environment
29+
bundle env
30+
echo ::endgroup::
31+
32+
- name: Setup Integration Test Matrix
33+
id: get-matrix
34+
run: |
35+
echo "matrix=$(cat test_matrix.json | tr -s '\n' ' ')" >> $GITHUB_OUTPUT
36+
cat $GITHUB_OUTPUT
37+
38+
Unit:
39+
name: "Unit tests (${{matrix.collection.agent_version}})"
40+
needs:
41+
- setup_matrix
42+
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
43+
44+
runs-on: ubuntu-22.04
45+
strategy:
46+
fail-fast: false
47+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
48+
49+
env:
50+
PUPPET_GEM_VERSION: ${{matrix.collection.gem_version}}
51+
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?.
52+
53+
steps:
54+
- name: Checkout Source
55+
uses: actions/checkout@v3
56+
57+
- name: Activate Ruby 3.2
58+
uses: ruby/setup-ruby@v1
59+
with:
60+
ruby-version: "3.2.3"
61+
bundler-cache: true
62+
63+
- name: Print bundle environment
64+
run: |
65+
echo ::group::bundler environment
66+
bundle env
67+
echo ::endgroup::
68+
69+
- name: "Run tests"
70+
run: |
71+
bundle exec rake parallel_spec

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log

.pdkignore

+8
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log
2936
/.fixtures.yml
3037
/Gemfile
3138
/.gitattributes
39+
/.github/
3240
/.gitignore
3341
/.pdkignore
3442
/.puppet-lint.rc

.rubocop.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ require:
33
- rubocop-performance
44
- rubocop-rspec
55
AllCops:
6+
NewCops: enable
67
DisplayCopNames: true
78
TargetRubyVersion: '2.6'
89
Include:
@@ -18,7 +19,6 @@ AllCops:
1819
- "**/Puppetfile"
1920
- "**/Vagrantfile"
2021
- "**/Guardfile"
21-
- spec/functions/*
2222
Layout/LineLength:
2323
Description: People have wide screens, use them.
2424
Max: 20000
@@ -194,8 +194,6 @@ Lint/MixedRegexpCaptureTypes:
194194
Enabled: false
195195
Lint/NestedPercentLiteral:
196196
Enabled: false
197-
Lint/Next:
198-
Enabled: false
199197
Lint/NonDeterministicRequireOrder:
200198
Enabled: false
201199
Lint/OrderedMagicComments:
@@ -222,8 +220,6 @@ Lint/SafeNavigationConsistency:
222220
Enabled: false
223221
Lint/SafeNavigationWithEmpty:
224222
Enabled: false
225-
Lint/SafeNavigation:
226-
Enabled: false
227223
Lint/SelfAssignment:
228224
Enabled: false
229225
Lint/SendWithMixinArgument:
@@ -532,6 +528,8 @@ Lint/DuplicateBranch:
532528
Enabled: false
533529
Lint/DuplicateMagicComment:
534530
Enabled: false
531+
Lint/DuplicateMatchPattern:
532+
Enabled: false
535533
Lint/DuplicateRegexpCharacterClassElement:
536534
Enabled: false
537535
Lint/EmptyBlock:
@@ -648,6 +646,8 @@ Style/ComparableClamp:
648646
Enabled: false
649647
Style/ConcatArrayLiterals:
650648
Enabled: false
649+
Style/DataInheritance:
650+
Enabled: false
651651
Style/DirEmpty:
652652
Enabled: false
653653
Style/DocumentDynamicEvalDefinition:
@@ -716,6 +716,8 @@ Style/RedundantHeredocDelimiterQuotes:
716716
Enabled: false
717717
Style/RedundantInitialize:
718718
Enabled: false
719+
Style/RedundantLineContinuation:
720+
Enabled: false
719721
Style/RedundantSelfAssignmentBranch:
720722
Enabled: false
721723
Style/RedundantStringEscape:

.vscode/extensions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
33
"puppet.puppet-vscode",
4-
"rebornix.Ruby"
4+
"Shopify.ruby-lsp"
55
]
66
}

Gemfile

+14-9
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,30 @@ group :development do
2222
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2323
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2424
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
25+
gem "deep_merge", '~> 1.2.2', require: false
2526
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
26-
gem "facterdb", '~> 1.18', require: false
27-
gem "metadata-json-lint", '~> 3.0', require: false
28-
gem "puppetlabs_spec_helper", '~> 6.0', require: false
29-
gem "rspec-puppet-facts", '~> 2.0', require: false
30-
gem "codecov", '~> 0.2', require: false
27+
gem "facterdb", '~> 2.1', require: false
28+
gem "metadata-json-lint", '~> 4.0', require: false
29+
gem "rspec-puppet-facts", '~> 4.0', require: false
3130
gem "dependency_checker", '~> 1.0.0', require: false
3231
gem "parallel_tests", '= 3.12.1', require: false
3332
gem "pry", '~> 0.10', require: false
34-
gem "simplecov-console", '~> 0.5', require: false
33+
gem "simplecov-console", '~> 0.9', require: false
3534
gem "puppet-debugger", '~> 1.0', require: false
36-
gem "rubocop", '= 1.48.1', require: false
35+
gem "rubocop", '~> 1.50.0', require: false
3736
gem "rubocop-performance", '= 1.16.0', require: false
3837
gem "rubocop-rspec", '= 2.19.0', require: false
3938
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
39+
gem "rexml", '>= 3.0.0', '< 3.2.7', require: false
40+
end
41+
group :development, :release_prep do
42+
gem "puppet-strings", '~> 4.0', require: false
43+
gem "puppetlabs_spec_helper", '~> 7.0', require: false
4044
end
4145
group :system_tests do
42-
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
43-
gem "serverspec", '~> 2.41', require: false
46+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
47+
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
48+
gem "serverspec", '~> 2.41', require: false
4449
end
4550

4651
puppet_version = ENV['PUPPET_GEM_VERSION']

README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
# applocker
22

3-
A Puppet module which configures applocker on Windows (Application whitelisting). For information about applocker see [here][2]
3+
A Puppet module which configures applocker on Windows (Application whitelisting). For information about applocker see [here][2].
44

55
## Setup requirements
66

7-
benjaminrobertson-applocker requires the xml-simple ruby gem installed on the Puppet Primary server. Install by running `puppetserver gem install xml-simple` as root on the Puppet Primary server. If the gem is not installed the module will not work.
7+
benjaminrobertson-applocker requires the xml-simple ruby gem installed on the Puppet Primary server, compilers and replica. The module will not function without this gem. It can be installed using the following methods.
88

9-
**Note:** When Puppet attempts to enable applocker service for the first time, this error will be seen in the Puppet logs. `Error: Cannot enable AppIDSvc, error was: undefined method 'windows' for Puppet::Util:Module` Applocker is running regardless of this error.
9+
### Via Puppet manifest
10+
11+
Applocker module since 1.0.0 includes a Puppet class to install the xml-simple gem on your Puppet infrastructure.
12+
13+
1. Within the PE console, navigate to "Node Groups".
14+
1. Locate the "PE Infrastructure Agent" node group and click into it. **Hint:** its under "All Nodes\PE Infrastructure\PE Agent".
15+
1. Under the classes tab, add the class "applocker::primary::gem_installer". Commit the change.
16+
1. Run Puppet on every PE infrastructure component. **Note:** This will restart the pe-puppetserver.
17+
18+
**Note:** The above instructions will only work if your Puppet Enterprise infrastructure has internet access or access to ruby gems.
19+
20+
### Manually via command line
21+
22+
1. Install by running `puppetserver gem install xml-simple` as root on the Puppet Primary server and other PE infrastructure components.
1023

1124
## Table of Contents
1225

@@ -29,6 +42,8 @@ benjaminrobertson-applocker configures Windows applocker service. Applocker enfo
2942

3043
I suggest applying applocker policies in 'AuditOnly' mode (modules default). Use Windows event viewer to check for unexpected applocker denies. [EventId's][3]
3144

45+
**Note:** When Puppet attempts to enable applocker service for the first time, this error will be seen in the Puppet logs. `Error: Cannot enable AppIDSvc, error was: undefined method 'windows' for Puppet::Util:Module` Applocker is running regardless of this error.
46+
3247
## Usage
3348

3449
Include applocker module in Puppet manifest.
@@ -255,7 +270,7 @@ Applocker rules can be enabled or disabled by setting Enum['Enabled','AuditOnly'
255270

256271
## Limitations
257272

258-
* Developed on Puppet Enterprise 2021.7.6 and Windows 2019
273+
* Developed and tested with Puppet Enterprise 2021.7.6, 2023.8.0 and Windows 2019 and 2022.
259274
* Expected to work with all modern versions of Puppet and Windows.
260275

261276
## Development

0 commit comments

Comments
 (0)