The No-Database email Server on Devuan Chimaera

Big email providers suck. So here is my no-database email server that can be run on a small cheap Linux based VPS.

Commands

apt-get update && apt-get upgrade
apt-get install postfix postfix-pcre dovecot-imapd dovecot-pop3d dovecot-submissiond dovecot-core spamassassin postgrey unbound
apt-get install opendkim opendkim-tools postfix-policyd-spf-perl --no-install-recommends
mkdir -p /var/mailboxes/offcorp.ca
chown -R mailuser:mailuser /var/mailboxes
mkdir -p /etc/postfix/tls && cd /etc/postfix/tls
openssl req -new -x509 -nodes -newkey rsa:4096 -keyout mail.key -out mail.crt -days 3650
groupadd -g 2000 mailuser
useradd -g mailuser -u 2000 mailuser -d /var/mailboxes -m
ln -s /usr/lib/dovecot/dovecot-lda /usr/local/bin/dovecot-lda
chown postfix:mailuser /var/run/dovecot/stats-writer
chmod 660 /var/run/dovecot/stats-writer
chown postfix:dovecot /run/dovecot/auth-client
mkdir -p /var/log/dovecot
touch /var/log/dovecot/dovecot.log
chown -R dovecot:mailuser /var/log/dovecot
chmod 660 /var/log/dovecot/dovecot.log
mkdir /etc/postfix/dkimkeys
opendkim-genkey -D /etc/postfix/dkimkeys -d <yourdomain.tld> -s <buttercup>
groupadd spamcheck
useradd -g spamcheck -u 2001 spamcheck -d /home/spamcheck -m
mkdir /var/satemp
chown -R spamcheck:spamcheck /home/spamcheck
service postfix restart
service opendkim restart
service dovecot restart
service spamassassin restart

Other stuff

There is also the need to publish SPF and DKIM records to DNS

Backups

#!/bin/bash
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/etc/dovecot .
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/etc/postfix .
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/etc/postgrey .
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/etc/spamassassin .
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/etc/unbound .
scp -i ~/shared/data/sshkeys/2021-01-12.key root@buttercup.snork.ca:/etc/opendkim.conf .
scp -i ~/shared/data/sshkeys/2021-01-12.key -r root@buttercup.snork.ca:/var/mailboxes .

Restores

#!/bin/bash
scp -i ~/shared/data/sshkeys/2021-01-12.key -r dovecot root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key -r postfix root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key -r postgrey root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key -r unbound root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key -r spamassassin root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key opendkim.conf root@buttercup.snork.ca:/etc/
scp -i ~/shared/data/sshkeys/2021-01-12.key -r mailboxes root@buttercup.snork.ca:/var/
chown -R mailuser:mailuser /var/mailboxes
chown postfix:mailuser /var/run/dovecot/stats-writer
chmod 660 /var/run/dovecot/stats-writer
chown postfix:dovecot /run/dovecot/auth-client
chown -R dovecot:mailuser /var/log/dovecot
chmod 660 /var/log/dovecot/dovecot.log
chown -R spamcheck:spamcheck /home/spamcheck
cd /etc/postfix
postmap snork.transport.passwd
postmap snork.mailboxes
postmap snork.aliases
sed -i 's/^/#/' /etc/resolv.conf
echo "nameserver 127.0.0.99" >> /etc/resolv.conf
service unbound restart
service postfix restart
service opendkim restart
service dovecot restart
service spamassassin restart
technotes/the_no-database_email_server_on_devuan_chimaera.txt · Last modified: 2023-08-06 19:33 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki