Skip to content

Commit 5f03547

Browse files
authored
Merge pull request #125 from ansible-lockdown/devel
Release to main
2 parents 68ce732 + c10bca7 commit 5f03547

26 files changed

+339
-213
lines changed

.github/workflows/devel_pipeline_validation.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
3030
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
3131
32-
# This workflow contains a single job which tests the playbook
32+
# This workflow contains a single job that tests the playbook
3333
playbook-test:
3434
# The type of runner that the job will run on
3535
runs-on: ubuntu-latest
@@ -44,13 +44,13 @@
4444

4545
steps:
4646
- name: Clone ${{ github.event.repository.name }}
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848
with:
4949
ref: ${{ github.event.pull_request.head.sha }}
5050

5151
# Pull in terraform code for linux servers
52-
- name: Clone github IaC plan
53-
uses: actions/checkout@v3
52+
- name: Clone GitHub IaC plan
53+
uses: actions/checkout@v4
5454
with:
5555
repository: ansible-lockdown/github_linux_IaC
5656
path: .github/workflows/github_linux_IaC
@@ -74,23 +74,23 @@
7474
pwd
7575
ls
7676
env:
77-
# Imported from github variables this is used to load the relvent OS.tfvars file
77+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
7878
OSVAR: ${{ vars.OSVAR }}
7979
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
8080

8181
- name: Terraform_Init
8282
id: init
8383
run: terraform init
8484
env:
85-
# Imported from github variables this is used to load the relvent OS.tfvars file
85+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
8686
OSVAR: ${{ vars.OSVAR }}
8787
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
8888

8989
- name: Terraform_Validate
9090
id: validate
9191
run: terraform validate
9292
env:
93-
# Imported from github variables this is used to load the relvent OS.tfvars file
93+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
9494
OSVAR: ${{ vars.OSVAR }}
9595
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
9696

@@ -111,9 +111,9 @@
111111
# Aws deployments taking a while to come up insert sleep or playbook fails
112112

113113
- name: Sleep for 60 seconds
114-
run: sleep 60s
114+
run: sleep ${{ vars.BUILD_SLEEPTIME }}
115115

116-
# Run the ansible playbook
116+
# Run the Ansibleplaybook
117117
- name: Run_Ansible_Playbook
118118
uses: arillso/action.playbook@master
119119
with:

.github/workflows/main_pipeline_validation.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# that can run sequentially or in parallel
1919
jobs:
2020

21-
# This workflow contains a single job which tests the playbook
21+
# This workflow contains a single job that tests the playbook
2222
playbook-test:
2323
# The type of runner that the job will run on
2424
runs-on: ubuntu-latest
@@ -33,13 +33,13 @@
3333

3434
steps:
3535
- name: Clone ${{ github.event.repository.name }}
36-
uses: actions/checkout@v3
36+
uses: actions/checkout@v4
3737
with:
3838
ref: ${{ github.event.pull_request.head.sha }}
3939

4040
# Pull in terraform code for linux servers
41-
- name: Clone github IaC plan
42-
uses: actions/checkout@v3
41+
- name: Clone GitHub IaC plan
42+
uses: actions/checkout@v4
4343
with:
4444
repository: ansible-lockdown/github_linux_IaC
4545
path: .github/workflows/github_linux_IaC
@@ -63,23 +63,23 @@
6363
pwd
6464
ls
6565
env:
66-
# Imported from github variables this is used to load the relvent OS.tfvars file
66+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
6767
OSVAR: ${{ vars.OSVAR }}
6868
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
6969

7070
- name: Terraform_Init
7171
id: init
7272
run: terraform init
7373
env:
74-
# Imported from github variables this is used to load the relvent OS.tfvars file
74+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
7575
OSVAR: ${{ vars.OSVAR }}
7676
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
7777

7878
- name: Terraform_Validate
7979
id: validate
8080
run: terraform validate
8181
env:
82-
# Imported from github variables this is used to load the relvent OS.tfvars file
82+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
8383
OSVAR: ${{ vars.OSVAR }}
8484
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
8585

@@ -100,9 +100,9 @@
100100
# Aws deployments taking a while to come up insert sleep or playbook fails
101101

102102
- name: Sleep for 60 seconds
103-
run: sleep 60s
103+
run: sleep ${{ vars.BUILD_SLEEPTIME }}
104104

105-
# Run the ansible playbook
105+
# Run the Ansibleplaybook
106106
- name: Run_Ansible_Playbook
107107
uses: arillso/action.playbook@master
108108
with:
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
---
22

3-
# This is a basic workflow to help you get started with Actions
4-
53
name: update galaxy
64

7-
# Controls when the action will run.
8-
# Triggers the workflow on merge request events to the main branch
95
on:
106
push:
117
branches:
@@ -14,8 +10,10 @@ jobs:
1410
update_role:
1511
runs-on: ubuntu-latest
1612
steps:
17-
- uses: actions/checkout@v3
18-
- uses: robertdebock/galaxy-action@master
13+
- name: Checkout repo
14+
uses: actions/checkout@v4
15+
16+
- name: Action Ansible Galaxy Release ${{ github.ref_name }}
17+
uses: ansible-actions/ansible-galaxy-action@main
1918
with:
20-
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
21-
git_branch: main
19+
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ci:
77

