Skip to content

Commit 0708944

Browse files
author
damien cavagnini
committed
feat: add trixie docker build
Ensure the current debian12 scripts are going to run on trixie
1 parent 90597da commit 0708944

11 files changed

+45
-13
lines changed

.github/workflows/functionnal-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ jobs:
1818
uses: actions/checkout@v5
1919
- name: Run the tests debian12
2020
run: ./tests/docker_build_and_run_tests.sh debian12
21+
functionnal-tests-docker-debian13:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v5
26+
- name: Run the tests debian13
27+
run: ./tests/docker_build_and_run_tests.sh debian13

tests/docker/Dockerfile.debian13

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM debian:trixie
2+
3+
LABEL vendor="OVH"
4+
LABEL project="debian-cis"
5+
LABEL url="https://github.com/ovh/debian-cis"
6+
LABEL description="This image is used to run tests"
7+
8+
RUN groupadd -g 500 secaudit && useradd -u 500 -g 500 -s /bin/bash secaudit && install -m 700 -o secaudit -g secaudit -d /home/secaudit
9+
10+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-server sudo syslog-ng net-tools auditd cron iproute2 procps
11+
12+
COPY --chown=500:500 . /opt/debian-cis/
13+
14+
COPY debian/default /etc/default/cis-hardening
15+
RUN sed -i 's#cis-hardening#debian-cis#' /etc/default/cis-hardening
16+
17+
COPY cisharden.sudoers /etc/sudoers.d/secaudit
18+
RUN sed -i 's#cisharden#secaudit#' /etc/sudoers.d/secaudit
19+
20+
21+
ENTRYPOINT ["/opt/debian-cis/tests/launch_tests.sh"]

tests/hardening/acc_logindefs_sha512.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test_audit() {
1010
cp /etc/login.defs /tmp/login.defs.bak
1111
describe Line as comment
1212
sed -i 's/\(ENCRYPT_METHOD SHA512\)/# \1/' /etc/login.defs
13+
sed -i 's/\(ENCRYPT_METHOD YESCRYPT\)/# \1/' /etc/login.defs
1314
register_test retvalshouldbe 1
1415
register_test contain "is not present in /etc/login.defs"
1516
run commented "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
@@ -22,6 +23,7 @@ test_audit() {
2223

2324
cp /tmp/login.defs.bak /etc/login.defs
2425
sed -ir 's/ENCRYPT_METHOD[[:space:]]\+SHA512/ENCRYPT_METHOD MD5/' /etc/login.defs
26+
sed -ir 's/ENCRYPT_METHOD[[:space:]]\+YESCRYPT/ENCRYPT_METHOD MD5/' /etc/login.defs
2527
describe Fail: wrong hash function configuration
2628
register_test retvalshouldbe 1
2729
register_test contain "is not present in /etc/login.defs"

tests/hardening/check_user_dot_file_perm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ test_audit() {
1313
describe Tests purposely failing
1414
useradd --create-home "$test_user"
1515
touch "/home/$test_user/$test_file"
16+
chmod o+rx "/home/$test_user"
1617
chmod 777 "/home/$test_user/$test_file"
1718
register_test retvalshouldbe 1
1819
register_test contain "Group Write permission set on FILE"

tests/hardening/find_user_forward_files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_audit() {
1212

1313
describe Tests purposely failing
1414
useradd --create-home "$test_user"
15+
chmod o+rx "/home/$test_user/"
1516
touch "/home/$test_user/$test_file"
1617
register_test retvalshouldbe 1
1718
register_test contain "$test_file present"

tests/hardening/find_user_netrc_files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_audit() {
1212

1313
describe Tests purposely failing
1414
useradd --create-home "$test_user"
15+
chmod o+rx "/home/$test_user/"
1516
touch "/home/$test_user/$test_file"
1617
register_test retvalshouldbe 1
1718
register_test contain "$test_file present"

tests/hardening/find_user_rhosts_files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_audit() {
1212

1313
describe Tests purposely failing
1414
useradd --create-home "$test_user"
15+
chmod o+rx "/home/$test_user"
1516
touch "/home/$test_user/$test_file"
1617
register_test retvalshouldbe 1
1718
register_test contain "$test_file present"

tests/hardening/set_perm_on_user_netrc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_audit() {
1212

1313
describe Tests purposely failing
1414
useradd --create-home "$test_user"
15+
chmod o+rx "/home/$test_user/"
1516
touch "/home/$test_user/$test_file"
1617
chmod 777 "/home/$test_user/$test_file"
1718
register_test retvalshouldbe 1

tests/hardening/ssh_sys_accept_env.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ test_audit() {
99

1010
# Proceed to operation that will end up to a non compliant system
1111
describe Tests purposely failing
12-
sed -ri 's/^\s*AcceptEnv\s+LANG LC_\*//' /etc/ssh/sshd_config
12+
# remove the whole line, or sshd wont start (trixie)
13+
sed -ri 's/^\s*AcceptEnv\s+LANG LC_\*.*$//' /etc/ssh/sshd_config
1314
register_test retvalshouldbe 1
1415
register_test contain "[ KO ] ^\s*AcceptEnv\s+LANG LC_\* is not present in /etc/ssh/sshd_config"
1516
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all

tests/hardening/tftp_is_disabled.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,11 @@ test_audit() {
1919
register_test retvalshouldbe 0
2020
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
2121

22-
describe Prepare test package dependencies
23-
# try to install a package that depends on 'tftpd-hpa'
24-
apt install -y tftp-hpa-dbg
25-
# running on a container, we can only test the package installation, not the service management
26-
27-
describe Running successfull test
28-
register_test retvalshouldbe 0
29-
# shellcheck disable=2154
30-
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
22+
# we can not test dependencies on trixie, because no package depends from tftpf-hpa
23+
# we should use the "get_debian_major_version" from lib/utils.sh, but we can't source it in the actual state
3124

3225
describe clean installation
33-
apt remove -y tftp-hpa-dbg tftpd-hpa
26+
apt remove -y tftpd-hpa
3427
apt autoremove -y
3528

3629
}

0 commit comments

Comments
 (0)