# MSG_ID is in /var/log/exim4/mainlog, looks like 1ccdnD-0001nh-EN
}
-# to test sieve, use below command. for fsf mail, see fsf-get-mail script.
+# to test sieve, use below command. for fsf mail, see offlineimap-sync script
# make modifications, then copy to live file, use -eW to actually modify mailbox
-# cp /p/c/subdir_files/sieve/personal{test,}.sieve; testsievelist -eW INBOX
#
# Another option is to use sieve-test SCRIPT MAIL_FILE. note,
# sieve-test doesnt know about envelopes, Im not sure if sieve-filter does.
# sieve with output filter. arg is mailbox, like INBOX.
# This depends on dovecot conf, notably mail_location in /etc/dovecot/conf.d/10-mail.conf
-testsievelist() {
- sieve-filter ~/sieve/maintest.sieve "$@" >/tmp/testsieve.log 2> >(tail) && sed -rn '/^Performed actions:/{n;n;p}' /tmp/testsieve.log | sort -u
+_dosieve() {
+ sieve-filter "$@" 2> >(head; tail) >/tmp/testsieve.log && sed -rn '/^Performed actions:/,/^[^ ]/{/^ /p}' /tmp/testsieve.log | sort | uniq -c
}
-
-# mail related
-# plain sieve
+# always run this first, edit the test files, then run the following
testsieve() {
- sieve-filter ~/sieve/main.sieve "$@"
+ _dosieve ~/sieve/maintest.sieve INBOX delete
+}
+runsieve() {
+ c ~/sieve; cp personal{test,}.sieve; cp lists{test,}.sieve
+ _dosieve ~/sieve/main.sieve -eW INBOX delete
}
# mail related
if [[ $HOSTNAME == $MAIL_HOST ]]; then
+ # mail.iankelling.org so local imap clients can connect with tls and
+ # when they happen to not be local.
+ sed -ri -f - /etc/hosts <<'EOF'
+/^127\.0\.1\.1.* mail\.iankelling\.org\b/q
+/^127\.0\.1\.1 /s/ *$/ mail.iankelling.org/
+EOF
+ /a/exe/cedit mail /etc/dnsmasq-servers.conf <<'EOF' || [[ $? == 1 ]]
+server=/mail.iankelling.org/127.0.1.1
+EOF
+ systemctl reload dnsmasq
+
debconf-set-selections <<EOF
# Mail Server configuration
# -------------------------
systemctl restart dovecot
else # $HOSTNAME != $MAIL_HOST
+ # remove mail. 2 lines to properly remove whitespace
+ sed -ri -f - /etc/hosts <<'EOF'
+s#^(127\.0\.1\.1 .*) +mail\.iankelling\.org$#\1#
+s#^(127\.0\.1\.1 .*)mail\.iankelling\.org +(.*)#\1\2#
+EOF
+
+ echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]]
+ systemctl reload dnsmasq
+
systemctl disable offlineimapsync.timer &>/dev/null ||:
systemctl stop offlineimapsync.timer &>/dev/null ||:
systemctl disable mailclean.timer &>/dev/null ||:
dir=/nocow/exim4
sdir=/var/spool/exim4
# we only do this if our system has $dir
-if [[ -e /nocow && $(readlink -f $sdir) != $dir ]]; then
- systemctl stop exim4
- if [[ ! -e $dir && -d $sdir ]]; then
- mv $sdir $dir
+
+# this used to do a symlink, but, in the boot logs, /nocow would get mounted succesfully,
+# about 2 seconds later, exim starts, and immediately puts into paniclog:
+# honVi-0000u3-82 Failed to create directory "/var/spool/exim4/input": No such file or directory
+# so, im trying a bind mount to get rid of that.
+if [[ -e /nocow ]]; then
+ if ! grep -Fx "/nocow/exim4 /var/spool/exim4 none bind 0 0" /etc/fstab; then
+ echo "/nocow/exim4 /var/spool/exim4 none bind 0 0" >> /etc/fstab
+ fi
+ if ! mountpoint -q $sdir; then
+ systemctl stop exim4
+ if [[ -L $sdir ]]; then
+ rm $sdir
+ fi
+ if [[ ! -e $dir && -d $sdir ]]; then
+ mv $sdir $dir
+ fi
+ if [[ ! -d $sdir ]]; then
+ mkdir $sdir
+ chmod 000 $sdir # only want it to be used when its mounted
+ fi
+ mount $sdir
fi
- /a/exe/lnf -T $dir $sdir
fi
systemctl restart exim4
--- /dev/null
+require [ "regex", "variables", "fileinto", "envelope", "mailbox", "imap4flags", "include" ];
+
+if anyof (
+ header :contains "list-id" "<debian-security-announce.lists.debian.org>",
+ header :contains "list-id" "<ubuntu-security-announce.lists.ubuntu.com>"
+ ) {
+ fileinto :create "sec";
+ stop;
+ }
+if anyof (
+ header :regex "list-id" "forum.members.fsf.org>"
+ ) {
+ fileinto :create "fsfmembers";
+ stop;
+ }
+
+if anyof (
+ header :contains "list-id" "<mentors.lists.outreachy.org>"
+ ) {
+ fileinto :create "l/outreachy-mentors";
+ stop;
+ }
+
+if anyof (
+ header :contains "list-id" "<bbdb-info.lists.sourceforge.net>",
+ header :contains "list-id" "<bug-bash.gnu.org>",
+ header :contains "list-id" "<bug-gnu-emacs.gnu.org>",
+ header :contains "list-id" "<debian-backports.lists.debian.org>",
+ header :contains "list-id" "<debian-security-announce.lists.debian.org>",
+ header :contains "list-id" "<debian-user.lists.debian.org>",
+ header :contains "list-id" "<ding.gnus.org>",
+ header :contains "list-id" "<emacs-devel.gnu.org>",
+ header :contains "list-id" "<emacs-orgmode.gnu.org>",
+ header :contains "list-id" "<git.vger.kernel.org>",
+ header :contains "list-id" "<help-bash.gnu.org>",
+ header :contains "list-id" "<help-gnu-emacs.gnu.org>",
+ header :contains "list-id" "<hyperkitty-devel.lists.fedorahosted.org>",
+ header :contains "list-id" "<ipxe-devel.lists.ipxe.org>",
+ header :contains "list-id" "<kplug-list.kernel-panic.org>",
+ header :contains "list-id" "<kplug-newbie.kernel-panic.org>",
+ header :contains "list-id" "<libreplanet-discuss.libreplanet.org>",
+ header :contains "list-id" "<linux-btrfs.vger.kernel.org>",
+ header :contains "list-id" "<linux-fai.uni-koeln.de>",
+ header :contains "list-id" "<license-discuss.lists.opensource.org>",
+ header :contains "list-id" "<linux-fai-devel.uni-koeln.de>",
+ header :contains "list-id" "<linux-libre.fsfla.org>",
+ header :contains "list-id" "<maru-os-dev.googlegroups.com>",
+ header :contains "list-id" "<mediawiki-l.lists.wikimedia.org>",
+ header :contains "list-id" "<pywikibot.lists.wikimedia.org>",
+ header :contains "list-id" "<pywikipedia-l.lists.wikimedia.org>",
+ header :contains "list-id" "<unison-hackers.lists.seas.upenn.edu>",
+ header :contains "list-id" "<unison-users.yahoogroups.com>",
+ header :contains "list-id" "<whispersystems.lists.riseup.net>",
+ header :contains "list-id" "<wikitech-l.lists.wikimedia.org>",
+ header :contains "list-id" "<xapian-devel.lists.xapian.org>",
+ header :contains "list-id" "<kdeconnect.kde.org>",
+ header :contains "list-id" "<mu-discuss.googlegroups.com>",
+ header :contains "list-id" "<<devel.mediagoblin.org>",
+ header :contains "list-id" "<maru-os.googlegroups.com>",
+ header :contains "list-id" "<listhelper-moderate.nongnu.org>",
+ header :contains "list-id" "<coreboot.coreboot.org>",
+ header :contains "list-id" "<mailman-users.python.org>",
+ header :contains "list-id" "<duplicity-talk.nongnu.org>",
+ header :contains "list-id" "<qemu-devel.nongnu.org>",
+ header :contains "list-id" "<exim-dev.exim.org>",
+ header :contains "list-id" "<exim-users.exim.org>",
+ header :contains "list-id" "<octave-maintainers.gnu.org>",
+ header :contains "list-id" "<discuss-gnuradio.gnu.org>",
+ header :contains "list-id" "<seabios.seabios.org>",
+ header :contains "list-id" "<freetype-devel.nongnu.org>",
+ header :contains "list-id" "<xmonad.haskell.org>") {
+ if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
+ set :lower "listname" "${1}";
+ fileinto :create "l/${listname}";
+ }
+ }
+if anyof (
+ header :contains "list-id" "<websites.lists.fedoraproject.org>",
+ header :contains "list-id" "<docs.lists.fedoraproject.org>",
+ header :contains "list-id" "<users.lists.fedoraproject.org>") {
+ if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
+ set :lower "listname" "${1}";
+ fileinto :create "l/fedora.${listname}";
+ }
+ }
+
+if anyof (
+ header :contains "list-id" "<activists_masspirates.org.lists.mayfirst.org>",
+ header :contains "list-id" "<gnu-prog-discuss.gnu.org>",
+ header :contains "list-id" "<gnu-prog.gnu.org>",
+ header :contains "list-id" "<gnu-community-private.gnu.org>",
+ header :contains "list-id" "<gvc.gnu.org>",
+ header :contains "list-id" "<discuss.blu.org>",
+ header :contains "list-id" "<Spdx-tech.lists.spdx.org>",
+ header :contains "list-id" "<Spdx-legal.lists.spdx.org>",
+ header :contains "list-id" "<info-gnu.gnu.org>",
+ header :contains "from" "<general-info@artisansasylum.com>",
+ header :contains "list-id" "<spdx.lists.spdx.org>"
+ ) {
+ fileinto :create "community";
+ stop;
+ }
+
+if allof (
+ address :is "from" "mailman-owner@zope.org",
+ header :is "subject" "zope.org mailing list memberships reminder"
+ ) {
+ discard;
+ stop;
+ }