From: Ian Kelling Date: Thu, 3 Mar 2022 02:24:56 +0000 (-0500) Subject: fix root mail on bk, nonroot stuff, misc prom updates X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=7c94d9bd37b13d57098a297e1e58ad27b54e6eff;p=distro-setup fix root mail on bk, nonroot stuff, misc prom updates --- diff --git a/filesystem/etc/prometheus/rules/iank.yml b/filesystem/etc/prometheus/rules/iank.yml index 043b64d..b78368f 100644 --- a/filesystem/etc/prometheus/rules/iank.yml +++ b/filesystem/etc/prometheus/rules/iank.yml @@ -155,3 +155,19 @@ groups: annotations: description: '{{ $labels.instance }} ianktest.' summary: Instance {{ $labels.instance }} - ianktest + - alert: ianktest + expr: node_systemd_version >= 300 + labels: + severity: critical + annotations: + description: '{{ $labels.instance }} ianktest.' + summary: Instance {{ $labels.instance }} - ianktest + + - alert: ianktest + expr: |- + time() - mailtest_check_last_usec > 60 * 8 + labels: + severity: critical + annotations: + description: '{{ $labels.instance }} mailtest' + summary: Instance {{ $labels.instance }} - ianktest diff --git a/filesystem/usr/local/bin/myupgrade b/filesystem/usr/local/bin/myupgrade index 7be7001..3577864 100755 --- a/filesystem/usr/local/bin/myupgrade +++ b/filesystem/usr/local/bin/myupgrade @@ -43,7 +43,7 @@ myreboot() { # We should figure some workaround. if ! out=$(/sbin/needrestart -p 2>&1); then - e "$out" + printf "%s\n\n" "$out" if [[ $HOSTNAME != "$MAIL_HOST" ]]; then myreboot fi diff --git a/mail-setup b/mail-setup index 4693316..aca7d8d 100755 --- a/mail-setup +++ b/mail-setup @@ -3,6 +3,10 @@ # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later +# todo: handle errors like this: +# Mar 02 12:44:26 kw systemd[1]: exim4.service: Found left-over process 68210 (exim4) in control group while starting unit. Ignoring. +# Mar 02 12:44:26 kw systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies. + # todo: harden dovecot. need to do some research. one way is for it to only listen on a wireguard vpn interface, so only clients that are on the vpn can access it. # todo: consider hardening cups listening on 0.0.0.0 # todo: stop/disable local apache, and rpc.mountd, and kdeconnect when not in use. @@ -2374,7 +2378,13 @@ case $HOSTNAME in rm -fv /etc/systemd/system/exim4.service.d/nonroot.conf ;; *) - i /etc/systemd/system/exim4.service.d/nonroot.conf <<'EOF' + dirs=() + for d in /d /m /media /mnt /nocow /o /p /q; do + if [[ -d $d ]]; then + dirs+=($d) + fi + done + i /etc/systemd/system/exim4.service.d/nonroot.conf < /etc/mailname - /a/exe/cedit nn /etc/hosts <<'EOF' || [[ $? == 1 ]] 10.173.8.2 nn.b8.nz EOF @@ -2752,9 +2760,10 @@ COMMONOPTIONS='-oP /run/exim4/eximin.pid' UPEX4OPTS='-d /etc/myexim4' EOF + echo bk.b8.nz > /etc/mailname cat >>/etc/exim4/update-exim4.conf.conf <>/var/lib/prometheus/node-exporter/mailtest-check.prom.$$ + if [[ -e /var/lib/prometheus/node-exporter ]]; then + cat >>/var/lib/prometheus/node-exporter/mailtest-check.prom.$$ + fi } pr < 0 )) @@ -217,4 +219,8 @@ if $slow; then mailtest_check_unexpected_spamd_results $unexpected EOF fi -mv /var/lib/prometheus/node-exporter/mailtest-check.prom.$$ /var/lib/prometheus/node-exporter/mailtest-check.prom + +dir=/var/lib/prometheus/node-exporter +if [[ -e $dir ]]; then + mv $dir/mailtest-check.prom.$$ $dir/mailtest-check.prom +fi