From 0da09a2fa9c4ce921d5af5be8494c4a96cce43de Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 1 Aug 2019 23:19:35 -0400 Subject: [PATCH] various fixes --- brc | 7 +++++-- mail-setup | 9 ++++++++- subdir_files/.gnupg/gpg.conf | 4 ++-- switch-mail-host | 2 +- system-status | 15 +++++++-------- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/brc b/brc index 5fb46ac..1d6e833 100644 --- a/brc +++ b/brc @@ -652,7 +652,10 @@ envload() { # load environment from a previous: export > file # mail related etail() { - sudo tail -F /var/log/exim4/mainlog -n 50 + tail -F /var/log/exim4/mainlog -n 200 +} +eless() { + less /var/log/exim4/mainlog } f() { @@ -1441,7 +1444,7 @@ q() { # start / launch a program in the backround and redir output to null } r() { - histappend -a + history -a # save history exit "$@" # i had this redir, not sure why # exit "$@" 2>/dev/null diff --git a/mail-setup b/mail-setup index c313c46..b97f3b9 100755 --- a/mail-setup +++ b/mail-setup @@ -15,7 +15,8 @@ set -x # See the License for the specific language governing permissions and # limitations under the License. -# todo: make quick backups of maildir, or deliver to multiple hosts. +# TODO: copy dkim keys from within this file. its now done in conflink. +# TODO: fix dkim key to b chmod 640, group Debian-exim set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -340,6 +341,7 @@ EOF #### begin mail cert setup ### f=/usr/local/bin/mail-cert-cron cat >$f <<'EOF' +#!/bin/bash set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -396,6 +398,11 @@ systemctl start mailcert systemctl restart mailcert.timer systemctl enable mailcert.timer +# This symlink is only here to so I can use the +# fsf mailman ansible role and trick its cert script +# into doing nothing. +/a/exe/lnf -T /etc/exim4/exim.crt /etc/letsencrypt/live/$(hostname -f)/fullchain.pem + ##### end mailcert setup ##### # comon stuff diff --git a/subdir_files/.gnupg/gpg.conf b/subdir_files/.gnupg/gpg.conf index 2e437a3..1f8d6f7 100644 --- a/subdir_files/.gnupg/gpg.conf +++ b/subdir_files/.gnupg/gpg.conf @@ -39,12 +39,12 @@ default-key B125F60B7B287FF6A2B7DF8F170AF0E2954295DF # DO NOT USE THIS ONE. #keyserver hkp://pool.sks-keyservers.net -keyserver hkp://keys.openpgp.org +#keyserver hkp://keys.openpgp.org #keyserver hkp://pgp.mit.edu #keyserver hkp://keyserver.pgp.com #keyserver hkp://ipv4.pool.sks-keyservers.net #keyserver hkp://keys.gnupg.net - +keyserver hkp://keyring.debian.org # more secure, but had problems with my gpg version #keyserver hkps://hkps.pool.sks-keyservers.net diff --git a/switch-mail-host b/switch-mail-host index 3264224..2d74ceb 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -24,7 +24,7 @@ EOF update_wrt=true # default temp=$(getopt -l help owh "$@") || usage 1 -mp_args= +mp_args="-m /o,/q,/a" eval set -- "$temp" while true; do case $1 in diff --git a/system-status b/system-status index f39f031..c92bc9a 100755 --- a/system-status +++ b/system-status @@ -6,15 +6,13 @@ if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR - +source /a/bin/errhandle/err status_file=/dev/shm/iank-status shopt -s nullglob shopt -s dotglob -lo() { /usr/local/bin/log-once -1 "$@"; } +lo() { /usr/local/bin/log-once "$@"; } write-status() { chars=() @@ -26,7 +24,7 @@ write-status() { glob=(/m/md/bounces/new/*) if [[ -e $glob ]]; then chars+=("BOUNCE!") - lo bounce "message in /m/md/bounces/new" + lo -1 bounce "message in /m/md/bounces/new" fi glob=(/m/md/alerts/new/* /m/md/alerts/cur/*) if [[ -e $glob ]]; then @@ -34,17 +32,17 @@ write-status() { fi if [[ -e /nocow/user/mailtest-failure ]]; then chars+=("MAILPING!") - lo mailping "mailtest-check didnt see mail from send-test-forward" fi if [[ -s /var/log/exim4/paniclog ]]; then chars+=("PANIC!") - tail /var/log/exim4/paniclog | lo paniclog + tail /var/log/exim4/paniclog | lo -1 paniclog fi source /a/bin/bash_unpublished/source-state if [[ $MAIL_HOST == $HOSTNAME ]]; then if [[ $(systemctl is-active btrbk.timer) != active ]]; then - chars+=("BTRBK-TIMER!") + chars+=("BTRBK.TIMER!") + lo -60 btrbk.timer "btrbk.timer not enabled" fi ## check if last snapshot was within an hour @@ -61,6 +59,7 @@ write-status() { done if (( maxtime < now - 60*60 )); then chars+=("OLD-SNAPSHOT!") + lo -1 old-snapshot "/o snapshot older than 1 hour" fi fi -- 2.30.2