Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/github/codeql-ac…
Browse files Browse the repository at this point in the history
…tion-3.27.6
  • Loading branch information
konstruktoid authored Dec 4, 2024
2 parents dc1ce72 + 674aabd commit 1ccb1f6
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is an [Ansible](https://www.ansible.com/) role designed to enhance the
security of servers running on AlmaLinux, Debian, or Ubuntu.

It's [systemd](https://freedesktop.org/wiki/Software/systemd/) focused
and requires Ansible version 2.15 or higher.
and requires Ansible version 2.18 or higher.

The role supports the following operating systems:

Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ galaxy_info:
author: konstruktoid
description: AlmaLinux, Debian and Ubuntu hardening. systemd edition.
license: apache
min_ansible_version: "2.15"
min_ansible_version: "2.18"
platforms:
- name: Debian
versions:
Expand Down
7 changes: 5 additions & 2 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,8 @@
changed_when: false
failed_when: declare_tmout.rc != 0
when:
- ansible_local.systemd.version | int < 252
- ansible_virtualization_type not in ["container", "docker", "podman"]
- ansible_systemd.version | int < 252

- name: Assert compiler permissions
when:
Expand Down Expand Up @@ -1393,6 +1394,8 @@
- IdleAction={{ logind.idleaction }}
- IdleActionSec={{ logind.idleactionsec }}
- RemoveIPC={{ 'true' if logind.removeipc else 'false' }}
when:
- ansible_virtualization_type not in ["container", "docker", "podman"]

- name: Verify StopIdleSessionSec setting
ansible.builtin.shell: |
Expand All @@ -1406,8 +1409,8 @@
with_items:
- StopIdleSessionSec={{ session_timeout }}
when:
- ansible_local.systemd.version | int >= 252
- ansible_virtualization_type not in ["container", "docker", "podman"]
- ansible_systemd.version | int >= 252

- name: Verify journal permissions
become: true
Expand Down
8 changes: 0 additions & 8 deletions tasks/facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
owner: root
group: root

- name: Add systemd version fact
ansible.builtin.template:
src: etc/ansible/facts.d/systemd.fact
dest: /etc/ansible/facts.d/systemd.fact
mode: "0755"
owner: root
group: root

- name: Add cpuinfo rdrand fact
ansible.builtin.template:
src: etc/ansible/facts.d/cpuinfo.fact
Expand Down
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
ansible.builtin.import_tasks:
file: logindconf.yml
when:
- ansible_virtualization_type not in ["container", "docker", "podman"]
- manage_logind
tags:
- logind
Expand Down
3 changes: 2 additions & 1 deletion tasks/umask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@
create: false
insertbefore: ^export
when:
- ansible_local.systemd.version | int < 252
- ansible_virtualization_type not in ["container", "docker", "podman"]
- ansible_systemd.version | int < 252
- session_timeout
6 changes: 0 additions & 6 deletions templates/etc/ansible/facts.d/systemd.fact

This file was deleted.

2 changes: 1 addition & 1 deletion templates/etc/systemd/logind.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ KillExcludeUsers={{ logind.killexcludeusers | join(' ') }}
IdleAction={{ logind.idleaction }}
IdleActionSec={{ logind.idleactionsec }}
RemoveIPC={{ 'true' if logind.removeipc else 'false' }}
{% if ansible_local.systemd.version | int >= 252 %}
{% if ansible_systemd.version | int >= 252 %}
StopIdleSessionSec={{ session_timeout }}
{% endif %}
2 changes: 1 addition & 1 deletion templates/etc/systemd/resolved.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
DNS={{ dns | join(' ') }}
FallbackDNS={{ fallback_dns | join(' ') }}
DNSSEC={{ dnssec }}
{% if ansible_local.systemd.version | int >= 239 %}
{% if ansible_systemd.version | int >= 239 %}
DNSOverTLS={{ dns_over_tls }}
{% endif %}
2 changes: 1 addition & 1 deletion templates/etc/systemd/timesyncd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[Time]
NTP={{ ntp | join(' ') }}
FallbackNTP={{ fallback_ntp | join(' ') }}
{% if ansible_local.systemd.version | int >= 236 %}
{% if ansible_systemd.version | int >= 236 %}
RootDistanceMaxSec=1
{% endif %}
10 changes: 5 additions & 5 deletions tests/debug_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@

- name: Debug "systemd_version handling, <= 100"
ansible.builtin.debug:
msg: systemd version is {{ ansible_local.systemd.version }}, <= 100
when: ansible_local.systemd.version <= 100
msg: systemd version is {{ ansible_systemd.version }}, <= 100
when: ansible_systemd.version <= 100

- name: Debug "systemd_version handling, >= 100"
ansible.builtin.debug:
msg: systemd version is {{ ansible_local.systemd.version }}, >= 100
when: ansible_local.systemd.version >= 100
msg: systemd version is {{ ansible_systemd.version }}, >= 100
when: ansible_systemd.version >= 100

- name: Debug "systemd_version handling, info"
ansible.builtin.debug:
msg: systemd version is {{ ansible_local.systemd.version }}
msg: systemd version is {{ ansible_systemd.version }}

- name: Get DSA keys
ansible.builtin.debug:
Expand Down

0 comments on commit 1ccb1f6

Please sign in to comment.