clongeau / opensmtpd

This repository moved to
https://github.com/poolpOrg/OpenSMTPD/tree/portable
Other
13 stars 0 forks source link

Repository moved

This repository moved to the official OpenSMTPD github repository

Preliminary note

smtpd also known as OpenSMTPD is a smtp server implementation for OpenBSD. It is still a work in progress which still lacks many features.

Then, on top of that, all OpenSMTPD's features are not ported yet. For instance, authentification still doesn't work.

People interested about portable OpenSMTPD, or about OpenSMTPD in general, are encouraged to join the IRC channel #opensmtpd @ FreeNode.net.

How to use Portable OpenSMTPD

Dependencies

OpenSMTPD relies on:

Get the source

git clone git://github.com/clongeau/opensmtpd.git

or

wget http://www.opensmtpd.org/archives/opensmtpd-latest.tar.gz
tar xzvf opensmtpd-latest.tar.gz

Build

cd opensmtpd  
./bootstrap  
./configure  
make  
sudo make install  

Special notes for FreeBSD/DragonFlyBSD/Mac OS X:

Please launch configure with special directive about libevent directory:

FreeBSD:

./configure --with-libevent-dir=/usr/local

DragonFlyBSD:

./configure --with-libevent-dir=/usr/pkg

Mac OS X:

./configure --with-libevent-dir=/opt/local
make CFLAGS="-DBIND_8_COMPAT=1"

Install

sudo make install    

Configure /etc/smtpd.conf

Please have a look at the complete format description of smtpd.conf configuration file

Add _smtpd user

NetBSD, Linux (Debian, ArchLinux, ...)

mkdir /var/empty  
useradd -c "SMTP Daemon" -d /var/empty -s /sbin/nologin _smtpd

DragonFlyBSD, FreeBSD

pw useradd _smtpd -c "SMTP Daemon" -d /var/empty -s /sbin/nologin

Mac OS X

First we need a group with an unused GID below 500, list the current ones used:

/usr/bin/dscl . -list /Groups PrimaryGroupID | sort -n -k2,2

Add a group - here we have picked 444:

/usr/bin/sudo /usr/bin/dscl . -create /Groups/_smtpd PrimaryGroupID 444

Then the user. Again we need an unused UID below 500, list the current ones used:

/usr/bin/dscl . -list /Users UniqueID | sort -n -k2,2

Add a user - here we have picked 444:

/usr/bin/sudo /usr/bin/dscl . -create /Users/_smtpd UniqueID 444
/usr/bin/sudo /usr/bin/dscl . -delete /Users/_smtpd AuthenticationAuthority
/usr/bin/sudo /usr/bin/dscl . -delete /Users/_smtpd PasswordPolicyOptions
/usr/bin/sudo /usr/bin/dscl . -delete /Users/_smtpd dsAttrTypeNative:KerberosKeys
/usr/bin/sudo /usr/bin/dscl . -delete /Users/_smtpd dsAttrTypeNative:ShadowHashData
/usr/bin/sudo /usr/bin/dscl . -create /Users/_smtpd RealName "SMTP Daemon"
/usr/bin/sudo /usr/bin/dscl . -create /Users/_stmpd Password "*"
/usr/bin/sudo /usr/bin/dscl . -create /Users/_smtpd PrimaryGroupID 444
/usr/bin/sudo /usr/bin/dscl . -create /Users/_smtpd NFSHomeDirectory \
    /var/empty
/usr/bin/sudo /usr/bin/dscl . -create /Users/_smtpd UserShell /usr/bin/false

Launch smtpd

First, kill any running sendmail/exim/qmail/postfix or other.

Then:

smtpd &

or in debug and verbose mode

smtpd -dv

Manual pages