POSTFIX FROM SCRATCH

building postfix 3.x on slackware and netbsd

Why build from scratch? So we get PCRE, DOVECOT-SASL and LIBSPF2 up and running.

REQUIREMENTS

netbsd

although we are going to use Dovecot’s implementation of SASL, we could not get around this library

pkg_add cyrus-sasl
#cd /usr/pkgsrc/security/cyrus-sasl/
#make install
ll /usr/pkg/lib/sasl2/ #old
ll /usr/pkg/etc/sasl2/ #new
#security/cy2-crammd5
#security/cy2-gssapi

also we are going to enable SPF

pkg_add py-policyd-spf
#cd /usr/pkgsrc/mail/py-policyd-spf/
#make install

also make sure you’ve got those

    grep postfix /etc/passwd
    grep postfix /etc/group
    grep maildrop /etc/group

how many cores for make jobs?

dmesg | egrep '] cpu[0-9]+:'

slackware

for receiving keys through GPG

slackpkg install nghttp2 brotli cyrus-sasl

for building

slackpkg install guile gc db48 glibc kernel-headers m4 pcre

how many cores for make jobs?

grep ^proc /proc/cpuinfo

fetching the source

grab the latest release from a mirror and the .gpg2 signature. The .gpg1 one is using Wietse old and revoked key (C12BCD99).

ver=3.5.2

#FRANCE
#mirror=http://postfix.mirrors.ovh.net
#BULGARIA
mirror=http://mirror.host.ag/postfix

wget $mirror/postfix-release/official/postfix-$ver.tar.gz
wget $mirror/postfix-release/official/postfix-$ver.tar.gz.gpg2

you can use GPG v1

gpg --verify postfix-$ver.tar.gz.gpg2 postfix-$ver.tar.gz
gpg --recv-keys 80CA15A7
gpg --verify postfix-$ver.tar.gz.gpg2 postfix-$ver.tar.gz

you should have a good signature with this fingerprint

Primary key fingerprint: 622C 7C01 2254 C186 6774  69C5 0C0B 590E 80CA 15A7

extract it and compile with SSL and SASL

tar xzf postfix-$ver.tar.gz
cd postfix-$ver/

netbsd specific

vi makedefs

   NetBSD*) SYSTYPE=NETBSD

vi src/util/sys_defs.h 

    || defined(NETBSD) \

BUILD

build postfix

make tidy
make makefiles CCARGS="-I/usr/local/include -DHAS_PCRE -DUSE_TLS -DUSE_SASL_AUTH" AUXLIBS="-L/usr/lib64 -L/usr/local/lib -lpcre -lssl -lcrypto"
#-DDEF_SERVER_SASL_TYPE=\"dovecot\"
time nice make -j2 > ../postfix.log && echo BUILT
make install

…eventually accept all the defaults, overriding system’s built-in version

which postfix
which postconf
postconf -d | grep mail_version

check that you got Dovecot SASL enabled

postconf -a

check configuration

postfix check && echo ok

RESOURCES

Postfix Installation From Source Code http://www.postfix.org/INSTALL.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | NU | HTML5
Copyright © 2022 Pierre-Philipp Braun