it is built-in. if you want a newer version, Postfix builds on NetBSD as well (see below).

echo $PKG_PATH
pkg_add py37-spf py37-policyd-spf
which policyd-spf

grep ^postfix /etc/defaults/rc.conf


export DEBIAN_FRONTEND=noninteractive
apt -y install postfix postfix-pcre bsd-mailx postfix-policyd-spf-python
#mailutils pmailq rsyslog

systemctl status postfix


slackpkg install postfix icu4c cyrus-sasl procmail ksh alpine
ldd /usr/sbin/postfix
ls -lhF /etc/rc.d/rc.postfix
chmod +x /etc/rc.d/rc.postfix


Building Postfix 3.x on slackware 14.2,current and NetBSD 7,8,9

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

slackware requirements

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

netbsd requirements

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

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]+:'

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).



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


vi src/util/sys_defs.h 

    || defined(NETBSD) \


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"
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


postfix/master[7421]: warning: process /usr/libexec/postfix/smtpd pid 7565 killed by signal 6
postfix/master[7421]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

ll /etc/postfix/
chown -R root:wheel /etc/postfix/

ll /usr/libexec/postfix/
chown -R root:wheel /usr/libexec/postfix/

ll /usr/sbin/post*
ll /usr/sbin/sendmail
chown root:wheel /usr/sbin/post*
chown root:wheel /usr/sbin/sendmail
chown root:maildrop /usr/sbin/postqueue
chown root:maildrop /usr/sbin/postdrop
chmod g+s /usr/sbin/postqueue
chmod g+s /usr/sbin/postdrop

ll /usr/bin/newaliases
ll /usr/bin/mailq
chown root:wheel /usr/bin/newaliases
chown root:wheel /usr/bin/mailq

getting this while building with PCRE on slackware

/usr/bin/ld: ../../lib/libutil.a(dict_pcre.o): in function `dict_pcre_close':
/root/tp/postfix-3.5.2/src/util/dict_pcre.c:395: undefined reference to `pcre_free_study'
/usr/bin/ld: /root/tp/postfix-3.5.2/src/util/dict_pcre.c:404: undefined reference to `pcre_free_study'
/usr/bin/ld: ../../lib/libutil.a(dict_pcre.o): in function `dict_pcre_lookup':
/root/tp/postfix-3.5.2/src/util/dict_pcre.c:316: undefined reference to `pcre_exec'
/usr/bin/ld: /root/tp/postfix-3.5.2/src/util/dict_pcre.c:355: undefined reference to `pcre_exec'

==> RTFM:


Postfix Installation From Source Code

NetBSD mail server with Postfix, BIND (for DNS), Dovecot, Pigeonhole (Sieve), SSL, DKIM and SPF

Complete (almost) Mail Server with NetBSD

Postfix PCRE Support

Postfix SASL Howto


Postfix and Dovecot SASL