This is a *MIRROR* of the OpenSMTPD repository, but feel free to fork and submit pull requests !
Switch branches/tags
opensmtpd-201801101641p1 opensmtpd-201801101639 opensmtpd-201801101420p1 opensmtpd-201801101413 opensmtpd-201702130941p1 opensmtpd-201702130936 opensmtpd-201609141253p1 opensmtpd-201609141252 opensmtpd-201607021504p1 opensmtpd-201607021503 opensmtpd-201606220754p1 opensmtpd-201606220753 opensmtpd-201606152203p1 opensmtpd-201606152202 opensmtpd-201606071034p1 opensmtpd-201606062303p1 opensmtpd-201606062256 opensmtpd-201606062256p1 opensmtpd-201605221711p1 opensmtpd-201605221710 opensmtpd-201602131907p1 opensmtpd-201602131612 opensmtpd-201602131612p1 opensmtpd-201602120826p1 opensmtpd-201602120824 opensmtpd-201602031446p1 opensmtpd-201602031443 opensmtpd-201601051911p1 opensmtpd-201601051902 opensmtpd-201506112227p1 opensmtpd-201506112224 opensmtpd-201506020910p1 opensmtpd-201506020906 opensmtpd-201505241924p1 opensmtpd-201505241920 opensmtpd-201505121836p1 opensmtpd-201505121835 opensmtpd-201505091743 opensmtpd-201505091607p1 opensmtpd-201502012312p1 opensmtpd-201502012303 opensmtpd-201501060207p1 opensmtpd-201501060204 opensmtpd-201412241507p1 opensmtpd-201412241504 opensmtpd-201411052125p1 opensmtpd-201411052124 opensmtpd-201411042328p1 opensmtpd-201411042324 opensmtpd-201410152136p1 opensmtpd-201410152134 opensmtpd-201410131657p1 opensmtpd-201410131651 opensmtpd-201410040019p1 opensmtpd-201410040015 opensmtpd-201410012105p1 opensmtpd-201410012007 opensmtpd-201406192306p1 opensmtpd-201406192229 opensmtpd-201406192219p1 opensmtpd-201406192203 opensmtpd-201406190036p1 opensmtpd-201406190033 opensmtpd-201406170940p1 opensmtpd-201406110044p1 opensmtpd-201406110039 opensmtpd-201406061833p1 opensmtpd-201406061829 opensmtpd-201405202105p1 opensmtpd-201405202103 opensmtpd-201405142325p1 opensmtpd-201405142324 opensmtpd-201405142229 opensmtpd-201405142229p1 opensmtpd-201405121707p1 opensmtpd-201405121706 opensmtpd-201405121644p1 opensmtpd-201405121641 opensmtpd-201405071644p1 opensmtpd-201405071639 opensmtpd-201404151432p1 opensmtpd-201404151425 opensmtpd-201403261207p1 opensmtpd-201403261203 opensmtpd-201403051040p1 opensmtpd-201403051037 opensmtpd-201402281146p1 opensmtpd-201402281144 opensmtpd-201402271423p1 opensmtpd-201402271419 opensmtpd-201402071603p1 opensmtpd-201402071556 opensmtpd-201401311424p1 opensmtpd-201401311419 opensmtpd-201401241552p1 opensmtpd-201401241551 opensmtpd-201401231518p1 opensmtpd-201401231517 opensmtpd-201401202159p1 opensmtpd-201401202156
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
contrib
m4
mk
openbsd-compat
regress
smtpd
.gitattributes
.gitignore
INSTALL First import of opensmtpd-20090223 Nov 15, 2009
LICENSE
Makefile.am no longer build regress from regress Jun 6, 2013
README.md
THANKS
bootstrap require higher autoconf/automake versions and fix version check May 20, 2016
configure.ac

README.md

Preliminary note

OpenSMTPD is a FREE implementation of the server-side SMTP protocol as defined by RFC 5321, with some additional standard extensions.

It allows ordinary machines to exchange e-mails with other systems speaking the SMTP protocol.

OpenSMTPD runs on top of the OpenBSD operating system but also has a portable version that can build and run on several systems, including:

  • Linux
  • FreeBSD
  • NetBSD
  • DragonFly

For more information: http://www.opensmtpd.org/portable.html

People interested about OpenSMTPD are encouraged to subscribe to our mailing list: http://www.opensmtpd.org/list.html

and to join the IRC channel: #OpenSMTPD @ irc.freenode.net

Also note that we have a wiki at https://github.com/OpenSMTPD/OpenSMTPD/wiki that you are encouraged to contribute to.

Cheers!

How to build, configure and use Portable OpenSMTPD

Dependencies

Portable OpenSMTPD relies on:

Get the source

git clone -b portable git://github.com/OpenSMTPD/OpenSMTPD.git opensmtpd

or

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

Build

cd opensmtpd*
./bootstrap  # Only if you build from git sources
./configure
make
sudo make install

Special notes for FreeBSD/DragonFlyBSD/Mac OS X:

Please launch configure with special directive about libevent and libasr directory:

FreeBSD / DragonFlyBSD:

./configure --with-libasr=/usr/local

Mac OS X:

./configure --with-libevent=/opt/local --with-libasr=/opt/local

Install

sudo make install

Setup historical interface

OpenSMTPD provides a single utility smtpctl to control the daemon and the local submission subsystem.

To accomodate systems that require historical interfaces such as sendmail, newaliases or makemap, the smtpctl utility can operate in compatibility mode if called with the historical name.

On mailwrapper-enabled systems, this is achieved by editing /etc/mailer.conf and adding the following lines:

sendmail        /usr/sbin/smtpctl
send-mail       /usr/sbin/smtpctl
mailq           /usr/sbin/smtpctl
makemap         /usr/sbin/smtpctl
newaliases      /usr/sbin/smtpctl

Whereas on systems that don't provide mailwrapper, it can be achieved by setting the appropriate symbolic links:

ln -s /usr/sbin/smtpctl sendmail
ln -s /usr/sbin/smtpctl send-mail
ln -s /usr/sbin/smtpctl mailq
ln -s /usr/sbin/smtpctl makemap
ln -s /usr/sbin/smtpctl newaliases

The OpenSMTPD project leaves it up to the package maintainers to setup the links in their packages as it is very hard for us to accomodate all systems with the prefered method in a clean way.

Configure /etc/smtpd.conf

Please have a look at the complete format description of smtpd.conf configuration file (https://man.openbsd.org/smtpd.conf)

Add OpenSMTPD users

To operate, OpenSMTPD requires at least one user, by default _smtpd; and preferably two users, by default _smtpd and _smtpq.

Using two users instead of one will increase security by a large factor so... if you want to voluntarily reduce security or you have absolute more faith in our code than we do, by all means use one.

The instructions below assume the default users however, the configure script allows overriding these using the options: --with-user-smtpd, --with-user-queue, and --with-group-queue.

NetBSD, Linux (Debian, Arch Linux, ...)

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

DragonFlyBSD, FreeBSD

pw useradd _smtpd -c "SMTP Daemon" -d /var/empty -s /sbin/nologin
pw useradd _smtpq -c "SMTPD Queue" -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/_smtpd 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

repeat for the _smtpq user.

Launch smtpd

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

Then:

smtpd

or in debug and verbose mode

smtpd -dv