Commit 99e6694
fix: "--only" option in "hardening.sh" (#261)
"--only" was broken, it did not match correctly a script passed in only
Previously we were checking the numerotation number, we now are using the full script name.
Ex: 1.1.1.1_disable_freevxfs.sh
Previously: (broken) look up for 1\.1\.1\.1, which could also match 1.1.1.1.1.1.1.1_foo.sh
Now: look up for 1.1.1.1_disable_freevxfs.sh
Usage example:
previously:
```
bin/hardening.sh --audit --only 1.1.10_var_tmp_noexec.sh --only 1.1.11.1_var_log_noexec.sh
Total Available Checks : 0
Total Runned Checks : 0
Total Passed Checks : [ 0/0 ]
Total Failed Checks : [ 0/0 ]
Enabled Checks Percentage : 0 %
Conformity Percentage : N.A %
```
now:
```
bin/hardening.sh --audit --only 1.1.10_var_tmp_noexec.sh --only 1.1.11.1_var_log_noexec.sh
hardening [INFO] Treating /opt/debian-cis/versions/default/1.1.10_var_tmp_noexec.sh
1.1.10_var_tmp_noexec [INFO] Working on 1.1.10_var_tmp_noexec
1.1.10_var_tmp_noexec [INFO] [DESCRIPTION] /var/tmp partition with noexec option.
1.1.10_var_tmp_noexec [INFO] Checking Configuration
1.1.10_var_tmp_noexec [INFO] Performing audit
1.1.10_var_tmp_noexec [INFO] Verifying that /var/tmp is a partition
1.1.10_var_tmp_noexec [ OK ] /var/tmp is a partition
1.1.10_var_tmp_noexec [ OK ] /var/tmp has noexec in fstab
1.1.10_var_tmp_noexec [ OK ] /var/tmp mounted with noexec
1.1.10_var_tmp_noexec [ OK ] Check Passed
hardening [INFO] Treating /opt/debian-cis/versions/default/1.1.11.1_var_log_noexec.sh
1.1.11.1_var_log_noexec [INFO] Working on 1.1.11.1_var_log_noexec
1.1.11.1_var_log_noexec [INFO] [DESCRIPTION] /var/log partition with noexec option.
1.1.11.1_var_log_noexec [INFO] Checking Configuration
1.1.11.1_var_log_noexec [INFO] Performing audit
1.1.11.1_var_log_noexec [INFO] Verifying that /var/log is a partition
1.1.11.1_var_log_noexec [ OK ] /var/log is a partition
1.1.11.1_var_log_noexec [ KO ] /var/log has no option noexec in fstab!
1.1.11.1_var_log_noexec [ KO ] Check Failed
Total Available Checks : 2
Total Runned Checks : 2
Total Passed Checks : [ 1/2 ]
Total Failed Checks : [ 1/2 ]
Enabled Checks Percentage : 100.00 %
Conformity Percentage : 50.00 %
```
Co-authored-by: Damien Cavagnini <damien.cavagnini@corp.ovh.com>1 parent 231db2b commit 99e6694
1 file changed
+1
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 322 | + | |
326 | 323 | | |
327 | 324 | | |
328 | 325 | | |
| |||
0 commit comments