2828pass () { print -- " PASS $* " ; }
2929fail () { print -- " FAIL $* " ; FAIL=1; }
3030
31+ TLS12_AEAD_CIPHERS=' ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256'
32+
3133check_file () {
3234 _file=" $1 "
3335 _label=" $2 "
@@ -53,6 +55,21 @@ check_regex() {
5355 fi
5456}
5557
58+ check_no_regex () {
59+ _file=" $1 "
60+ _regex=" $2 "
61+ _label=" $3 "
62+ if [ ! -f " ${_file} " ]; then
63+ fail " ${_label} missing: ${_file} "
64+ return 0
65+ fi
66+ if grep -Eiq " ${_regex} " " ${_file} " ; then
67+ fail " ${_label} forbidden pattern found in ${_file} "
68+ else
69+ pass " ${_label} "
70+ fi
71+ }
72+
5673check_no_upper_placeholders () {
5774 _file=" $1 "
5875 _label=" $2 "
@@ -67,6 +84,32 @@ check_no_upper_placeholders() {
6784 fi
6885}
6986
87+ check_nginx_tls_policy () {
88+ tls_policy_root=" $1 "
89+ tls_policy_label=" $2 "
90+ tls_policy_ssl_template=" ${tls_policy_root} /etc/nginx/templates/ssl.tmpl"
91+
92+ if [ ! -f " ${tls_policy_ssl_template} " ]; then
93+ fail " ${tls_policy_label} nginx TLS template missing: ${tls_policy_ssl_template} "
94+ return 0
95+ fi
96+ if grep -Eq ' ^ssl_protocols TLSv1\.2 TLSv1\.3;$' " ${tls_policy_ssl_template} " ; then
97+ pass " ${tls_policy_label} nginx TLS protocols limited to TLS 1.2 and TLS 1.3"
98+ else
99+ fail " ${tls_policy_label} nginx TLS protocol floor/ceiling not found in ${tls_policy_ssl_template} "
100+ fi
101+ if grep -Eq " ^ssl_ciphers ${TLS12_AEAD_CIPHERS} ;$" " ${tls_policy_ssl_template} " ; then
102+ pass " ${tls_policy_label} nginx TLS 1.2 ciphers are explicit AEAD-only suites"
103+ else
104+ fail " ${tls_policy_label} nginx TLS 1.2 AEAD cipher list not found in ${tls_policy_ssl_template} "
105+ fi
106+ if grep -Eiq ' (^|[^A-Z0-9])CBC([^A-Z0-9]|$)|AES[0-9]*-SHA($|:)|AES256\+EECDH|EECDH\+AES|EDH\+AES' " ${tls_policy_ssl_template} " ; then
107+ fail " ${tls_policy_label} nginx TLS template contains CBC-capable broad cipher tokens: ${tls_policy_ssl_template} "
108+ else
109+ pass " ${tls_policy_label} nginx TLS template has no CBC-capable broad cipher tokens"
110+ fi
111+ }
112+
70113check_mail_root () {
71114 _root=" $1 "
72115 _label=" $2 "
@@ -81,6 +124,7 @@ check_mail_root() {
81124 check_regex " ${_root} /etc/dovecot/dovecot.conf" ' protocols *= *imap lmtp' " ${_label} dovecot protocol set"
82125 check_regex " ${_root} /etc/dovecot/local.conf" ' mail_location *= *maildir:' " ${_label} dovecot maildir location"
83126 check_regex " ${_root} /etc/nginx/sites-available/main-ssl.conf" ' include /etc/nginx/templates/ssl\.tmpl;' " ${_label} nginx ssl template include"
127+ check_nginx_tls_policy " ${_root} " " ${_label} "
84128 check_regex " ${_root} /etc/rspamd/local.d/worker-proxy.inc" ' milter *= *yes;' " ${_label} rspamd proxy milter enabled"
85129 check_regex " ${_root} /etc/rspamd/local.d/worker-controller.inc" ' bind_socket *= *"' " ${_label} rspamd controller bind configured"
86130 check_regex " ${_root} /var/www/postfixadmin/config.local.php" " \$ CONF\['configured'\] = true;" " ${_label} postfixadmin configured flag"
0 commit comments