88
repos:
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v3.2.0
10+
rev: v4.5.0
1111
hooks:
1212
# Safety
1313
- id: detect-aws-credentials
@@ -37,14 +37,14 @@ repos:
3737
exclude: .config/.gitleaks-report.json tasks/parse_etc_password
3838

3939
- repo: https://github.com/gitleaks/gitleaks
40-
rev: v8.17.0
40+
rev: v8.18.1
4141
hooks:
4242
- id: gitleaks
4343
args: ['--baseline-path', '.config/.gitleaks-report.json']
4444
exclude: .config/.secrets.baseline
4545

4646
- repo: https://github.com/ansible-community/ansible-lint
47-
rev: v6.17.2
47+
rev: v6.22.1
4848
hooks:
4949
- id: ansible-lint
5050
name: Ansible-lint
@@ -63,6 +63,6 @@ repos:
6363
- ansible-core>=2.10.1
6464

6565
- repo: https://github.com/adrienverge/yamllint.git
66-
rev: v1.32.0 # or higher tag
66+
rev: v1.33.0 # or higher tag
6767
hooks:
6868
- id: yamllint

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change log for Ubuntu 2004
22

3+
## v2.0.1 based upon CIS 2.0.1
4+
5+
- ability to run goss audit only audit_only variable
6+
- audit vars mainly move dto var/audit.yml
7+
- several control updates
8+
- goss version update to 0.4.4
9+
310
## V2.0 based upon CIS 2.0.1
411

