Skip to content

Commit ab0dba9

Browse files
damcav35Damien Cavagnini
andauthored
chore: drop debian 10 and below support (#264)
Currently, the only LTS Debian are 11 and 12 We only support CIS for LTS debian Co-authored-by: Damien Cavagnini <[email protected]>
1 parent f2c6f36 commit ab0dba9

18 files changed

+32
-156
lines changed

.github/workflows/functionnal-tests.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ on:
44
- pull_request
55
- push
66
jobs:
7-
functionnal-tests-docker-debian10:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout repo
11-
uses: actions/checkout@v4
12-
- name: Run the tests debian10
13-
run: ./tests/docker_build_and_run_tests.sh debian10
147
functionnal-tests-docker-debian11:
158
runs-on: ubuntu-latest
169
steps:

MANUAL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
# NAME
66

7-
cis-hardening - CIS Debian 10/11/12 Hardening
7+
cis-hardening - CIS Debian 11/12 Hardening
88

99
# SYNOPSIS
1010

1111
**hardening.sh** RUN_MODE [OPTIONS]
1212

1313
# DESCRIPTION
1414

15-
Modular Debian 10/11/12 security hardening scripts based on the CIS (https://www.cisecurity.org) recommendations.
15+
Modular Debian 11/12 security hardening scripts based on the CIS (https://www.cisecurity.org) recommendations.
1616

1717
We use it at OVHcloud (https://www.ovhcloud.com) to harden our PCI-DSS infrastructure.
1818

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# :lock: CIS Debian 10/11/12 Hardening
1+
# :lock: CIS Debian 11/12 Hardening
22

33

44
<p align="center">
@@ -13,7 +13,7 @@
1313
![License](https://img.shields.io/github/license/ovh/debian-cis)
1414
---
1515

16-
Modular Debian 10/11/12 security hardening scripts based on [cisecurity.org](https://www.cisecurity.org)
16+
Modular Debian 11/12 security hardening scripts based on [cisecurity.org](https://www.cisecurity.org)
1717
recommendations. We use it at [OVHcloud](https://www.ovhcloud.com) to harden our PCI-DSS infrastructure.
1818

1919
NB : Although Debian 12 CIS Hardening guide is still in development, we do use this set of scripts
@@ -174,7 +174,7 @@ Functional tests are available. They are to be run in a Docker environment.
174174
$ ./tests/docker_build_and_run_tests.sh <target> [name of test script...]
175175
```
176176

177-
With `target` being like `debian10` or `debian11`.
177+
With `target` being like `debian11` or `debian12`.
178178

179179
Running without script arguments will run all tests in `./tests/hardening/` directory.
180180
Or you can specify one or several test script to be run.

bin/hardening.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ if [ "$DISTRIBUTION" != "debian" ]; then
254254
echo "You can deactivate this message by setting the LOGLEVEL variable in /etc/hardening.cfg"
255255
fi
256256
else
257-
if [ "$DEB_MAJ_VER" = "sid" ] || [ "$DEB_MAJ_VER" -gt "$HIGHEST_SUPPORTED_DEBIAN_VERSION" ]; then
257+
if [ "$DEB_MAJ_VER" -gt "$HIGHEST_SUPPORTED_DEBIAN_VERSION" ]; then
258258
echo "Your debian version is too recent and is not supported yet because there is no official CIS PDF for this version yet."
259259
if [ "$ALLOW_UNSUPPORTED_DISTRIBUTION" -eq 0 ]; then
260260
echo "If you want to run it anyway, you can use the flag --allow-unsupported-distribution"

bin/hardening/acc_logindefs_sha512.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,9 @@ check_config() {
5959
:
6060
}
6161

62-
# As we use DEB_MAJ_VER, which is set by constants.sh, itself sourced by main.sh below,
63-
# We need to call this in the subs called by main.sh when it is sourced, otherwise it would
64-
# either be too soon (DEB_MAJ_VER not defined) or too late (test has already been run)
6562
_set_vars_jit() {
66-
if [ "$DEB_MAJ_VER" = "sid" ] || [ "$DEB_MAJ_VER" -ge "11" ]; then
67-
CONF_LINE_REGEX="ENCRYPT_METHOD (SHA512|yescrypt|YESCRYPT)"
68-
CONF_LINE="ENCRYPT_METHOD YESCRYPT"
69-
else
70-
CONF_LINE_REGEX="ENCRYPT_METHOD SHA512"
71-
CONF_LINE="ENCRYPT_METHOD SHA512"
72-
fi
63+
CONF_LINE_REGEX="ENCRYPT_METHOD (SHA512|yescrypt|YESCRYPT)"
64+
CONF_LINE="ENCRYPT_METHOD YESCRYPT"
7365
}
7466

7567
# Source Root Dir Parameter

bin/hardening/acc_pam_sha512.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ apply() {
4949
ok "$CONF_LINE is present in $CONF_FILE"
5050
else
5151
warn "$CONF_LINE is not present in $CONF_FILE"
52-
if [ "$DEB_MAJ_VER" = "sid" ] || [ "$DEB_MAJ_VER" -ge "11" ]; then
53-
add_line_file_before_pattern "$CONF_FILE" "password [success=1 default=ignore] pam_unix.so yescrypt" "# pam-auth-update(8) for details."
54-
else
55-
add_line_file_before_pattern "$CONF_FILE" "password [success=1 default=ignore] pam_unix.so sha512" "# pam-auth-update(8) for details."
56-
fi
52+
add_line_file_before_pattern "$CONF_FILE" "password [success=1 default=ignore] pam_unix.so yescrypt" "# pam-auth-update(8) for details."
5753
fi
5854
fi
5955
}
@@ -67,11 +63,7 @@ check_config() {
6763
# We need to call this in the subs called by main.sh when it is sourced, otherwise it would
6864
# either be too soon (DEB_MAJ_VER not defined) or too late (test has already been run)
6965
_set_vars_jit() {
70-
if [ "$DEB_MAJ_VER" = "sid" ] || [ "$DEB_MAJ_VER" -ge "11" ]; then
71-
CONF_LINE="^\s*password\s.+\s+pam_unix\.so\s+.*(sha512|yescrypt)" # https://github.com/ovh/debian-cis/issues/158
72-
else
73-
CONF_LINE="^\s*password\s.+\s+pam_unix\.so\s+.*sha512"
74-
fi
66+
CONF_LINE="^\s*password\s.+\s+pam_unix\.so\s+.*(sha512|yescrypt)" # https://github.com/ovh/debian-cis/issues/158
7567
}
7668

7769
# Source Root Dir Parameter

bin/hardening/acc_shadow_sha512.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ audit() {
3737
pw_found+="$user "
3838
ok "User $user has a disabled password."
3939
# yescrypt: Check password against $y$<salt>$<base64>
40-
elif [ "$DEB_MAJ_VER" -ge "11" ] && [[ $passwd =~ ^\$y\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{,86}\$[./A-Za-z0-9]{43} ]]; then
40+
elif [[ $passwd =~ ^\$y\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{,86}\$[./A-Za-z0-9]{43} ]]; then
4141
pw_found+="$user "
4242
ok "User $user has suitable yescrypt hashed password."
4343
# sha512: Check password against $6$<salt>$<base64>, see `man 3 crypt`
@@ -46,11 +46,7 @@ audit() {
4646
ok "User $user has suitable sha512crypt hashed password."
4747
else
4848
pw_found+="$user "
49-
if [ "$DEB_MAJ_VER" -ge "11" ]; then
50-
crit "User $user has a password that is not sha512crypt nor yescrypt hashed."
51-
else
52-
crit "User $user has a password that is not sha512crypt hashed."
53-
fi
49+
crit "User $user has a password that is not sha512crypt nor yescrypt hashed."
5450
fi
5551
done
5652
if [[ -z "$users_reviewed" ]]; then

bin/hardening/check_distribution.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77

88
#
9-
# Ensure that the distribution version is debian and that the version is 9 or 10
9+
# Ensure that the distribution version is debian and supported
1010
#
1111

1212
set -e # One error, it's over
@@ -22,7 +22,7 @@ audit() {
2222
if [ "$DISTRIBUTION" != "debian" ]; then
2323
crit "Your distribution has been identified as $DISTRIBUTION which is not debian"
2424
else
25-
if [ "$DEB_MAJ_VER" = "sid" ] || [ "$DEB_MAJ_VER" -gt "$HIGHEST_SUPPORTED_DEBIAN_VERSION" ]; then
25+
if [ "$DEB_MAJ_VER" -gt "$HIGHEST_SUPPORTED_DEBIAN_VERSION" ]; then
2626
crit "Your distribution is too recent and is not yet supported."
2727
elif [ "$DEB_MAJ_VER" -lt "$SMALLEST_SUPPORTED_DEBIAN_VERSION" ]; then
2828
crit "Your distribution is debian but is deprecated. Consider upgrading to a supported version."

bin/hardening/enable_lockout_failed_password.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,14 @@ apply() {
5959
ok "$PATTERN_AUTH is present in $FILE_AUTH"
6060
else
6161
warn "$PATTERN_AUTH is not present in $FILE_AUTH, adding it"
62-
if [ 10 -ge "$DEB_MAJ_VER" ]; then
63-
add_line_file_before_pattern "$FILE_AUTH" "auth required pam_tally2.so onerr=fail audit silent deny=5 unlock_time=900" "# pam-auth-update(8) for details."
64-
else
65-
add_line_file_before_pattern "$FILE_AUTH" "auth required pam_faillock.so onerr=fail audit silent deny=5 unlock_time=900" "# pam-auth-update(8) for details."
66-
fi
62+
add_line_file_before_pattern "$FILE_AUTH" "auth required pam_faillock.so onerr=fail audit silent deny=5 unlock_time=900" "# pam-auth-update(8) for details."
6763
fi
6864
does_pattern_exist_in_file "$FILE_ACCOUNT" "$PATTERN_ACCOUNT"
6965
if [ "$FNRET" = 0 ]; then
7066
ok "$PATTERN_ACCOUNT is present in $FILE_ACCOUNT"
7167
else
7268
warn "$PATTERN_ACCOUNT is not present in $FILE_ACCOUNT, adding it"
73-
if [ 10 -ge "$DEB_MAJ_VER" ]; then
74-
add_line_file_before_pattern "$FILE_ACCOUNT" "account required pam_tally2.so" "# pam-auth-update(8) for details."
75-
else
76-
add_line_file_before_pattern "$FILE_ACCOUNT" "account required pam_faillock.so" "# pam-auth-update(8) for details."
77-
fi
78-
69+
add_line_file_before_pattern "$FILE_ACCOUNT" "account required pam_faillock.so" "# pam-auth-update(8) for details."
7970
fi
8071
}
8172

bin/hardening/ssh_cry_kex.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ apply() {
7373
}
7474

7575
create_config() {
76-
set +u
77-
debug "Debian version : $DEB_MAJ_VER "
78-
if [[ "$DEB_MAJ_VER" -le 7 ]]; then
79-
KEX='diffie-hellman-group-exchange-sha256'
80-
else
81-
KEX='curve25519-sha256,[email protected],diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256'
82-
fi
83-
set -u
76+
KEX='curve25519-sha256,[email protected],diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256'
8477
cat <<EOF
8578
status=audit
8679
# Put your KexAlgorithms

0 commit comments

Comments
 (0)