Today's Deep-Dive: OpenSMTPD
Ep. 376

Today's Deep-Dive: OpenSMTPD

Episode description

What if one of the most critical systems in your organization is still running on decades-old complexity nobody wants to touch? In this episode, we dive into OpenSMTPD, a modern open-source implementation of the server-side SMTP protocol that shows how email infrastructure can be rebuilt with simplicity, security, and transparency at its core.

OpenSMTPD was created out of frustration with older mail servers that had become bloated, difficult to configure, and increasingly hard to secure. Developed within the OpenBSD ecosystem, it reflects that community’s philosophy of clean code, proactive security, and minimal design. Instead of treating complexity as unavoidable, OpenSMTPD rethinks mail routing as something that should be understandable and manageable.

A major focus of the episode is the software’s security architecture. Built primarily in C, OpenSMTPD addresses the risks of low-level system programming through privilege separation - splitting the public-facing and sensitive internal components into separate operating system users. This design assumes software can fail and contains the damage if it does, dramatically improving security for a network-facing service.

We also explore why OpenSMTPD lowers the barrier to entry for self-hosting. It supports a wide range of Unix-like systems, can be installed through standard package managers, and replaces the chaos of legacy mail server configuration with one plain-text configuration file and a single unified control tool. Its compatibility features even allow older scripts written for legacy tools like Sendmail to keep working without modification.

This episode is about more than mail servers. It is about what happens when developers reject decades of accumulated bloat and prove that even foundational internet infrastructure can be rebuilt in a cleaner, safer, and more transparent way.

Gain digital sovereignty now and save costs

Let’s have a look at your digital challenges together. What tools are you currently using? Are your processes optimal? How is the state of backups and security updates?

Digital Souvereignty is easily achived with Open Source software (which usually cost way less, too). Our division Safeserver offers hosting, operation and maintenance for countless Free and Open Source tools.

Try it now!

Download transcript (.srt)
0:00

Um, what if the most critical communication infrastructure in your

0:04

business is quietly running on like a bloated 30 year old house of cards.

0:10

Support for today's deep dive actually comes from safe server.

0:14

Yeah.

0:14

Which is super relevant to this.

0:16

Right.

0:17

Because when we talk about digital infrastructure, the default move is

0:20

usually to just, you know, hand the keys over to the massive proprietary behemoths.

0:25

Oh, definitely like Microsoft exchange or a Google workspace.

0:29

Exactly.

0:30

But what happens when you need absolute verifiable control over your data for a

0:35

lot of organizations, especially when you're dealing with legal regulatory or

0:39

strict compliance requirements, things like email retention policies, right.

0:43

Or audit trails or protecting highly sensitive financial records.

0:46

In those cases, data sovereignty is literally illegal mandate.

0:50

You have to know exactly where your data lives and who has access to it.

0:53

So safe server provides this really powerful open source alternative

0:57

to those proprietary giants.

0:58

They handle the hosting entirely on secure German servers to ensure

1:01

strict data protection, which is huge for compliance.

1:04

Yeah, exactly.

1:05

And they advise on the implementation and they can be commissioned for

1:08

consulting on robust open source solutions.

1:10

Like, well, the exact one we're exploring today.

1:13

You can find out more and take real control of your infrastructure

1:16

at www.safeserver.de.

1:19

It just fundamentally shifts the power dynamic.

1:22

You know, when you realize you don't have to permanently rent your core

1:26

communication tools from a mega corporation.

1:28

It really does.

1:29

There are these highly viable, incredibly secure alternatives out there,

1:33

completely free from vendor lock-in.

1:35

If you just understand how to look under the hood.

1:38

Well, welcome everyone today.

1:40

We're opening up a topic that usually makes even reasonably tech savvy

1:44

people run for the Hills.

1:46

Oh yeah, for sure.

1:47

We're talking about hosting your own email server.

1:49

Our sources today are the official GitHub repository and website excerpts

1:54

for a piece of software called Open SMT PD.

1:56

Yep.

1:57

And our mission here is really to demystify the server side SMTP protocol and

2:02

give you the beginner listening right now, a clear jargon free entry point into

2:07

understanding how this vital piece of the internet actually works.

2:10

Because email is arguably the absolute lifeblood of the modern internet.

2:15

I mean, it just is without a doubt yet the actual mechanics of how a message

2:19

gets from person A to person B, it remains entirely invisible to most of the

2:24

people who rely on it every single day.

2:26

Okay, let's unpack this.

2:28

Taking control of your email infrastructure is a complete game changer.

2:32

But before we talk about how to install this specific software, we need to

2:36

understand the fundamental problem it was trying to solve in the first place.

2:39

Right.

2:39

Like why build a completely new mail server from scratch?

2:43

Well, to understand the motivation, we kind of have to look at what Open SMTPD

2:47

actually does at its core.

2:49

It's a free implementation of the server side SMTP protocol.

2:53

SMTP meaning a simple mail transfer protocol.

2:56

Yeah, it's specifically defined by this technical standard known as RFC5321.

3:01

Okay.

3:01

Let me throw out an analogy to kind of ground this for you listening.

3:03

Think of the SMTP protocol as like the universal rule book for a digital post

3:09

office.

3:09

I like that.

3:09

Yeah.

3:10

It dictates how the letters are stamped, how the addresses are read by the machines

3:14

and you know, how the mail trucks from entirely different cities managed to

3:19

actually talk to each other.

3:20

Exactly.

3:20

And Open SMTPD then is the actual physical routing facility.

3:26

It's taking those letters from ordinary machines and ensuring they get to other

3:30

systems, speaking that universal SMTT language.

3:33

Right.

3:33

The protocol is just the abstract set of rules.

3:36

The implementation is the actual machinery doing the heavy lifting.

3:39

Open SMTPD was primarily developed by Jules Chahade and Eric Fureau working

3:45

alongside the OpenBSD project.

3:47

Okay.

3:47

And their driving force for creating this new machinery is honestly incredibly

3:53

relatable to anyone who works in tech.

3:54

It was born out of pure dissatisfaction with other implementations.

3:58

Okay.

3:58

But let me play devil's advocate for a second here.

4:00

With so many massive pre-packaged mail servers already out there that have

4:04

literally been running the internet for decades, why bother rewriting the post

4:08

office from scratch?

4:09

Aren't established protocols already sort of set in stone?

4:12

It just seems like reinventing the wheel when we already have heavyweights

4:15

in this space.

4:16

No, it's a completely fair question.

4:18

I mean, the protocol itself, the RFC 5-3-21 rule book we mentioned, is

4:23

incredibly standard.

4:24

It hasn't fundamentally changed its core mission in decades.

4:27

Right.

4:28

But the implementations of it over the years had become just these massive

4:32

tangled webs of code.

4:34

If you look at the historical context, older mail servers like SendMail, they

4:38

were written in the 1980s.

4:39

Oh, wow.

4:40

So long before the modern hostile internet existed.

4:43

Exactly.

4:44

Over the decades, developers just kept bolting on new features, patching

4:48

newly discovered vulnerabilities and, you know, adding workarounds for every

4:52

weird edge case imaginable.

4:54

So they just got bigger and bigger.

4:55

Yeah, they became monolithic, incredibly complex to configure and notoriously

5:00

difficult to secure.

5:01

So the dissatisfaction wasn't just about the software, like looking ugly on a

5:05

screen, it was about the fact that decades of bloated code create a massive surface

5:10

area for hackers to attack.

5:11

Precisely.

5:12

And if we connect this to the bigger picture, you have to look at the community

5:16

building Open SMTPD.

5:18

It's part of the OpenBSD project.

5:20

Right.

5:20

Which has a very specific reputation.

5:21

Yeah, in the software world, the OpenBSD community is famous for an almost

5:26

obsessive focus on proactive security and clean, auditable code.

5:30

They simply do not tolerate bloat.

5:33

I mean, that makes sense.

5:34

They wanted a fairly complete SMTP implementation, but one that was entirely

5:39

stripped down, streamlined and inherently secure by its very design.

5:43

And crucially, it operates under the permissive ISC license.

5:47

Meaning what?

5:48

Exactly.

5:48

It means the software is freely usable and reusable by everyone.

5:52

And they weren't just building a better post office for their own private use.

5:56

They were giving the blueprints away to the world.

5:59

Which is an incredible engine for innovation, right?

6:01

Yeah.

6:01

Dissatisfaction, driving a desire for something cleaner, safer and entirely open.

6:05

Absolutely.

6:06

But since OpenSMTP was born out of this desire for a better system from a

6:11

notoriously security obsessed community, how does that philosophy

6:14

actually manifest in the architecture?

6:16

Like how is it built under the hood?

6:17

Well, looking at the repository data, the code base is overwhelmingly written in C.

6:22

It makes up about 84.5% of the code and C is an incredibly fast language.

6:28

It gives the developer direct access to the hardware's memory, which makes

6:32

it highly performant for a network server handling thousands of messages.

6:36

Wait, hold on.

6:37

Giving a developer direct access to memory is exactly what usually causes

6:42

the security nightmares we were just talking about, isn't it?

6:44

Yes, yes it is.

6:46

Isn't C notorious for memory leaks and buffer overflows?

6:50

If you give a developer that much raw power, you give them the power to

6:54

accidentally leave a back door wide open.

6:56

You're spot on.

6:58

That is the eternal double-edged sword of writing software in C.

7:01

For you listening who might not be familiar with the buffer overflow,

7:04

imagine you have a digital box designed to hold exactly 10 characters of text.

7:09

Okay.

7:09

And a language like C, if you aren't perfectly careful with your code, a

7:13

malicious hacker can send a hundred characters to that box.

7:16

The extra 90 characters spill over the edges of the box and overwrite the

7:19

adjacent memory of the server.

7:21

Yeah.

7:21

And if the hacker crafts those extra characters to be executable code, the

7:26

server might just blindly execute it, giving the attacker total control of the

7:29

machine.

7:30

So how does a team obsessed with security build a network-facing mail

7:36

server in a language prone to those exact kinds of catastrophic spills?

7:41

They mitigate the risk by relying heavily on a structural concept called

7:45

privileged separation.

7:46

Privileged separation.

7:47

Yeah.

7:47

Instead of running the entire mail server as one giant, powerful program, they

7:53

break it apart.

7:54

When you set this up, the system requires a specific user structure at the

7:58

operating

7:58

system level to run securely.

8:00

What does that look like?

8:01

It requires at least one user, which defaults to a name called MTPD, but the

8:05

documentation strongly, strongly prefers that you use two completely separate

8:10

users, SMTPD and SMTPQ.

8:13

Okay, let's visualize this because the mechanics of privilege separation are

8:16

actually brilliant.

8:17

Let's compare this to user system to a bank.

8:19

Okay.

8:20

The first user, SMTPD, is the friendly teller at the front desk.

8:24

That teller is the only one interacting with the outside public.

8:28

They accept incoming mail.

8:29

They chat with the servers across the internet.

8:31

But the second user, SMTPQ, is the manager locked securely inside the thick

8:38

steel vault, handling the actual sensitive queue of emails and the core files.

8:43

What's fascinating here is how the operating system enforces the separation.

8:47

Because the teller and the vault manager are completely different user accounts,

8:51

the underlying operating system kernel builds a hard wall between them.

8:55

Ah, I see.

8:56

If a malicious hacker sends a highly sophisticated buffer overflow attack and

9:00

successfully compromises the teller at the front desk, the damage stops there.

9:04

Because the teller literally does not have the operating system

9:07

privileges to open the vault.

9:08

Exactly.

9:09

Even if the hacker completely takes over this MTPD process, they can't access the

9:13

core data, they can't read the sensitive email queues, and they can't take over

9:17

the entire server.

9:18

That's incredibly smart.

9:19

The developers are incredibly explicit about this design choice too.

9:23

The documentation specifically notes that using two users instead of one will

9:29

increase security by a large factor.

9:31

I mean, I'd hope so.

9:33

But they go a step further.

9:34

They actually state that if you voluntarily choose to use only one user,

9:39

you either want to actively reduce your security or, and this is a direct quote

9:43

from the creators, you have absolute more faith in our code than we do.

9:48

Wait, really?

9:49

You have more faith in our code than we do.

9:52

That is a wild thing for a software developer to put in their

9:55

official documentation.

9:56

Right.

9:56

But it is the ultimate hallmark of great security engineering.

10:00

Hubris is the enemy of security.

10:02

By baking privilege separation into the very fabric of the software and by

10:06

openly acknowledging that no human written code is ever completely perfect.

10:11

They protect the user from unforeseen zero day vulnerabilities.

10:15

It's a philosophy of assuming breach.

10:17

They assume the front desk teller might eventually be compromised by a clever

10:21

enough attack and they design the architecture so the vault remains

10:23

impenetrable anyway.

10:24

But building a mathematically secure digital vault is one thing.

10:28

Getting people to actually use it is another.

10:31

Usually this level of obsessive security means the software is a total nightmare

10:35

to install and configure.

10:36

Oh, totally.

10:37

Is that the trade off we're looking at here?

10:39

If a beginner sitting at home wants to take control of their email routing, how

10:43

do they actually get this running without needing an advanced degree in computer

10:46

science?

10:46

This is where OpenSMTKD really shines as an entry point into self-hosting.

10:51

Historically, setting up a secure mail server meant downloading raw source code,

10:56

resolving dozens of obscure software dependencies manually, and compiling

11:01

everything from scratch.

11:02

It was a chaotic process that would easily frustrate a beginner.

11:06

But OpenSMTKD has incredibly broad operating system support natively.

11:11

It runs on Linux, Mac OS, FreeBSD, NetBSD, OpenBSD, and DragonflyBSD.

11:17

So basically, almost any Unix-like environment you might be running on a

11:21

server or a home lab.

11:22

Exactly.

11:23

And more importantly, you don't have to compile it from source, though the

11:26

documentation provides the exact instructions if you really want to.

11:30

The source docs do list dependencies you need for compiling, like LiveVent and

11:36

OpenSSL.

11:37

Just to briefly clarify for you listening, a mail server needs a library

11:42

like LiveVent, because if 5,000 spam bots try to connect to your server at

11:46

the exact same millisecond...

11:47

Which happens?

11:48

Right.

11:49

You don't want the server trying to open 5,000 separate processes and just

11:52

crashing your machine's memory entirely.

11:54

LiveVent handles all those massive simultaneous network connections

11:59

efficiently in the background.

12:00

Precisely.

12:00

But for the beginner who just wants to get the software onto their machine to

12:04

start learning, they don't need to worry about manually installing

12:07

those underlying libraries.

12:08

Really?

12:08

Not at all.

12:09

You just use your system's native package manager.

12:12

You're on a standard Debian or Ubuntu server.

12:14

You just type sudo apt install opens mppd and the package manager

12:19

handles all the dependencies for you.

12:21

Oh, that's incredibly easy.

12:22

Yeah.

12:23

If you're on Alpine Linux, it's app install.

12:26

On Fedora, it's yum.

12:28

On OpenCSC, it's zipper.

12:30

You can even use McPorts on macOS.

12:33

It's also fully available via container images.

12:36

If you prefer deploying with Docker, the barrier to entry for simply

12:40

getting the software onto your machine is incredibly low.

12:43

But here's where it gets really interesting though.

12:45

Installation is usually the easy part.

12:47

The moment you actually have to configure a mail server is usually

12:51

when it turns into a nightmare spaghetti code and like 50 different

12:54

text files scattered across your hard drive.

12:56

Yeah.

12:56

The configuration to appreciate how open SMTPD solves this.

13:00

You really have to look at what came before it.

13:02

The configuration file for legacy servers like send mail, a file

13:06

called sendmail.cf- was infamous in the IT world.

13:10

I've heard horror stories.

13:11

It literally looked like random line noise.

13:13

It was so complex that administrators had to use an entirely separate macro

13:17

language just to write the configuration file that would then run the mail server.

13:20

That's absurd.

13:21

Open SMTPD abandons all of that legacy complexity.

13:24

The core configuration lives in one single file, just one.

13:28

It's located at excesa SMTPD.com.

13:32

Wow.

13:32

So you aren't chasing down hidden variables across a dozen nested directories.

13:36

Nope.

13:37

You define your rules, your domains and your routing right there in plain text.

13:41

And to control the software itself, Open SMTPD gives you a single unified

13:46

utility called SMTPTL.

13:48

Okay.

13:48

STPTTL.

13:49

Right.

13:50

In Unix terms, the mail server runs as a daemon, which is simply a background

13:54

process that quietly sits there listening for incoming network connections without

13:58

needing you to interact with it constantly.

14:00

Makes sense.

14:01

When you do need to interact with that daemon to start it, stop it, or peek

14:04

inside the queue of pending emails, you just use that one SMTPTL tool.

14:09

One plain text config file, one control tool, that is a massive architectural

14:14

shift from the legacy systems.

14:15

But that actually raises a really important question about the

14:19

reality of modernizing infrastructure.

14:21

What's that?

14:22

Let's say I'm an IT administrator managing an older server environment.

14:25

I have a lot of legacy applications running maybe some 15 year old billing

14:29

scripts or system notification tools.

14:31

Those old scripts are hard coded to look for a legacy program, specifically

14:36

send mail to push an invoice or an alert out to the internet.

14:40

Right.

14:40

Very common scenario.

14:41

If I install OpenSMTPTL and everything is now managed by this entirely

14:45

new SMTPTL tool, doesn't installing this software immediately break every

14:51

single legacy script that's blindly shouting for send mail.

14:54

It's a massive roadblock for modernizing infrastructure.

14:57

Yeah, the fear of breaking a 15 year old billing script is exactly why so many

15:02

companies leave bloated, vulnerable legacy software running on their servers.

15:06

He just, nobody wants to touch it.

15:07

Exactly.

15:08

You do not want to rewrite decades of legacy scripts just to upgrade your mail

15:12

router, but the developers behind OpenSMTPTL anticipated this exact friction point.

15:17

They built a historical interface compatibility mode directly into the software.

15:22

Oh, how does that actually work mechanically?

15:24

Does OpenSMTPTL have to run like a secondary fate legacy server in the

15:28

background just to catch those requests?

15:30

The mechanism is much more elegant than that.

15:32

It happens at the operating system level.

15:34

OpenSMTPTL simply impersonates those legacy tools.

15:38

Impersonates them?

15:38

Yeah.

15:39

That single control utility we just talked about, NGPFYTL, is programmed to

15:44

operate in compatibility mode if it detects that it's being called by a

15:48

historical name, like send mail, Nualises, mail, or make map.

15:53

So the new tool just puts on a disguise and pretends to be the old tool.

15:57

But how does the operating system know to route the request to the

16:01

new tool in the first place?

16:03

Through simple mapping.

16:04

On systems equipped with a mail wrapper, you just edit a single text file called

16:09

at sexymailer.conf and map the old legacy names to the new path.

16:13

Choose MTKPAL.

16:14

On other systems, you rely on symbolic links.

16:18

A symbolic link is basically a forwarding address at the post office.

16:21

You tell the operating system, hey, if a script comes looking for the file named

16:25

sendmail, just silently route that request directly to SMTPAPAL instead.

16:29

That is incredibly clever.

16:30

From the perspective of your 15 year old billing script, absolutely nothing has

16:34

changed. Nothing at all.

16:35

The script generates the invoice.

16:36

It shouts out for sendmail, just like it has for a decade.

16:40

But the operating system intercepts that call, forwards it to 7TPPATL, which

16:45

catches the request, processes it through Open SMTPD's highly secure

16:50

privileged separated vault and sends the email out to the Internet.

16:54

The old script is none the wiser.

16:55