512
- v2.0.1 - refer to change history from official CIS pdf.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
![followers](https://img.shields.io/github/followers/ansible-lockdown?style=social)
1111
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/AnsibleLockdown.svg?style=social&label=Follow%20%40AnsibleLockdown)](https://twitter.com/AnsibleLockdown)
1212

13-
![Ansible Galaxy Quality](https://img.shields.io/ansible/quality/54777?label=Quality&&logo=ansible)
1413
![Discord Badge](https://img.shields.io/discord/925818806838919229?logo=discord)
1514

1615
![Release Branch](https://img.shields.io/badge/Release%20Branch-Main-brightgreen)

collections/requirements.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
collections:
44
- name: community.general
5+
source: https://github.com/ansible-collections/community.general
6+
type: git
57

68
- name: community.crypto
9+
source: https://github.com/ansible-collections/community.crypto
10+
type: git
711

812
- name: ansible.posix
13+
source: https://github.com/ansible-collections/ansible.posix
14+
type: git

defaults/main.yml

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,53 @@ benchmark: UBUNTU20-CIS
1818
## metadata for Audit benchmark
1919
benchmark_version: 'v2.0.1'
2020

21-
### Audit Binary is required on the remote host
21+
##########################################
22+
### Goss is required on the remote host ###
23+
## Refer to vars/auditd.yml for any other settings ##
24+
25+
# Allow audit to setup the requirements including installing git (if option chosen and downloading and adding goss binary to system)
2226
setup_audit: false
27+
28+
# enable audits to run - this runs the audit and get the latest content
29+
run_audit: false
30+
31+
# Only run Audit do not remediate
32+
audit_only: false
33+
# As part of audit_only
34+
# This will enable files to be copied back to control node
35+
fetch_audit_files: false
36+
# Path to copy the files to will create dir structure
37+
audit_capture_files_dir: /some/location to copy to on control node
38+
2339
# How to retrieve audit binary
2440
# Options are copy or download - detailed settings at the bottom of this file
2541
# you will need to access to either github or the file already dowmloaded
2642
get_audit_binary_method: download
2743

44+
## if get_audit_binary_method - copy the following needs to be updated for your environment
45+
## it is expected that it will be copied from somewhere accessible to the control node
46+
## e.g copy from ansible control node to remote host
47+
audit_bin_copy_location: /some/accessible/path
48+
2849
# how to get audit files onto host options
2950
# options are git/copy/get_url other e.g. if you wish to run from already downloaded conf
3051
audit_content: git
3152

32-
# enable audits to run - this runs the audit and get the latest content
33-
run_audit: false
53+
# archive or copy:
54+
audit_conf_copy: "some path to copy from"
55+
56+
# get_url:
57+
audit_files_url: "some url maybe s3?"
3458

3559
# Run heavy tests - some tests can have more impact on a system enabling these can have greater impact on a system
3660
audit_run_heavy_tests: true
37-
# Timeout for those cmds that take longer to run where timeout set
38-
audit_cmd_timeout: 60000
3961

40-
### End Audit enablements ####
62+
# This variable specifies the timeout (in ms) for audit commands that
63+
# take a very long time: if a command takes too long to complete,
64+
# it will be forcefully terminated after the specified duration.
65+
audit_cmd_timeout: 120000
66+
67+
### End Goss enablements ####
4168

4269
# We've defined complexity-high to mean that we cannot automatically remediate
4370
# the rule in question. In the future this might mean that the remediation
@@ -415,7 +442,7 @@ ubtu20cis_dovecot_server: false
415442
ubtu20cis_smb_server: false
416443
ubtu20cis_squid_server: false
417444
ubtu20cis_snmp_server: false
418-
ubtu20cis_rsync_server: false
445+
ubtu20cis_rsync_server: mask # Can be set to true, mask or remove depending on requirements
419446
ubtu20cis_nis_server: false
420447
ubtu20cis_nfs_client: false
421448
# rpcbind is required by nfs-common which is required on client and server
@@ -467,15 +494,17 @@ ubtu20cis_aide_cron:
467494
aide_weekday: '*'
468495

469496
# Control 1.4.1
470-
# THIS VARIABLE SHOULD BE CHANGED
497+
# THESE VARIABLES SHOULD BE CHANGED
471498
# This will fail assertion if not changed and rule 1.4.2 is enabled
472499
# insert password as per output of running grub-mkpasswd-pbkdf2
473500
# refers to https://help.ubuntu.com/community/Grub2/Passwords
474501

502+
# You maybe changing the root password if grub user root - Ensure you understand the risks
503+
ubtu20cis_set_grub_user_password: false
504+
ubtu20cis_grub_user: root
505+
ubtu20cis_grub_user_passwd: '$y$j9T$MBA5l/tQyWifM869nQjsi.$cTy0ConcNjIYOn6Cppo5NAky20osrkRxz4fEWA8xac6' # Set to changeme
475506
ubtu20cis_set_boot_pass: false
476-
ubtu20cis_set_grub_password: true
477507
ubtu20cis_grub_user_file: /etc/grub.d/40_custom
478-
ubtu20cis_grub_user: root
479508
ubtu20cis_grub_file: /boot/grub/grub.cfg
480509

481510
# This is used to set the password in grub the full string is required.
@@ -739,51 +768,3 @@ ubtu20cis_sgid_adjust: false
739768
# Control 6.2.5 Allow ansible to adjust world-writable files. False will just display world-writable files, True will remove world-writable
740769
# ubtu20cis_passwd_label: "{{ (this_item | default(item)).id }}: {{ (this_item | default(item)).dir }}"
741770
ubtu20cis_passwd_label: "{{ (this_item | default(item)).id }}: {{ (this_item | default(item)).dir }}"
742-
743-
#### Audit Configuration Settings ####
744-
745-
### Audit binary settings ###
746-
audit_bin_version:
747-
release: v0.3.23
748-
checksum: 'sha256:9e9f24e25f86d6adf2e669a9ffbe8c3d7b9b439f5f877500dea02ba837e10e4d'
749-
audit_bin_path: /usr/local/bin/
750-
audit_bin: "{{ audit_bin_path }}goss"
751-
audit_format: json
752-
753-
# if get_audit_binary_method == download change accordingly
754-
audit_bin_url: "https://github.com/aelsabbahy/goss/releases/download/{{ audit_bin_version.release }}/goss-linux-amd64"
755-
756-
## if get_audit_binary_method - copy the following needs to be updated for your environment
757-
## it is expected that it will be copied from somewhere accessible to the control node
758-
## e.g copy from ansible control node to remote host
759-
audit_bin_copy_location: /some/accessible/path
760-
761-
### Goss Audit Benchmark file ###
762-
## managed by the control audit_content
763-
# git
764-
audit_file_git: "https://github.com/ansible-lockdown/{{ benchmark }}-Audit.git"
765-
audit_git_version: "benchmark_{{ benchmark_version }}"
766-
767-
# archive or copy:
768-
audit_conf_copy: "some path to copy from"
769-
770-
# get_url:
771-
audit_files_url: "some url maybe s3?"
772-
773-
## Goss configuration information
774-
# Where the goss configs and outputs are stored
775-
audit_out_dir: '/opt'
776-
# Where the goss audit configuration will be stored
777-
audit_conf_dir: "{{ audit_out_dir }}/{{ benchmark }}-Audit/"
778-
779-
# If changed these can affect other products
780-
pre_audit_outfile: "{{ audit_out_dir }}/{{ ansible_hostname }}-{{ benchmark }}_pre_scan_{{ ansible_date_time.epoch }}.{{ audit_format }}"
781-
post_audit_outfile: "{{ audit_out_dir }}/{{ ansible_hostname }}-{{ benchmark }}_post_scan_{{ ansible_date_time.epoch }}.{{ audit_format }}"
782-
783-
## The following should not need changing
784-
audit_control_file: "{{ audit_conf_dir }}goss.yml"
785-
audit_vars_path: "{{ audit_conf_dir }}/vars/{{ ansible_hostname }}.yml"
786-
audit_results: |
787-
The pre remediation results are: {{ pre_audit_summary }}.
788-
The post remediation results are: {{ post_audit_summary }}.
789-
Full breakdown can be found in {{ audit_out_dir }}

0 commit comments

Comments
 (0)