X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=8da3a657655ea723f3b715cafa56d1db2f62d421;hb=46bcc5c1876aed04c2a4111a6ddd887951238ed6;hp=22d1e3ddd3d4bdbfffa37142e4a6de720b50275d;hpb=f46ee5570766081a5a73ce0d2132c8a06ee966fb;p=distro-setup diff --git a/mail-setup b/mail-setup index 22d1e3d..8da3a65 100755 --- a/mail-setup +++ b/mail-setup @@ -3,6 +3,27 @@ # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later +# Things I tend to forget. on MAIL_HOST, daemon runs with /etc/exim4/my.conf, +# due to /etc/default/exim4 containing: +# COMMONOPTIONS='-C /etc/exim4/my.conf' +# UPEX4OPTS='-o /etc/exim4/my.conf' +# +# The non-daemon config +# gets generated from this script calling update-exim4.conf -d /etc/myexim4 +# which has log path +# log_file_path = /var/log/exim4/my%s +# +# eximbackup folder is /bu/md +# it is cleaned up by mail-backup-clean, which is run by btrbk-run + +# shellcheck disable=SC2254 # makes for a lot of unneeded quotes + + +# perusing through /el/mainlog without test messages: +# &!testignore|jtuttle| +# +#&! testignore|jtuttle|eximbackup|/usr/sbin/exim4 -bpu + # todo: check new macro DKIM_TIMESTAMPS # todo: check if REMOTE_SMTP_INTERFACE or REMOTE_SMTP_TRANSPORTS_HEADERS_REMOVE can simplify my or fsfs config @@ -328,9 +349,19 @@ soff () { done } sre() { + local enabled for service; do m systemctl restart $service - m systemctl enable $service; + # Optimization for exim, + # is-enabled: 0m0.015s + # enable: 0m0.748s + # It is related to this message: + # exim4.service is not a native service, redirecting to systemd-sysv-install. + # Executing: /lib/systemd/systemd-sysv-install enable exim4 + enabled=$(systemctl is-enabled $service 2>/dev/null ||:) + if [[ $enabled != enabled ]]; then + m systemctl enable $service + fi done } mailhost() { @@ -1258,7 +1289,7 @@ delay_warning_condition = ${if or {\ # enable 587 in addition to the default 25, so that # i can send mail where port 25 is firewalled by isp -daemon_smtp_ports = 25 : 587 +daemon_smtp_ports = 25 : 587 : 10025 # default of 25, can get stuck when catching up on mail smtp_accept_max = 400 smtp_accept_reserve = 100 @@ -1730,6 +1761,7 @@ if mailhost; then # # setup chgrp www-data in ./conflink pi-nostart radicale + m usermod -a -G radicale iank u /etc/systemd/system/radicale.service.d/override.conf <&2 - # rm -fv composer-setup.php - # exit 1 - # fi - # m php composer-setup.php --quiet - # rm -fv composer-setup.php - # m mv composer.phar /usr/local/bin - - # the above method gets composer2, carddav plugin at least doesnt work with that - # yet, it was just released 10-24-2020. - m cd /usr/local/bin - m wget -nv -N https://getcomposer.org/composer-1.phar - chmod +x composer-1.phar + cd /usr/local/bin + EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + + if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] + then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 + fi + + php composer-setup.php --quiet + rm composer-setup.php + + # based on error when running composer + mkdir /var/www/.composer + chown www-data:www-data /var/www/.composer + ### end composer install rcdirs=(/usr/local/lib/rcexpertpath /usr/local/lib/rcninja) @@ -2359,7 +2393,7 @@ EOF verf=$rcdir/plugins/carddav/myversion upgrade=false install=false - v=4.0.0 + v=5.0.1 if [[ -e $verf ]]; then if [[ $(cat $verf) != "$v" ]]; then install=true @@ -2371,16 +2405,16 @@ EOF if $install; then m rm -rf $rcdir/plugins/carddav tmpd=$(mktemp -d) - m wget -nv -O $tmpd/t.tgz https://github.com/blind-coder/rcmcarddav/releases/download/v$v/carddav-v$v.tgz + m wget -nv -O $tmpd/t.tgz https://github.com/blind-coder/rcmcarddav/releases/download/v$v/carddav-v$v.tar.gz cd $rcdir/plugins tar xzf $tmpd/t.tgz rm -rf $tmpd m chown -R www-data:www-data $rcdir/plugins/carddav m cd $rcdir/plugins/carddav if $upgrade; then - m sudo -u www-data composer-1.phar update --no-dev + m sudo -u www-data composer.phar update --no-dev else - m sudo -u www-data composer-1.phar install --no-dev + m sudo -u www-data composer.phar install --no-dev fi m chown -R root:root $rcdir/plugins/carddav echo $v >$verf @@ -2630,7 +2664,13 @@ fi ncbase=$1 cd /var/www/$ncbase # https://docs.nextcloud.com/server/22/admin_manual/maintenance/update.html?highlight=updater+phar +# the docs claim this is all you need, which is not true. +# You will go to the web ui and it will say that you need to click a button to update, +# or that you can run occ upgrade m php /var/www/$ncbase/updater/updater.phar -n +# throw a sleep in just because who knows what else is undocumented +sleep 5 +./occ upgrade EOFOUTER chmod +x /usr/local/bin/ncup @@ -2833,6 +2873,9 @@ EOF # ** $MAIL_HOST|bk) $MAIL_HOST|bk) + cat >>/etc/exim4/update-exim4.conf.conf <