Stuck at home amidst Covid19 pandemic gave me the opporutinity to try out
FreeBSD & Mac OSX. Compared to Linux, I love the simplicity of FreeBSD.
I am pleased to announce indimail-mta
(qmail+ucspi-tcp+daemontools+serialmail) now compiles on FreeBSD
& OSX. There are however differences between the Linux & FreeBSD/OSX
versions
The source installation on Linux, FreeBSD, OSX have a script
default.configure for each and every package. This script has to be run
once before make. This script hides the complexities and vagaries of
various UNIX distributions. The steps have been tested on
a) All (suse, redhat, debian) Linux distributions
b) FreeBSD 12.1-RELEASE-p10
c) Darwin 19.6.0; root:xnu-6153.141.2~1/RELEASE_X86_64
The difference beween Linux, FreeBSD and OSX are
1. For wildcard address, tcpserver on FreeBSD has to open two sockets
(ipv4 + ipv6). This is to address the limitation of FreeBSD not routing
ipv4 traffic to AF_INET6 sockets) - (output of netstat -an)
Mac OSX: tcp46 0 0 *.25 *.* LISTEN
Linux : tcp6 0 0 :::25 :::* LISTEN
2. tcpserver uses dlmopen(3) on Linux to load qmail-smtpd, rblsmtpd shared
library objects. Since FreeBSD/OSX doesn't have dlmopen(3), dlopen(3) is
used instead.
3. The linux setup uses alternatives command to set aliases for sendmail,
mailq, newaliases. The FreeBSD setup (mailwrapper) uses
/etc/mail/mailer.conf. Mac OSX is broken. It doesn't allow
/usr/sbin/sendmail to be replaced with System Integrety Protection
enabled. Program/Scripts will have to use /usr/bin/sendmail or
qmail-inject
4. Linux setup uses /usr as the prefix. FreeBSD, OSX setup uses /usr/local.
On OSX, development files go to /opt/local/include, /opt/local/lib
5. Linux uses systemctl, FreeBSD uses /usr/local/etc/rc.d/svscan. On
FreeBSD, rc startup uses daemon(8) to start svscan in supervised mode.
Additionally, svscan does a setsid(2) to become a session leader.
OSX uses launchctl unit file /Library/LaunchDaemons/org.indimail.svsan
6. There aren't any binary package for FreeBSD/OSX. I don't know how to make
packages for FreeBSD/OSX. I will attempt this later.
7. FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581)
Apple clang version 12.0.0 on Mac OSX 19.6.0.
Linux gcc version 10.2.1 20200723 (Red Hat 10.2.1-1)
On FreeBSD, clang sets __GNUC__, making gnu configure always set
GCC=yes eventhough I don't have gcc installed. (see NOTE at the end on
this issue)
8. Mac OSX has a crippled crypt(3) function. So, on OSX, indimail-mta uses
internal crypt functions from libqmail (md5, sha256, sha512) for SMTP,
IMAP, POP3 authentication and user account password management.
9. Mac OSX doesn't have Name Service Switch (NSS). Hence on OSX,
indimail-mta cannot wrap calls like getpwnam, getpwent, getgrent to get
data from the IndiMail's MySQL database. Hence one has to write specific
auth modules for any IMAP/POP3 server that you may want to use with
indimail. On Linux & FreeBSD, you can use any IMAP/POP3 server without
modifying any code. No need to write code for creating authentication
modules. If your IMAP/POP3 has a PAM module that works, it will work
transparently with IndiMail users in MySQL database. On OSX you will be
restricted to use system accounts for IMAP/POP3 if you don't use
courier-imap. For courier-imap, indimail has a authmodule that works
on all platforms without PAM support.
Link to github source. The README comes with installation and setup
instructions.
Wiki for indimail-mta, indimail
Binary packages for Redhat/CentOS/Debian/Ubuntu
Docker Image Repository
Also updated for FreeBSD/Darwin is the indimail-virtualdomains package
indimail-3.3, indimail-auth, indimail-access, indimail-spamfilter
Both indimail-mta and indimail-virtualdomains use libqmail for common
functions.
NOTE: problem with clang on FreeBSD. Something I have broken my head and
spent hours trying to fix setting compiler specific flags with clang on
FreeBSD. clang defines __GNUC__ built-in compiler flag (probably to appears
compatable with GCC source code). Because of this test for gcc always
succeeds in configure and I am unable to set clang specific compiler flags.
clang claims to be gcc, which it is not
if test "$GCC" = "yes" ; then
CFLAGS="$CFLAGS -Wno-discarded-qualifiers"
else
CFLAGS="$CFLAGS -Wno-ignored-qualifiers"
CFLAGS="$CFLAGS -Wno-incompatible-pointer-types-discards-qualifiers -Wno-cast-align"
fi
below is the result in config.log
>>> configure:3071: checking whether we are using the GNU C compiler
>>> configure:3090: cc -c conftest.c >&5
>>> configure:3090: $? = 0
>>> configure:3099: result: yes
Darwin does something worse. It actually has a gcc command which is actually
clang
$ which gcc
gcc is /usr/bin/gcc
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c+
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ clang -v
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin