OpenBSD mailing lists with Mailman

nabbisen profile image Heddi Nabbisen Updated on ・3 min read


With mail servers, Just forwarding emails to multiple addresses is easy.
Also, we can build an advanced mailing list system.
This post is about how to build a GNU Mailman server on OpenBSD.


  • OS: OpenBSD 6.7
  • MTA (Mail Transfer Agent): OpenSMTPD
  • Mailing List Server: GNU Mailman 2.1


The package manager is available and useful because it provides well-configured setting files as well as applications.
Just run:

# pkg_add mailman

The result is:

quirks-3.325 signed on 2020-06-04T16:43:21Z
mailman-2.1.32:python-2.7.18p0: ok
mailman-2.1.32:py-setuptools-41.6.0v0: ok
mailman-2.1.32:py-dnspython-1.16.0p2: ok
File /var/spool/mailman/data/sitelist.cfg could not be installed:
    No such file or directory
mailman-2.1.32: ok
The following new rcscripts were installed: /etc/rc.d/mailman
See rcctl(8) for details.
New and changed readme(s):

Well, it is useful to read /usr/local/share/doc/pkg-readmes/mailman above.

Then, edit the config file:

# # (optional) make a backup beforehand:
# # cp -p /usr/local/lib/mailman/Mailman/mm_cfg.py /usr/local/lib/mailman/Mailman/mm_cfg.py.org

# nvim /usr/local/lib/mailman/Mailman/mm_cfg.py

to add the lines in the end of the file:

  # Put YOUR site-specific settings below this line.
+ MAILMAN_GROUP = '_mailman'
+ MAILMAN_USER = '_mailman'

It is because, without them, the errors below occur at starting the mailman daemon:

    gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2]
KeyError: 'getgrnam(): name not found: '
    uid = pwd.getpwnam(mm_cfg.MAILMAN_USER)[2]
KeyError: 'getpwnam(): name not found: '

Next, you need to create the first list in order to escape from the error at starting the mailman daemon:

Site list is missing: mailman

The detail is here in the official documentation.

Run the Mailman command:

# /usr/local/lib/mailman/bin/newlist mailman

which is followed by:

Enter the email of the person running the list: <your@email.address>
Initial mailman password: 
To finish creating your mailing list, you must edit your /etc/aliases (or
equivalent) file by adding the following lines, and possibly running the
`newaliases' program:

## mailman mailing list
mailman:              "|/usr/local/lib/mailman/mail/mailman post mailman"
mailman-admin:        "|/usr/local/lib/mailman/mail/mailman admin mailman"
mailman-bounces:      "|/usr/local/lib/mailman/mail/mailman bounces mailman"
mailman-confirm:      "|/usr/local/lib/mailman/mail/mailman confirm mailman"
mailman-join:         "|/usr/local/lib/mailman/mail/mailman join mailman"
mailman-leave:        "|/usr/local/lib/mailman/mail/mailman leave mailman"
mailman-owner:        "|/usr/local/lib/mailman/mail/mailman owner mailman"
mailman-request:      "|/usr/local/lib/mailman/mail/mailman request mailman"
mailman-subscribe:    "|/usr/local/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe:  "|/usr/local/lib/mailman/mail/mailman unsubscribe mailman"

Hit enter to notify mailman owner...

In order to follow the messages, edit it:

# nvim /etc/mail/aliases

and run:

# newaliases
/etc/mail/aliases: xx aliases

As it is written in /usr/local/share/doc/pkg-readmes/mailman, it is necessary to add a group to the MTA user:

# usermod -G _mailmanq _smtpd

It is almost done.

Well, optionally, I had two additional modification.

#1. I had to modify /etc/mail/smtpd.conf to let OpenSMTPD accept requests from egress to the mailing list domain.
I modified /etc/mail/smtpd.conf like:

  listen on egress \
          tls pki <pki> \
          auth-optional \
          tag MTA
  action "local" maildir alias <aliases>
+ match tag MTA   from any                for domain "<fqdn>" action "local"

#2. I set up default list settings.

# nvim /usr/local/lib/mailman/Mailman/mm_cfg.py
  # Put YOUR site-specific settings below this line.
+ DEFAULT_URL_HOST = '<mail-server-fqdn>'
+ DEFAULT_EMAIL_HOST = '<mailing-list-domain>'

Let's start the mailing list system:

# rcctl -f -d start mailman
doing _rc_parse_conf
doing _rc_quirks
mailman_flags empty, using default >-s start<
doing _rc_parse_conf /var/run/rc.d/mailman
doing _rc_quirks
doing rc_check
doing rc_start
doing _rc_wait start
doing rc_check
Starting Mailman's master qrunner.
doing _rc_write_runfile

Now you may operate lists via command line :)
The commands MailMan provides are here.
For example, running /usr/local/lib/mailman/bin/newlist <list-name> will create your first list.

Have you decided to use Mailman?
If so, the last steps are registering cron jobs and enabling the daemon to let it start at boot.

# crontab -u _mailman /usr/local/lib/mailman/cron/crontab.in
# rcctl enable mailman

Thank you for your reading.
I hope you enjoy the networks :)

Posted on by:

nabbisen profile

Heddi Nabbisen


An ICT designer/developer and a security monk. "With a cool brain and a warm heart", I am challenging unsolved problems in our society. I use OpenBSD/Rust/etc.


Editor guide