MT6 vpopmail

From The Network People, Inc. - Wiki
Jump to navigation Jump to search
Mail Toaster 6
Start Installation
FreeBSD Upgrade
DNS Upgrade
MySQL Upgrade
ClamAV Upgrade
AVG Upgrade
SpamAssassin Upgrade
Rspamd Upgrade
dspam Upgrade
Vpopmail Upgrade
Haraka Upgrade
Haproxy Upgrade
webmail Upgrade
Monitor Upgrade
testing

Install vpopmail dependencies

jailmanage vpopmail
pkg install -y netqmail daemontools ucspi-tcp mysql56-client gmake maildrop

install qmail with custom options

grep netqmail /etc/make.conf || cat << EO_QMAIL_MAKE >> /etc/make.conf
mail_qmail_SET=BIG_CONCURRENCY_PATCH DNS_CNAME DOCS MAILDIRQUOTA_PATCH
mail_qmail_UNSET=RCDLINK
EO_QMAIL_MAKE
make -C /usr/ports/mail/qmail deinstall install clean

configure qmail

Disable sendmail and enable qmail:

/var/qmail/scripts/enable-qmail

Tell qmail our hostname:

echo 'mail.example.com' > /var/qmail/control/me


Install Vpopmail

Consider whether to store the user databases in CDB (default) or MySQL. CDB is best for small sites, where the overhead of MySQL isn't worth it. When thousands of email accounts are active, MySQL scales better.

grep vpopmail /etc/make.conf  || cat << EO_VPOPMAIL >> /etc/make.conf
mail_vpopmail_SET=CLEAR_PASSWD
mail_vpopmail_UNSET=ROAMING
EO_VPOPMAIL
make -C /usr/ports/mail/vpopmail deinstall install clean

To configure mysql storage, update the credentials:

sed -i .bak -e 's/localhost/127.0.0.4/' /usr/local/vpopmail/etc/vpopmail.mysql
sed -i .bak -e 's/root/vpopmail/' /usr/local/vpopmail/etc/vpopmail.mysql
sed -i .bak -e 's/secret/pass.From.Mysql.Setup/' /usr/local/vpopmail/etc/vpopmail.mysql

Create a mail domain

~vpopmail/bin/vadddomain MY.DOMAIN  CHANGE.THIS.PASSWORD

Install startup scripts & qmail-deliverabled

fetch -o /root/install_qmail.sh http://mail-toaster.com/install/mt6-qmail-run.txt
sh /root/install_qmail.sh

See that the services are running:

# svstat /service/*
/service/qmail-deliverabled: up (pid 30890) 15 seconds
/service/qmail-send: up (pid 30892) 15 seconds
/service/qmail-smtpd: up (pid 30893) 15 seconds
/service/vpopmaild: up (pid 30887) 15 seconds

Yay.

Install Dovecot

Dovecot provides POP3 and IMAP services.

pkg install -y dovecot2
grep dovecot /etc/make.conf  || cat << EO_DOVECOT >> /etc/make.conf
mail_dovecot2_SET=VPOPMAIL LIBWRAP EXAMPLES
EO_DOVECOT
make -C /usr/ports/mail/dovecot2 deinstall install clean

Enable at least: examples, libwrap, and vpopmail.

Configure Dovecot

cd /usr/local/etc/dovecot
cp -r example-config/* .
fetch -o local.conf http://mail-toaster.org/etc/mt6-dovecot.conf
sed -i .bak -e 's/^#listen = \*, ::/listen = \*/' dovecot.conf
sed -i .bak -e 's/certs\/dovecot.pem/certs\/server.crt/' conf.d/10-ssl.conf
sed -i .bak -e 's/private\/dovecot.pem/private\/server.key/' conf.d/10-ssl.conf
sed -i .bak -e 's/^\!include auth-system/#\!include auth-system/' conf.d/10-auth.conf

Start Dovecot

echo 'dovecot_enable=YES' >> /etc/rc.conf
service dovecot start

Install Qmailadmin

pkg install -y autorespond cracklib ezmlm-idx autoconf automake
cat << EO_QMAILADMIN_MAKE >> /etc/make.conf
mail_qmailadmin_SET=CRACKLIB HELP IDX MODIFY_QUOTA SPAM_DETECTION TRIVIAL_PASSWORD USER_INDEX
mail_qmailadmin_UNSET=CATCHALL IDX_SQL
EO_QMAILADMIN_MAKE
export WEBDATADIR=www/data CGIBINDIR=www/cgi-bin CGIBINSUBDIR=qmailadmin
make -C /usr/ports/mail/qmailadmin install clean

install lighttpd

pkg install -y lighttpd
cd /usr/local/etc/lighttpd
sed -i .bak -e 's/server.use-ipv6 = "enable"/server.use-ipv6 = "disable"/' lighttpd.conf
sed -i .bak -e 's/^\$SERVER\["socket"\]/#\$SERVER\["socket"\]/' lighttpd.conf
cat << EO_LIGHTTPD >> lighttpd.conf

server.modules += ( "mod_alias" )

alias.url = ( "/cgi-bin/"        => "/usr/local/www/cgi-bin/",
              "/qmailadmin/"      => "/usr/local/www/data/qmailadmin/",
              "/sqwebmail/"        => "/usr/local/www/sqwebmail/",
              "/isoqlog/images/" => "/usr/local/share/isoqlog/htmltemp/images/",
           )

server.modules += ( "mod_cgi" )
\$HTTP["url"] =~ "^/cgi-bin" {
   cgi.assign = ( "" => "" )
}
EO_LIGHTTPD
grep lighttpd_enable /etc/rc.conf || echo 'lighttpd_enable=YES' >> /etc/rc.conf
service lighttpd start

install maildrop mailfilter

fetch -o /etc/mailfilter http://mail-toaster.com/install/mt6-mailfilter.txt
chown vpopmail:vchkpw /etc/mailfilter
chmod 600 /etc/mailfilter