forked from ansible-lockdown/RHEL9-CIS
Merge pull request #401 from ansible-lockdown/Oct25_updates
Oct25 updates
This commit is contained in:
commit
724a09f23d
13 changed files with 451 additions and 320 deletions
38
.github/workflows/benchmark_tracking_controller.yml
vendored
Normal file
38
.github/workflows/benchmark_tracking_controller.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# GitHub schedules all cron jobs in UTC.
|
||||||
|
# This expression will run the job every day at 9 AM Eastern Time during Daylight Saving Time (mid-March to early November).
|
||||||
|
# This expression will run the job every day at 8 AM Eastern Time during Standard Time (early November to mid-March).
|
||||||
|
|
||||||
|
name: Central Benchmark Orchestrator
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- latest
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *' # Runs daily at 9 AM ET
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
call-benchmark-tracker:
|
||||||
|
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_name == 'latest')
|
||||||
|
name: Start Benchmark Tracker
|
||||||
|
uses: ansible-lockdown/github_linux_IaC/.github/workflows/benchmark_track.yml@self_hosted
|
||||||
|
with:
|
||||||
|
repo_name: ${{ github.repository }}
|
||||||
|
secrets:
|
||||||
|
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
|
||||||
|
BADGE_PUSH_TOKEN: ${{ secrets.BADGE_PUSH_TOKEN }}
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
|
||||||
|
call-monitor-promotions:
|
||||||
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
|
name: Monitor Promotions and Auto-Promote
|
||||||
|
uses: ansible-lockdown/github_linux_IaC/.github/workflows/benchmark_promote.yml@self_hosted
|
||||||
|
with:
|
||||||
|
repo_name: ${{ github.repository }}
|
||||||
|
secrets:
|
||||||
|
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
|
||||||
|
BADGE_PUSH_TOKEN: ${{ secrets.BADGE_PUSH_TOKEN }}
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
242
.github/workflows/devel_pipeline_validation.yml
vendored
242
.github/workflows/devel_pipeline_validation.yml
vendored
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, reopened, synchronize]
|
types: [opened, reopened, synchronize]
|
||||||
branches:
|
branches:
|
||||||
- devel
|
- devel
|
||||||
- benchmark*
|
- benchmark*
|
||||||
paths:
|
paths:
|
||||||
- '**.yml'
|
- '**.yml'
|
||||||
- '**.sh'
|
- '**.sh'
|
||||||
- '**.j2'
|
- '**.j2'
|
||||||
- '**.ps1'
|
- '**.ps1'
|
||||||
- '**.cfg'
|
- '**.cfg'
|
||||||
# Allow manual running of workflow
|
# Allow manual running of workflow
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
@ -27,133 +27,131 @@
|
||||||
# that can run sequentially or in parallel
|
# that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
# This will create messages for first time contributers and direct them to the Discord server
|
# This will create messages for first time contributers and direct them to the Discord server
|
||||||
welcome:
|
welcome:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/first-interaction@main
|
- uses: actions/first-interaction@main
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
pr-message: |-
|
issue_message: |-
|
||||||
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
|
Congrats on opening your first issue and thank you for taking the time to help improve Ansible-Lockdown!
|
||||||
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
|
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
|
||||||
|
pr_message: |-
|
||||||
|
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
|
||||||
|
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
|
||||||
|
|
||||||
# This workflow contains a single job that tests the playbook
|
# This workflow contains a single job that tests the playbook
|
||||||
playbook-test:
|
playbook-test:
|
||||||
# The type of runner that the job will run on
|
# The type of runner that the job will run on
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
env:
|
env:
|
||||||
ENABLE_DEBUG: ${{ vars.ENABLE_DEBUG }}
|
ENABLE_DEBUG: ${{ vars.ENABLE_DEBUG }}
|
||||||
# Imported as a variable by terraform
|
# Imported as a variable by terraform
|
||||||
TF_VAR_repository: ${{ github.event.repository.name }}
|
TF_VAR_repository: ${{ github.event.repository.name }}
|
||||||
AWS_REGION: "us-east-1"
|
AWS_REGION: "us-east-1"
|
||||||
ANSIBLE_VERSION: ${{ vars.ANSIBLE_RUNNER_VERSION }}
|
ANSIBLE_VERSION: ${{ vars.ANSIBLE_RUNNER_VERSION }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: .github/workflows/github_linux_IaC
|
working-directory: .github/workflows/github_linux_IaC
|
||||||
# working-directory: .github/workflows
|
# working-directory: .github/workflows
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Git clone the lockdown repository to test
|
- name: Git clone the lockdown repository to test
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: If a variable for IAC_BRANCH is set use that branch
|
- name: If a variable for IAC_BRANCH is set use that branch
|
||||||
working-directory: .github/workflows
|
working-directory: .github/workflows
|
||||||
run: |
|
run: |
|
||||||
if [ ${{ vars.IAC_BRANCH }} != '' ]; then
|
if [ ${{ vars.IAC_BRANCH }} != '' ]; then
|
||||||
echo "IAC_BRANCH=${{ vars.IAC_BRANCH }}" >> $GITHUB_ENV
|
echo "IAC_BRANCH=${{ vars.IAC_BRANCH }}" >> $GITHUB_ENV
|
||||||
echo "Pipeline using the following IAC branch ${{ vars.IAC_BRANCH }}"
|
echo "Pipeline using the following IAC branch ${{ vars.IAC_BRANCH }}"
|
||||||
else
|
else
|
||||||
echo IAC_BRANCH=main >> $GITHUB_ENV
|
echo IAC_BRANCH=main >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pull in terraform code for linux servers
|
# Pull in terraform code for linux servers
|
||||||
- name: Clone GitHub IaC plan
|
- name: Clone GitHub IaC plan
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: ansible-lockdown/github_linux_IaC
|
repository: ansible-lockdown/github_linux_IaC
|
||||||
path: .github/workflows/github_linux_IaC
|
path: .github/workflows/github_linux_IaC
|
||||||
ref: ${{ env.IAC_BRANCH }}
|
ref: ${{ env.IAC_BRANCH }}
|
||||||
|
|
||||||
# Uses dedicated restricted role and policy to enable this only for this task
|
# Uses dedicated restricted role and policy to enable this only for this task
|
||||||
# No credentials are part of github for AWS auth
|
# No credentials are part of github for AWS auth
|
||||||
- name: configure aws credentials
|
- name: configure aws credentials
|
||||||
uses: aws-actions/configure-aws-credentials@main
|
uses: aws-actions/configure-aws-credentials@main
|
||||||
with:
|
with:
|
||||||
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
|
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
|
||||||
role-session-name: ${{ secrets.AWS_ROLE_SESSION }}
|
role-session-name: ${{ secrets.AWS_ROLE_SESSION }}
|
||||||
aws-region: ${{ env.AWS_REGION }}
|
aws-region: ${{ env.AWS_REGION }}
|
||||||
|
|
||||||
- name: DEBUG - Show IaC files
|
- name: DEBUG - Show IaC files
|
||||||
if: env.ENABLE_DEBUG == 'true'
|
if: env.ENABLE_DEBUG == 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "OSVAR = $OSVAR"
|
echo "OSVAR = $OSVAR"
|
||||||
echo "benchmark_type = $benchmark_type"
|
echo "benchmark_type = $benchmark_type"
|
||||||
echo "PRIVSUBNET_ID = $AWS_PRIVSUBNET_ID"
|
pwd
|
||||||
echo "VPC_ID" = $AWS_VPC_SECGRP_ID"
|
env:
|
||||||
pwd
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
ls
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
env:
|
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
|
||||||
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
|
||||||
PRIVSUBNET_ID: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
|
||||||
VPC_ID: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
|
||||||
|
|
||||||
- name: Tofu init
|
- name: Tofu init
|
||||||
id: init
|
id: init
|
||||||
run: tofu init
|
run: tofu init
|
||||||
env:
|
env:
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
|
|
||||||
- name: Tofu validate
|
- name: Tofu validate
|
||||||
id: validate
|
id: validate
|
||||||
run: tofu validate
|
run: tofu validate
|
||||||
env:
|
env:
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
|
|
||||||
- name: Tofu apply
|
- name: Tofu apply
|
||||||
id: apply
|
id: apply
|
||||||
env:
|
env:
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
||||||
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
||||||
run: tofu apply -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
run: tofu apply -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
||||||
|
|
||||||
## Debug Section
|
## Debug Section
|
||||||
- name: DEBUG - Show Ansible hostfile
|
- name: DEBUG - Show Ansible hostfile
|
||||||
if: env.ENABLE_DEBUG == 'true'
|
if: env.ENABLE_DEBUG == 'true'
|
||||||
run: cat hosts.yml
|
run: cat hosts.yml
|
||||||
|
|
||||||
# Aws deployments taking a while to come up insert sleep or playbook fails
|
# Aws deployments taking a while to come up insert sleep or playbook fails
|
||||||
|
|
||||||
- name: Sleep to allow system to come up
|
- name: Sleep to allow system to come up
|
||||||
run: sleep ${{ vars.BUILD_SLEEPTIME }}
|
run: sleep ${{ vars.BUILD_SLEEPTIME }}
|
||||||
|
|
||||||
# Run the Ansible playbook
|
# Run the Ansible playbook
|
||||||
- name: Run_Ansible_Playbook
|
- name: Run_Ansible_Playbook
|
||||||
env:
|
env:
|
||||||
ANSIBLE_HOST_KEY_CHECKING: "false"
|
ANSIBLE_HOST_KEY_CHECKING: "false"
|
||||||
ANSIBLE_DEPRECATION_WARNINGS: "false"
|
ANSIBLE_DEPRECATION_WARNINGS: "false"
|
||||||
run: |
|
run: |
|
||||||
/opt/ansible_${{ env.ANSIBLE_VERSION }}_venv/bin/ansible-playbook -i hosts.yml --private-key ~/.ssh/le_runner ../../../site.yml
|
/opt/ansible_${{ env.ANSIBLE_VERSION }}_venv/bin/ansible-playbook -i hosts.yml --private-key ~/.ssh/le_runner ../../../site.yml
|
||||||
|
|
||||||
# Remove test system - User secrets to keep if necessary
|
# Remove test system - User secrets to keep if necessary
|
||||||
|
|
||||||
- name: Tofu Destroy
|
- name: Tofu Destroy
|
||||||
if: always() && env.ENABLE_DEBUG == 'false'
|
if: always() && env.ENABLE_DEBUG == 'false'
|
||||||
env:
|
env:
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
||||||
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
||||||
run: tofu destroy -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
run: tofu destroy -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
||||||
|
|
|
||||||
27
.github/workflows/export_badges_private.yml
vendored
Normal file
27
.github/workflows/export_badges_private.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Export Private Repo Badges
|
||||||
|
|
||||||
|
# Use different minute offsets with the same hourly pattern:
|
||||||
|
# Repo Group Suggested Cron Expression Explanation
|
||||||
|
# Group A 0 */6 * * * Starts at top of hour
|
||||||
|
# Group B 10 */6 * * * Starts at 10 after
|
||||||
|
# And So On
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- latest
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */6 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
export-badges:
|
||||||
|
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && startsWith(github.repository, 'ansible-lockdown/Private-')) || (github.event_name == 'push' && github.ref_name == 'latest')
|
||||||
|
uses: ansible-lockdown/github_linux_IaC/.github/workflows/export_badges_private.yml@self_hosted
|
||||||
|
with:
|
||||||
|
# Full org/repo path passed for GitHub API calls (e.g., ansible-lockdown/Private-Windows-2016-CIS)
|
||||||
|
repo_name: ${{ github.repository }}
|
||||||
|
secrets:
|
||||||
|
BADGE_PUSH_TOKEN: ${{ secrets.BADGE_PUSH_TOKEN }}
|
||||||
19
.github/workflows/export_badges_public.yml
vendored
Normal file
19
.github/workflows/export_badges_public.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Export Public Repo Badges
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- devel
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
export-badges:
|
||||||
|
if: github.repository_visibility == 'public' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref_name == 'devel' || github.ref_name == 'main')))
|
||||||
|
uses: ansible-lockdown/github_linux_IaC/.github/workflows/export_badges_public.yml@self_hosted
|
||||||
|
with:
|
||||||
|
repo_name: ${{ github.repository }}
|
||||||
|
secrets:
|
||||||
|
BADGE_PUSH_TOKEN: ${{ secrets.BADGE_PUSH_TOKEN }}
|
||||||
223
.github/workflows/main_pipeline_validation.yml
vendored
223
.github/workflows/main_pipeline_validation.yml
vendored
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, reopened, synchronize]
|
types: [opened, reopened, synchronize]
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- latest
|
- latest
|
||||||
paths:
|
paths:
|
||||||
- '**.yml'
|
- '**.yml'
|
||||||
- '**.sh'
|
- '**.sh'
|
||||||
- '**.j2'
|
- '**.j2'
|
||||||
- '**.ps1'
|
- '**.ps1'
|
||||||
- '**.cfg'
|
- '**.cfg'
|
||||||
|
|
||||||
# Allow permissions for AWS auth
|
# Allow permissions for AWS auth
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -24,123 +24,118 @@
|
||||||
# A workflow run is made up of one or more jobs
|
# A workflow run is made up of one or more jobs
|
||||||
# that can run sequentially or in parallel
|
# that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
|
# This workflow contains a single job that tests the playbook
|
||||||
|
playbook-test:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: self-hosted
|
||||||
|
env:
|
||||||
|
ENABLE_DEBUG: ${{ vars.ENABLE_DEBUG }}
|
||||||
|
# Imported as a variable by terraform
|
||||||
|
TF_VAR_repository: ${{ github.event.repository.name }}
|
||||||
|
AWS_REGION : "us-east-1"
|
||||||
|
ANSIBLE_VERSION: ${{ vars.ANSIBLE_RUNNER_VERSION }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflows/github_linux_IaC
|
||||||
|
# working-directory: .github/workflows
|
||||||
|
|
||||||
# This workflow contains a single job that tests the playbook
|
steps:
|
||||||
playbook-test:
|
|
||||||
# The type of runner that the job will run on
|
|
||||||
runs-on: self-hosted
|
|
||||||
env:
|
|
||||||
ENABLE_DEBUG: ${{ vars.ENABLE_DEBUG }}
|
|
||||||
# Imported as a variable by terraform
|
|
||||||
TF_VAR_repository: ${{ github.event.repository.name }}
|
|
||||||
AWS_REGION : "us-east-1"
|
|
||||||
ANSIBLE_VERSION: ${{ vars.ANSIBLE_RUNNER_VERSION }}
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
working-directory: .github/workflows/github_linux_IaC
|
|
||||||
# working-directory: .github/workflows
|
|
||||||
|
|
||||||
steps:
|
- name: Git clone the lockdown repository to test
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Git clone the lockdown repository to test
|
- name: If a variable for IAC_BRANCH is set use that branch
|
||||||
uses: actions/checkout@v4
|
working-directory: .github/workflows
|
||||||
with:
|
run: |
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
if [ ${{ vars.IAC_BRANCH }} != '' ]; then
|
||||||
|
echo "IAC_BRANCH=${{ vars.IAC_BRANCH }}" >> $GITHUB_ENV
|
||||||
|
echo "Pipeline using the following IAC branch ${{ vars.IAC_BRANCH }}"
|
||||||
|
else
|
||||||
|
echo IAC_BRANCH=main >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: If a variable for IAC_BRANCH is set use that branch
|
# Pull in terraform code for linux servers
|
||||||
working-directory: .github/workflows
|
- name: Clone GitHub IaC plan
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
if [ ${{ vars.IAC_BRANCH }} != '' ]; then
|
with:
|
||||||
echo "IAC_BRANCH=${{ vars.IAC_BRANCH }}" >> $GITHUB_ENV
|
repository: ansible-lockdown/github_linux_IaC
|
||||||
echo "Pipeline using the following IAC branch ${{ vars.IAC_BRANCH }}"
|
path: .github/workflows/github_linux_IaC
|
||||||
else
|
ref: ${{ env.IAC_BRANCH }}
|
||||||
echo IAC_BRANCH=main >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pull in terraform code for linux servers
|
# Uses dedicated restricted role and policy to enable this only for this task
|
||||||
- name: Clone GitHub IaC plan
|
# No credentials are part of github for AWS auth
|
||||||
uses: actions/checkout@v4
|
- name: configure aws credentials
|
||||||
with:
|
uses: aws-actions/configure-aws-credentials@main
|
||||||
repository: ansible-lockdown/github_linux_IaC
|
with:
|
||||||
path: .github/workflows/github_linux_IaC
|
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
|
||||||
ref: ${{ env.IAC_BRANCH }}
|
role-session-name: ${{ secrets.AWS_ROLE_SESSION }}
|
||||||
|
aws-region: ${{ env.AWS_REGION }}
|
||||||
|
|
||||||
# Uses dedicated restricted role and policy to enable this only for this task
|
- name: DEBUG - Show IaC files
|
||||||
# No credentials are part of github for AWS auth
|
if: env.ENABLE_DEBUG == 'true'
|
||||||
- name: configure aws credentials
|
run: |
|
||||||
uses: aws-actions/configure-aws-credentials@main
|
echo "OSVAR = $OSVAR"
|
||||||
with:
|
echo "benchmark_type = $benchmark_type"
|
||||||
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
|
pwd
|
||||||
role-session-name: ${{ secrets.AWS_ROLE_SESSION }}
|
ls
|
||||||
aws-region: ${{ env.AWS_REGION }}
|
env:
|
||||||
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
|
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
|
|
||||||
- name: DEBUG - Show IaC files
|
- name: Tofu init
|
||||||
if: env.ENABLE_DEBUG == 'true'
|
id: init
|
||||||
run: |
|
run: tofu init
|
||||||
echo "OSVAR = $OSVAR"
|
env:
|
||||||
echo "benchmark_type = $benchmark_type"
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
echo "PRIVSUBNET_ID = $AWS_PRIVSUBNET_ID"
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
echo "VPC_ID" = $AWS_VPC_SECGRP_ID"
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
pwd
|
|
||||||
ls
|
|
||||||
env:
|
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
|
||||||
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
|
||||||
PRIVSUBNET_ID: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
|
||||||
VPC_ID: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
|
||||||
|
|
||||||
- name: Tofu init
|
- name: Tofu validate
|
||||||
id: init
|
id: validate
|
||||||
run: tofu init
|
run: tofu validate
|
||||||
env:
|
env:
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
|
|
||||||
- name: Tofu validate
|
- name: Tofu apply
|
||||||
id: validate
|
id: apply
|
||||||
run: tofu validate
|
env:
|
||||||
env:
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
||||||
|
run: tofu apply -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
||||||
- name: Tofu apply
|
|
||||||
id: apply
|
|
||||||
env:
|
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
|
||||||
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
|
||||||
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
|
||||||
run: tofu apply -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
|
||||||
|
|
||||||
## Debug Section
|
## Debug Section
|
||||||
- name: DEBUG - Show Ansible hostfile
|
- name: DEBUG - Show Ansible hostfile
|
||||||
if: env.ENABLE_DEBUG == 'true'
|
if: env.ENABLE_DEBUG == 'true'
|
||||||
run: cat hosts.yml
|
run: cat hosts.yml
|
||||||
|
|
||||||
# Aws deployments taking a while to come up insert sleep or playbook fails
|
# Aws deployments taking a while to come up insert sleep or playbook fails
|
||||||
|
|
||||||
- name: Sleep to allow system to come up
|
- name: Sleep to allow system to come up
|
||||||
run: sleep ${{ vars.BUILD_SLEEPTIME }}
|
run: sleep ${{ vars.BUILD_SLEEPTIME }}
|
||||||
|
|
||||||
# Run the Ansible playbook
|
# Run the Ansible playbook
|
||||||
- name: Run_Ansible_Playbook
|
- name: Run_Ansible_Playbook
|
||||||
env:
|
env:
|
||||||
ANSIBLE_HOST_KEY_CHECKING: "false"
|
ANSIBLE_HOST_KEY_CHECKING: "false"
|
||||||
ANSIBLE_DEPRECATION_WARNINGS: "false"
|
ANSIBLE_DEPRECATION_WARNINGS: "false"
|
||||||
run: |
|
run: |
|
||||||
/opt/ansible_${{ env.ANSIBLE_VERSION }}_venv/bin/ansible-playbook -i hosts.yml --private-key ~/.ssh/le_runner ../../../site.yml
|
/opt/ansible_${{ env.ANSIBLE_VERSION }}_venv/bin/ansible-playbook -i hosts.yml --private-key ~/.ssh/le_runner ../../../site.yml
|
||||||
|
|
||||||
# Remove test system - User secrets to keep if necessary
|
# Remove test system - User secrets to keep if necessary
|
||||||
|
|
||||||
- name: Tofu Destroy
|
- name: Tofu Destroy
|
||||||
if: always() && env.ENABLE_DEBUG == 'false'
|
if: always() && env.ENABLE_DEBUG == 'false'
|
||||||
env:
|
env:
|
||||||
OSVAR: ${{ vars.OSVAR }}
|
OSVAR: ${{ vars.OSVAR }}
|
||||||
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
|
||||||
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
|
||||||
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
|
||||||
run: tofu destroy -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
run: tofu destroy -var-file "${OSVAR}.tfvars" --auto-approve -input=false
|
||||||
|
|
|
||||||
11
Changelog.md
11
Changelog.md
|
|
@ -1,5 +1,16 @@
|
||||||
# Changes to rhel9CIS
|
# Changes to rhel9CIS
|
||||||
|
|
||||||
|
|
||||||
|
## 2.0.4 - Based on CIS v2.0.0
|
||||||
|
|
||||||
|
- addressed issue #393 thank you to @fragglexarmy
|
||||||
|
- addressed issue #394 thank you to @dbeuker
|
||||||
|
- addressed issues #390 and #391 thanks to @polski-g
|
||||||
|
- addressed issue #398 & #399 thanks to trumbaut
|
||||||
|
- Added max-concurrent options for audit
|
||||||
|
- work flow updates
|
||||||
|
- audit logic improvements
|
||||||
|
|
||||||
## 2.0.3 - Based on CIS v2.0.0
|
## 2.0.3 - Based on CIS v2.0.0
|
||||||
- addressed issue #387, thank you @fragglexarmy
|
- addressed issue #387, thank you @fragglexarmy
|
||||||
- addressed issue #382 to improve regex logic on 5.4.2.4
|
- addressed issue #382 to improve regex logic on 5.4.2.4
|
||||||
|
|
|
||||||
196
README.md
196
README.md
|
|
@ -6,62 +6,96 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Public Repository 📣
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
[](https://twitter.com/AnsibleLockdown)
|
[](https://twitter.com/AnsibleLockdown)
|
||||||
|
|
||||||

|
|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Lint & Pre-Commit Tools 🔧
|
||||||
|
|
||||||
|
[](https://results.pre-commit.ci/latest/github/ansible-lockdown/RHEL9-CIS/devel)
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
## Community Release Information 📂
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
[](https://github.com/ansible-lockdown/RHEL9-CIS/actions/workflows/main_pipeline_validation.yml)
|
[](https://github.com/ansible-lockdown/RHEL9-CIS/actions/workflows/main_pipeline_validation.yml)
|
||||||
|
|
||||||
[](https://github.com/ansible-lockdown/RHEL9-CIS/actions/workflows/devel_pipeline_validation.yml)
|
[](https://github.com/ansible-lockdown/RHEL9-CIS/actions/workflows/devel_pipeline_validation.yml)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||

|

|
||||||

|
|
||||||

|

|
||||||
[](https://github.com/pre-commit/pre-commit)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Community
|
## Subscriber Release Information 🔐
|
||||||
|
|
||||||
Join us on our [Discord Server](https://www.lockdownenterprise.com/discord) to ask questions, discuss features, or just chat with other Ansible-Lockdown users.
|

|
||||||
|

|
||||||
|
|
||||||
|
[](https://github.com/ansible-lockdown/Private-RHEL9-CIS/actions/workflows/main_pipeline_validation.yml)
|
||||||
|
[](https://github.com/ansible-lockdown/Private-RHEL9-CIS/actions/workflows/main_pipeline_validation_gpo.yml)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Caution(s)
|
## Looking for support? 🤝
|
||||||
|
|
||||||
|
[Lockdown Enterprise](https://www.lockdownenterprise.com#GH_AL_RHEL9-CIS)
|
||||||
|
|
||||||
|
[Ansible support](https://www.mindpointgroup.com/cybersecurity-products/ansible-counselor#GH_AL_RHEL9-CIS)
|
||||||
|
|
||||||
|
### Community 💬
|
||||||
|
|
||||||
|
On our [Discord Server](https://www.lockdownenterprise.com/discord) to ask questions, discuss features, or just chat with other Ansible-Lockdown users
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚨 Caution(s) 🚨
|
||||||
|
|
||||||
This role **will make changes to the system** which may have unintended consequences. This is not an auditing tool but rather a remediation tool to be used after an audit has been conducted.
|
This role **will make changes to the system** which may have unintended consequences. This is not an auditing tool but rather a remediation tool to be used after an audit has been conducted.
|
||||||
|
|
||||||
- Testing is the most important thing you can do.
|
- Testing is the most important thing you can do.
|
||||||
|
|
||||||
- Check Mode is not supported! The role will complete in check mode without errors, but it is not supported and should be used with caution. The RHEL9-CIS-Audit role or a compliance scanner should be used for compliance checking over check mode.
|
- Check Mode is not guaranteed! 🚫 The role will complete in check mode without errors, but it is not supported and should be used with caution.
|
||||||
|
|
||||||
- This role was developed against a clean install of the Operating System. If you are implementing to an existing system please review this role for any site specific changes that are needed.
|
- This role was developed against a clean install of the Operating System. If you are implementing to an existing system please review this role for any site specific changes that are needed.
|
||||||
|
|
||||||
- To use release version please point to main branch and relevant release/tag for the cis benchmark you wish to work with.
|
- To use release version please point to main branch and relevant release for the cis benchmark you wish to work with.
|
||||||
|
|
||||||
- If moving across major releases e.g. v2.0.0 - v3.0.0 there are significant changes to the benchmarks and controls it is suggested to start as a new standard not to upgrade.
|
|
||||||
|
|
||||||
- Containers references vars/is_container.yml this is an example and to be updated for your requirements
|
|
||||||
|
|
||||||
- Did we mention testing??
|
- Did we mention testing??
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Coming From A Previous Release ⏪
|
||||||
|
|
||||||
|
CIS release always contains changes, it is highly recommended to review the new references and available variables. This have changed significantly since ansible-lockdown initial release.
|
||||||
|
This is now compatible with python3 if it is found to be the default interpreter. This does come with pre-requisites which it configures the system accordingly.
|
||||||
|
|
||||||
|
Further details can be seen in the [Changelog](./ChangeLog.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Matching a security Level for CIS
|
## Matching a security Level for CIS
|
||||||
|
|
||||||
It is possible to to only run level 1 or level 2 controls for CIS.
|
It is possible to only run level 1 or level 2 controls for CIS.
|
||||||
This is managed using tags:
|
This is managed using tags:
|
||||||
|
|
||||||
- level1-server
|
- level1-server
|
||||||
|
|
@ -71,14 +105,34 @@ This is managed using tags:
|
||||||
|
|
||||||
The control found in defaults main also need to reflect this as this control the testing that takes place if you are using the audit component.
|
The control found in defaults main also need to reflect this as this control the testing that takes place if you are using the audit component.
|
||||||
|
|
||||||
## Coming from a previous release
|
---
|
||||||
|
## Requirements ✅
|
||||||
|
|
||||||
CIS release always contains changes, it is highly recommended to review the new references and available variables. This have changed significantly since ansible-lockdown initial release.
|
**General:**
|
||||||
This is now compatible with python3 if it is found to be the default interpreter. This does come with pre-requisites which it configures the system accordingly.
|
|
||||||
|
|
||||||
Further details can be seen in the [Changelog](./Changelog.md)
|
- Basic knowledge of Ansible, below are some links to the Ansible documentation to help get started if you are unfamiliar with Ansible
|
||||||
|
|
||||||
## Auditing (new)
|
- [Main Ansible documentation page](https://docs.ansible.com)
|
||||||
|
- [Ansible Getting Started](https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html)
|
||||||
|
- [Tower User Guide](https://docs.ansible.com/ansible-tower/latest/html/userguide/index.html)
|
||||||
|
- [Ansible Community Info](https://docs.ansible.com/ansible/latest/community/index.html)
|
||||||
|
- Functioning Ansible and/or Tower Installed, configured, and running. This includes all of the base Ansible/Tower configurations, needed packages installed, and infrastructure setup.
|
||||||
|
- Please read through the tasks in this role to gain an understanding of what each control is doing. Some of the tasks are disruptive and can have unintended consequences in a live production system. Also familiarize yourself with the variables in the defaults/main.yml file.
|
||||||
|
|
||||||
|
**Technical Dependencies:**
|
||||||
|
|
||||||
|
RHEL Family OS 9
|
||||||
|
|
||||||
|
- Access to download or add the goss binary and content to the system if using auditing
|
||||||
|
(other options are available on how to get the content to the system.)
|
||||||
|
- Python3.8
|
||||||
|
- Ansible 2.12+
|
||||||
|
- python-def
|
||||||
|
- libselinux-python
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Auditing 🔍
|
||||||
|
|
||||||
This can be turned on or off within the defaults/main.yml file with the variable run_audit. The value is false by default, please refer to the wiki for more details. The defaults file also populates the goss checks to check only the controls that have been enabled in the ansible role.
|
This can be turned on or off within the defaults/main.yml file with the variable run_audit. The value is false by default, please refer to the wiki for more details. The defaults file also populates the goss checks to check only the controls that have been enabled in the ansible role.
|
||||||
|
|
||||||
|
|
@ -109,7 +163,7 @@ PLAY RECAP *********************************************************************
|
||||||
default : ok=270 changed=23 unreachable=0 failed=0 skipped=140 rescued=0 ignored=0
|
default : ok=270 changed=23 unreachable=0 failed=0 skipped=140 rescued=0 ignored=0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation 📖
|
||||||
|
|
||||||
- [Read The Docs](https://ansible-lockdown.readthedocs.io/en/latest/)
|
- [Read The Docs](https://ansible-lockdown.readthedocs.io/en/latest/)
|
||||||
- [Getting Started](https://www.lockdownenterprise.com/docs/getting-started-with-lockdown#GH_AL_RH9_cis)
|
- [Getting Started](https://www.lockdownenterprise.com/docs/getting-started-with-lockdown#GH_AL_RH9_cis)
|
||||||
|
|
@ -117,38 +171,32 @@ default : ok=270 changed=23 unreachable=0 failed=0 s
|
||||||
- [Per-Host Configuration](https://www.lockdownenterprise.com/docs/per-host-lockdown-enterprise-configuration#GH_AL_RH9_cis)
|
- [Per-Host Configuration](https://www.lockdownenterprise.com/docs/per-host-lockdown-enterprise-configuration#GH_AL_RH9_cis)
|
||||||
- [Getting the Most Out of the Role](https://www.lockdownenterprise.com/docs/get-the-most-out-of-lockdown-enterprise#GH_AL_RH9_cis)
|
- [Getting the Most Out of the Role](https://www.lockdownenterprise.com/docs/get-the-most-out-of-lockdown-enterprise#GH_AL_RH9_cis)
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
**General:**
|
|
||||||
|
|
||||||
- Basic knowledge of Ansible, below are some links to the Ansible documentation to help get started if you are unfamiliar with Ansible
|
|
||||||
|
|
||||||
- [Main Ansible documentation page](https://docs.ansible.com)
|
|
||||||
- [Ansible Getting Started](https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html)
|
|
||||||
- [Tower User Guide](https://docs.ansible.com/ansible-tower/latest/html/userguide/index.html)
|
|
||||||
- [Ansible Community Info](https://docs.ansible.com/ansible/latest/community/index.html)
|
|
||||||
- Functioning Ansible and/or Tower Installed, configured, and running. This includes all of the base Ansible/Tower configurations, needed packages installed, and infrastructure setup.
|
|
||||||
- Please read through the tasks in this role to gain an understanding of what each control is doing. Some of the tasks are disruptive and can have unintended consequences in a live production system. Also familiarize yourself with the variables in the defaults/main.yml file.
|
|
||||||
|
|
||||||
**Technical Dependencies:**
|
|
||||||
|
|
||||||
RHEL/AlmaLinux/Rocky/Oracle 9 - Other versions are not supported.
|
|
||||||
|
|
||||||
- Access to download or add the goss binary and content to the system if using auditing
|
|
||||||
(other options are available on how to get the content to the system.)
|
|
||||||
- Python3.8
|
|
||||||
- Ansible 2.12+
|
|
||||||
- python-def
|
|
||||||
- libselinux-python
|
|
||||||
|
|
||||||
## Role Variables
|
## Role Variables
|
||||||
|
|
||||||
This role is designed that the end user should not have to edit the tasks themselves. All customizing should be done via the defaults/main.yml file or with extra vars within the project, job, workflow, etc.
|
This role is designed that the end user should not have to edit the tasks themselves. All customizing should be done via the defaults/main.yml file or with extra vars within the project, job, workflow, etc.
|
||||||
|
|
||||||
## Tags
|
## Tags 🏷️
|
||||||
|
|
||||||
There are many tags available for added control precision. Each control has it's own set of tags noting what level, if it's scored/notscored, what OS element it relates to, if it's a patch or audit, and the rule number.
|
There are many tags available for added control precision. Each control has its own set of tags noting what level, what OS element it relates to, whether it's a patch or audit, and the rule number. Additionally, NIST references follow a specific conversion format for consistency and clarity.
|
||||||
|
|
||||||
|
### Conversion Format for NIST References:
|
||||||
|
|
||||||
|
1. Standard Prefix:
|
||||||
|
|
||||||
|
- All references are prefixed with "NIST".
|
||||||
|
|
||||||
|
2. Standard Types:
|
||||||
|
|
||||||
|
- "800-53" references are formatted as NIST800-53.
|
||||||
|
- "800-53r5" references are formatted as NIST800-53R5 (with 'R' capitalized).
|
||||||
|
- "800-171" references are formatted as NIST800-171.
|
||||||
|
|
||||||
|
3. Details:
|
||||||
|
|
||||||
|
- Section and subsection numbers use periods (.) for numeric separators.
|
||||||
|
- Parenthetical elements are separated by underscores (_), e.g., IA-5(1)(d) becomes IA-5_1_d.
|
||||||
|
- Subsection letters (e.g., "b") are appended with an underscore.
|
||||||
Below is an example of the tag section from a control within this role. Using this example if you set your run to skip all controls with the tag services, this task will be skipped. The opposite can also happen where you run only controls tagged with services.
|
Below is an example of the tag section from a control within this role. Using this example if you set your run to skip all controls with the tag services, this task will be skipped. The opposite can also happen where you run only controls tagged with services.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -162,33 +210,34 @@ Below is an example of the tag section from a control within this role. Using th
|
||||||
- rule_2.2.4
|
- rule_2.2.4
|
||||||
```
|
```
|
||||||
|
|
||||||
## Community Contribution
|
|
||||||
|
## Community Contribution 🧑🤝🧑
|
||||||
|
|
||||||
We encourage you (the community) to contribute to this role. Please read the rules below.
|
We encourage you (the community) to contribute to this role. Please read the rules below.
|
||||||
|
|
||||||
- Your work is done in your own individual branch. Make sure to Signed-off and GPG sign all commits you intend to merge.
|
- Your work is done in your own individual branch. Make sure to Signed-off-by and GPG sign all commits you intend to merge.
|
||||||
- All community Pull Requests are pulled into the devel branch
|
- All community Pull Requests are pulled into the devel branch
|
||||||
- Pull Requests into devel will confirm your commits have a GPG signature, Signed-off, and a functional test before being approved
|
- Pull Requests into devel will confirm your commits have a GPG signature, Signed-off-by, and a functional test before being approved
|
||||||
- Once your changes are merged and a more detailed review is complete, an authorized member will merge your changes into the main branch for a new release
|
- Once your changes are merged and a more detailed review is complete, an authorized member will merge your changes into the main branch for a new release
|
||||||
|
|
||||||
|
## Pipeline Testing 🔄
|
||||||
|
|
||||||
|
uses:
|
||||||
|
|
||||||
|
- ansible-core 2.16
|
||||||
|
- ansible collections - pulls in the latest version based on requirements file
|
||||||
|
- runs the audit using the devel branch
|
||||||
|
- This is an automated test that occurs on pull requests into devel
|
||||||
|
- self-hosted runners using OpenTofu
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
Almalinux BaseOS, EPEL and many cloud providers repositories, do not allow gpgcheck(rule_1.2.1.2) or repo_gpgcheck (rule_1.2.1.3) this will cause issues during the playbook unless or a workaround is found.
|
Almalinux BaseOS, EPEL and many cloud providers repositories, do not allow gpgcheck(rule_1.2.1.2) or repo_gpgcheck (rule_1.2.1.3) this will cause issues during the playbook unless or a workaround is found.
|
||||||
|
|
||||||
## Pipeline Testing
|
|
||||||
|
|
||||||
uses:
|
## Local Testing 💻
|
||||||
|
|
||||||
- ansible-core 2.12
|
### example
|
||||||
- ansible collections - pulls in the latest version based on requirements file
|
|
||||||
- runs the audit using the devel branch
|
|
||||||
- This is an automated test that occurs on pull requests into devel
|
|
||||||
|
|
||||||
## Local Testing
|
|
||||||
|
|
||||||
Molecule can be used to work on this role and test in distinct _scenarios_.
|
|
||||||
|
|
||||||
### examples
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
molecule test -s default
|
molecule test -s default
|
||||||
|
|
@ -198,24 +247,15 @@ molecule verify -s localhost
|
||||||
|
|
||||||
local testing uses:
|
local testing uses:
|
||||||
|
|
||||||
- ansible 2.13.3
|
- ansible-core
|
||||||
- molecule 4.0.1
|
- molecule 4.0.1
|
||||||
- molecule-docker 2.0.0
|
- molecule-docker 2.0.0
|
||||||
- molecule-podman 2.0.2
|
- molecule-podman 2.0.2
|
||||||
- molecule-vagrant 1.0.0
|
- molecule-vagrant 1.0.0
|
||||||
- molecule-azure 0.5.0
|
- molecule-azure 0.5.0
|
||||||
|
|
||||||
## Added Extras
|
|
||||||
|
|
||||||
- [pre-commit](https://pre-commit.com) can be tested and can be run from within the directory
|
## Credits and Thanks 🙏
|
||||||
|
|
||||||
```sh
|
|
||||||
pre-commit run
|
|
||||||
```
|
|
||||||
|
|
||||||
## Credits and Thanks
|
|
||||||
|
|
||||||
Based on an original concept by Sam Doran
|
|
||||||
|
|
||||||
Massive thanks to the fantastic community and all its members.
|
Massive thanks to the fantastic community and all its members.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ setup_audit: false
|
||||||
run_audit: false
|
run_audit: false
|
||||||
# Run heavy tests - some tests can have more impact on a system enabling these can have greater impact on a system
|
# Run heavy tests - some tests can have more impact on a system enabling these can have greater impact on a system
|
||||||
audit_run_heavy_tests: true
|
audit_run_heavy_tests: true
|
||||||
|
# Ability to limit the number of concurrent processes used by goss (default 50)
|
||||||
|
audit_max_concurrent: 50
|
||||||
|
|
||||||
## Only run Audit do not remediate
|
## Only run Audit do not remediate
|
||||||
audit_only: false
|
audit_only: false
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Post Audit | Run post_remediation {{ benchmark }} audit # noqa name[template]
|
- name: Post Audit | Run post_remediation {{ benchmark }} audit # noqa name[template]
|
||||||
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -o {{ post_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
|
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -m {{ audit_max_concurrent }} -o {{ post_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
|
||||||
changed_when: true
|
changed_when: true
|
||||||
environment:
|
environment:
|
||||||
AUDIT_BIN: "{{ audit_bin }}"
|
AUDIT_BIN: "{{ audit_bin }}"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Pre Audit Setup | Setup the LE audit
|
- name: Pre Audit Setup | Setup the LE audit
|
||||||
when: setup_audit
|
when: setup_audit
|
||||||
tags: setup_audit
|
tags: setup_audit
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
mode: 'go-rwx'
|
mode: 'go-rwx'
|
||||||
|
|
||||||
- name: Pre Audit | Run pre_remediation audit {{ benchmark }} # noqa name[template]
|
- name: Pre Audit | Run pre_remediation audit {{ benchmark }} # noqa name[template]
|
||||||
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
|
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -m {{ audit_max_concurrent }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
|
||||||
changed_when: true
|
changed_when: true
|
||||||
environment:
|
environment:
|
||||||
AUDIT_BIN: "{{ audit_bin }}"
|
AUDIT_BIN: "{{ audit_bin }}"
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: "{{ 'ssh_keys' if (item.gr_name == 'ssh_keys') else 'root' }}"
|
||||||
mode: 'u-x,go-rwx'
|
mode: "{{ 'u-x,g-wx,o-rwx' if (item.gr_name == 'ssh_keys') else 'u-x,go-rwx' }}"
|
||||||
loop: "{{ discovered_ssh_private_host_key.files }}"
|
loop: "{{ discovered_ssh_private_host_key.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
- discovered_warn_days.stdout_lines | length > 0
|
- discovered_warn_days.stdout_lines | length > 0
|
||||||
- item in prelim_interactive_users | map(attribute='username') | list
|
- item in prelim_interactive_users | map(attribute='username') | list
|
||||||
- rhel9cis_force_user_warnage
|
- rhel9cis_force_user_warnage
|
||||||
ansible.builtin.command: "chage --warndays {{ rhel9cis_pass['warn_age'] }} {{ item }}"
|
ansible.builtin.command: "chage --warndays {{ rhel9cis_pass_warn_age }} {{ item }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
loop: "{{ discovered_warn_days.stdout_lines }}"
|
loop: "{{ discovered_warn_days.stdout_lines }}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
- name: "SECTION | 5.2 | Configure privilege escalation"
|
- name: "SECTION | 5.2 | Configure privilege escalation"
|
||||||
when:
|
when:
|
||||||
- - rhel9cis_section5_2
|
- rhel9cis_section5_2
|
||||||
ansible.builtin.import_tasks:
|
ansible.builtin.import_tasks:
|
||||||
file: cis_5.2.x.yml
|
file: cis_5.2.x.yml
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue