feat(ssh): add alpine support (#809)
Signed-off-by: Sebastian Gumprich <[email protected]>
This commit is contained in:
1 parent
cd9cf8f22a
commit
7b112dcf87
7 files changed
+60
-9
No files matched your search
@@ -35,6 +35,14 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
include:
|
||||||
|
# needs fix - opensuse has different file location for conf and pam (/usr/etc/ssh/?, /usr/lib/pam.d/?)
|
||||||
|
# - molecule_distro: opensuse_tumbleweed
|
||||||
|
# molecule_docker_command: "/usr/lib/systemd/systemd"
|
||||||
|
- molecule_distro: alpine
|
||||||
|
molecule_docker_command: "/sbin/init"
|
||||||
|
molecule_docker_command:
|
||||||
|
- "/lib/systemd/systemd"
|
||||||
molecule_distro:
|
molecule_distro:
|
||||||
- centosstream9
|
- centosstream9
|
||||||
- rocky8
|
- rocky8
|
||||||
@@ -48,7 +56,6 @@ jobs:
|
|||||||
- debian12
|
- debian12
|
||||||
- amazon2023
|
- amazon2023
|
||||||
- arch
|
- arch
|
||||||
# - opensuse_tumbleweed # needs fix - opensuse has different file location for conf and pam (/usr/etc/ssh/?, /usr/lib/pam.d/?)
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
||||||
@@ -76,11 +83,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Test with molecule
|
- name: Test with molecule
|
||||||
run: |
|
run: |
|
||||||
if [ "$MOLECULE_DISTRO" = "opensuse_tumbleweed" ]; then
|
|
||||||
export MOLECULE_DOCKER_COMMAND="/usr/lib/systemd/systemd"
|
|
||||||
fi
|
|
||||||
molecule --version
|
molecule --version
|
||||||
molecule test -s ssh_hardening
|
molecule test -s ssh_hardening
|
||||||
env:
|
env:
|
||||||
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}
|
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}
|
||||||
|
MOLECULE_DOCKER_COMMAND: ${{ matrix.molecule_docker_command }}
|
||||||
working-directory: ansible_collections/devsec/hardening
|
working-directory: ansible_collections/devsec/hardening
|
||||||
@@ -35,6 +35,14 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
include:
|
||||||
|
# needs fix - opensuse has different file location for conf and pam (/usr/etc/ssh/?, /usr/lib/pam.d/?)
|
||||||
|
# - molecule_distro: opensuse_tumbleweed
|
||||||
|
# molecule_docker_command: "/usr/lib/systemd/systemd"
|
||||||
|
- molecule_distro: alpine
|
||||||
|
molecule_docker_command: "/sbin/init"
|
||||||
|
molecule_docker_command:
|
||||||
|
- "/lib/systemd/systemd"
|
||||||
molecule_distro:
|
molecule_distro:
|
||||||
- centosstream9
|
- centosstream9
|
||||||
- rocky8
|
- rocky8
|
||||||
@@ -48,7 +56,6 @@ jobs:
|
|||||||
- debian12
|
- debian12
|
||||||
- amazon2023
|
- amazon2023
|
||||||
- arch
|
- arch
|
||||||
# - opensuse_tumbleweed # needs fix - opensuse has different file location for conf and pam (/usr/etc/ssh/?, /usr/lib/pam.d/?)
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
||||||
@@ -76,11 +83,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Test with molecule
|
- name: Test with molecule
|
||||||
run: |
|
run: |
|
||||||
if [ "$MOLECULE_DISTRO" = "opensuse_tumbleweed" ]; then
|
|
||||||
export MOLECULE_DOCKER_COMMAND="/usr/lib/systemd/systemd"
|
|
||||||
fi
|
|
||||||
molecule --version
|
molecule --version
|
||||||
molecule test -s ssh_hardening_custom_tests
|
molecule test -s ssh_hardening_custom_tests
|
||||||
env:
|
env:
|
||||||
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}
|
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}
|
||||||
|
MOLECULE_DOCKER_COMMAND: ${{ matrix.molecule_docker_command }}
|
||||||
working-directory: ansible_collections/devsec/hardening
|
working-directory: ansible_collections/devsec/hardening
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
|
- name: Prepare the molecule container for the role
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: true
|
||||||
environment:
|
environment:
|
||||||
@@ -53,6 +53,14 @@
|
|||||||
- openssh
|
- openssh
|
||||||
when: ansible_facts.os_family == 'Suse'
|
when: ansible_facts.os_family == 'Suse'
|
||||||
|
|
||||||
|
- name: Install required tools on Alpine
|
||||||
|
community.general.apk:
|
||||||
|
name:
|
||||||
|
- openssh
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
when: ansible_facts.os_family == 'Alpine'
|
||||||
|
|
||||||
- name: Install required tools on Arch
|
- name: Install required tools on Arch
|
||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
name:
|
name:
|
||||||
|
|||||||
@@ -62,6 +62,14 @@
|
|||||||
update_cache: true
|
update_cache: true
|
||||||
when: ansible_facts.os_family == 'Archlinux'
|
when: ansible_facts.os_family == 'Archlinux'
|
||||||
|
|
||||||
|
- name: Install required tools on Alpine
|
||||||
|
community.general.apk:
|
||||||
|
name:
|
||||||
|
- openssh
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
when: ansible_facts.os_family == 'Alpine'
|
||||||
|
|
||||||
- name: Create ssh host keys # noqa ignore-errors
|
- name: Create ssh host keys # noqa ignore-errors
|
||||||
ansible.builtin.command: ssh-keygen -A
|
ansible.builtin.command: ssh-keygen -A
|
||||||
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7')
|
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7')
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ For more information, see [this issue](https://github.com/dev-sec/ansible-collec
|
|||||||
- focal, jammy, noble
|
- focal, jammy, noble
|
||||||
- Debian
|
- Debian
|
||||||
- bookworm, bullseye
|
- bookworm, bullseye
|
||||||
|
- Alpine
|
||||||
- Amazon
|
- Amazon
|
||||||
- Fedora
|
- Fedora
|
||||||
- ArchLinux
|
- ArchLinux
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ galaxy_info:
|
|||||||
versions:
|
versions:
|
||||||
- bookworm
|
- bookworm
|
||||||
- bullseye
|
- bullseye
|
||||||
|
- name: Alpine
|
||||||
- name: Amazon
|
- name: Amazon
|
||||||
- name: Fedora
|
- name: Fedora
|
||||||
- name: ArchLinux
|
- name: ArchLinux
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
ssh_pkgs:
|
||||||
|
- openssh
|
||||||
|
sshd_path: /usr/sbin/sshd
|
||||||
|
ssh_host_keys_dir: /etc/ssh
|
||||||
|
sshd_service_name: sshd
|
||||||
|
ssh_owner: root
|
||||||
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: root
|
||||||
|
ssh_host_keys_group: root
|
||||||
|
ssh_host_keys_mode: "0600"
|
||||||
|
|
||||||
|
# true if SSH support Kerberos
|
||||||
|
ssh_kerberos_support: true
|
||||||
|
|
||||||
|
# true if SSH has PAM support
|
||||||
|
ssh_pam_support: true
|
||||||
|
|
||||||
|
sshd_moduli_file: /etc/ssh/moduli
|
||||||
|
|
||||||
|
# CRYPTO_POLICY is not supported on Archlinux
|
||||||
|
# and the package check only works in Ansible >2.10
|
||||||
|
sshd_disable_crypto_policy: false
|
||||||
Reference in new issue
Block a user