It allows a beginner or a seasoned systems administrator to modernize a

17:00

server's infrastructure instantly without having to touch a single line of legacy

17:04

code in their applications.

17:06

That's huge.

17:06

The Open SMTPD project leaves it up to individual package maintainers to set

17:11

these symbolic links up natively during installation.

17:13

But the documentation provides the exact command line instructions to do it

17:18

yourself if needed.

17:19

It elegantly bridges the gap between the chaotic bloated past of email servers

17:23

and a clean minimalist future.

17:26

So what does this all mean for you listening right now?

17:28

It means that Open SMTPD takes what has historically been one of the most

17:32

intimidating complex tasks in IT, setting up a secure mail server and turns into

17:37

a highly transparent, manageable process.

17:39

Yeah, it really does.

17:40

It gives you a clean entry point into the world of internet routing, born

17:44

entirely out of a community's refusal to accept bloated software as a status

17:48

quo. It proves that with the right architectural design, like operating

17:53

system level privilege separation and a single plain text configuration file,

17:57

extreme complexity does not have to be the default state of the internet.

18:01

It strips away the intimidation factor entirely.

18:04

It allows you to peer behind the curtain of how these massive global systems

18:08

actually communicate and gives you the tools to participate in that network on

18:12

your own terms without sacrificing security.

18:15

And as we talk about participating in that network securely, we really need to

18:19

circle back to our sponsor, Safe Server.

18:21

While OpenSMTPD is incredibly accessible for learning the ropes and, you know,

18:26

setting up your own systems, let's look at the practical reality for organizations.

18:30

Right. When the stakes are higher.

18:32

Exactly. If you are a business, an association, or any group dealing with actual

18:37

client data, the stakes are exponentially higher.

18:40

You stand to gain massive tangible benefits from switching to an open source

18:44

solution like this. You eliminate vendor lock-in, you gain complete transparency

18:49

over your routing, and you achieve true data sovereignty.

18:52

Which is so critical.

18:54

But actually managing that infrastructure day to day, ensuring 247 uptime,

18:58

aggressively applying security patches, and maintaining strict regulatory

19:02

compliance that can quickly drain your internal IT resources dry.

19:06

Oh, completely. It's a full-time job.

19:08

Which is exactly why professionally managed hosting often makes far more sense

19:12

than self-operation for organizations.

19:14

Safe Server gives you the best of both worlds.

19:16

The uncompromised freedom and security of open source software,

19:19

backed by professional, managed hosting on secure German servers.

19:23

Yeah.

19:23

They're available for consulting on OpenSMTPD and similar robust alternatives,

19:27

tailoring the implementation to your exact organizational needs.

19:31

You can explore how they can help secure your communications infrastructure

19:34

at www.safeserver.de.

19:38

Because, honestly, choosing the right software is only half the battle.

19:42

Choosing the right environment to run it in is what dictates your long-term success.

19:45

Whether you're a learner experimenting in a home lab on a weekend,

19:49

or an enterprise securing a decade of legal audit trails.

19:52

We've covered a massive amount of ground today.

19:54

From the basic mechanics of how RFC FF321 actually moves a message across the globe,

19:59

to the brilliant humility of assuming your own code might fail

20:04

and building a vault to contain the blast.

20:06

But before we wrap up this deep dive, we'd like to leave you with something to chew

20:10

on.

20:10

Yeah.

20:11

If we look at the core lesson of what OpenSMTPD accomplished.

20:14

If email routing, which is arguably one of the oldest, most vital,

20:18

and historically complex arteries of the entire internet,

20:21

can be simplified this elegantly by a few developers

20:23

who are just completely dissatisfied with the status quo.

20:26

Right.

20:26

What other bloated legacy systems in our daily tech stack are we just blindly

20:31

accepting?

20:31

What other monolithic, insecure pieces of software are sitting on your server or

20:36

your desktop right now,

20:37

completely ripe for a minimalist open source revolution?

20:40

A great question to end on.

20:42

We'll catch you on the next one.

20:42

We'll catch you on the next one.