<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>simonh.uk - mail</title><link href="https://simonh.uk/" rel="alternate"></link><link href="https://simonh.uk/feeds/mail.atom.xml" rel="self"></link><id>https://simonh.uk/</id><updated>2025-01-06T00:00:00+00:00</updated><subtitle>Simon Harrison :: Burton on Trent :: UK</subtitle><entry><title>Fastmail Business Email Review 2025</title><link href="https://simonh.uk/2025/01/06/fastmail-business-email-review-2025/" rel="alternate"></link><published>2025-01-06T00:00:00+00:00</published><updated>2025-01-06T00:00:00+00:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2025-01-06:/2025/01/06/fastmail-business-email-review-2025/</id><summary type="html">	&lt;p&gt;Let me give you my &lt;em&gt;business&lt;/em&gt; email address!&lt;/p&gt;</summary><content type="html">	&lt;p&gt;&lt;img alt="Fastmail logo" src="/img/logo/fastmail.webp" title="Fastmail logo" /&gt;&lt;/p&gt;

	&lt;h2&gt;Hello again, Fastmail&lt;/h2&gt;

	&lt;p&gt;I had a free, personal Fastmail account before everyone lost their minds that &lt;em&gt;googlemail is coming out!!!&lt;/em&gt; back in about about 2004(ish). I seem to remember using it quite happily until the gmail thing. At &lt;em&gt;that&lt;/em&gt; time Google could do no wrong and I went with the horde and got my very own googlemail account and left stupid Fastmail behind. What had I been thinking?!&lt;/p&gt;

	&lt;h2&gt;Fast Forward to 2017&lt;/h2&gt;

	&lt;p&gt;I&amp;#8217;d just started my own business and needed a &lt;em&gt;professional&lt;/em&gt; email account. Now, I honestly can&amp;#8217;t remember my reasoning, but I signed up for &lt;em&gt;G Suite&lt;/em&gt;, now &lt;em&gt;Google Workspace&lt;/em&gt;. It did the job acceptably, but at some point between 2017 and 2022, I became uncomfortable with using it.&lt;sup class="footnote" id="fnrevca9cbe5652874e5dbd28aac1d8c20550-1"&gt;&lt;a href="#fnca9cbe5652874e5dbd28aac1d8c20550-1"&gt;1&lt;/a&gt;&lt;/sup&gt; I next tried Rackspace &lt;strong&gt;business&lt;/strong&gt; email for a few months as it seemed to get recommended quite often, but I didn&amp;#8217;t really get along with that either. I then decided to give Fastmail a go (again). One of the reasons was that Fastmail is entirely focused on email&lt;sup class="footnote" id="fnrevca9cbe5652874e5dbd28aac1d8c20550-2"&gt;&lt;a href="#fnca9cbe5652874e5dbd28aac1d8c20550-2"&gt;2&lt;/a&gt;&lt;/sup&gt; and has been since 1999. The old &lt;em&gt;do one thing and do it well&lt;/em&gt; adage has always resonated with me.&lt;/p&gt;

	&lt;p&gt;Rather than listen to me waffle on, you can read about what they offer for business on their &lt;a href="https://www.fastmail.com/business/"&gt;Fastmail for Business&lt;/a&gt; page.&lt;/p&gt;

	&lt;h2&gt;(Try to) Ignore the Silly Marketing&lt;/h2&gt;

	&lt;p&gt;If today, you go to the &lt;a href="https://www.fastmail.com/features/"&gt;Fastmail Product Tour&lt;/a&gt; page, you will see &lt;strong&gt;five&lt;/strong&gt; photos of &lt;em&gt;incredibly&lt;/em&gt; happy Fastmail customers (I assume). Here is the happiest lady of the bunch:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="So happy" src="/img/2025-01-06/happy.webp" title="So happy" /&gt;&lt;/p&gt;

	&lt;p&gt;She can&amp;#8217;t believe that she&amp;#8217;s only just discovered Fastmail. Happiest day of her life, clearly!&lt;/p&gt;

	&lt;p&gt;Man, I hate that stock photo, everybody smiling nonsense. Fastmail: have a rethink on your marketing people / strategy. Your potential customers are &lt;strong&gt;not&lt;/strong&gt; five years old!&lt;/p&gt;

	&lt;p class="warn"&gt;We don&amp;#8217;t even know if she&amp;#8217;s on the Fastmail app. She might be watching cat videos!&lt;/p&gt;

	&lt;p&gt;Rackspace&amp;#8217;s photo is &lt;em&gt;far&lt;/em&gt; better. Definitely reading a business email and not watching silly videos:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Rackspace stock photo" src="/img/2025-01-06/rackspace.webp" title="Rackspace stock photo" /&gt;&lt;/p&gt;

	&lt;h2&gt;Anyway&amp;#8230;&lt;/h2&gt;

	&lt;p&gt;I&amp;#8217;ve been using Fastmail business for nearly a year and a half. It works very well, both through the web interface and their Android app (don&amp;#8217;t use &lt;em&gt;istuff&lt;/em&gt; so no comments about that). One thing that I think sets them apart from their competition is their excellent help. They&amp;#8217;ve even given it it&amp;#8217;s own domain: &lt;a href="https://www.fastmail.help"&gt;fastmail.help&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Functionality wise, you&amp;#8217;ll get all the email features &lt;em&gt;everyone&lt;/em&gt; expect nowadays, with the one possible exception of the ability to edit office files. One could argue that is &lt;strong&gt;not&lt;/strong&gt; the job of an email client, and one would have a point. Still, if you &lt;em&gt;need&lt;/em&gt; that, you&amp;#8217;ll be disappointed.&lt;/p&gt;

	&lt;p&gt;I should point out a couple of problems I&amp;#8217;ve experienced. First, on all my other email accounts (I have &lt;em&gt;a lot&lt;/em&gt;), notifications on my Android phone come through normally. For some reason, Fastmail notifies me about emails I&amp;#8217;ve already read or deleted on my desktop. It&amp;#8217;s not a showstopper, but it&amp;#8217;s a bit &lt;em&gt;weird&lt;/em&gt;. I suppose I should open a ticket. The only other odd thing I&amp;#8217;ve come across is (and this has only happened a few times), sometimes the web interface hangs on loading. I don&amp;#8217;t recall seeing a message, just the loading page icon, similar to this:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Please wait, loading..." src="/img/2025-01-06/loading.gif" title="Please wait, loading..." /&gt;&lt;/p&gt;

	&lt;p&gt;But, as I said, it only happens once in a while, very rare, so please don&amp;#8217;t let that put you off. I&amp;#8217;m just mentioning it as I&amp;#8217;ve seen it.&lt;/p&gt;

	&lt;h2 class="tick"&gt;What&amp;#8217;s Good?&lt;/h2&gt;

	&lt;ul&gt;
		&lt;li&gt;Does everything an email client needs to do&lt;/li&gt;
		&lt;li&gt;Includes contacts, file storage, notes, calendar&lt;/li&gt;
		&lt;li&gt;Integrates with other services / platforms&lt;sup class="footnote" id="fnrevca9cbe5652874e5dbd28aac1d8c20550-3"&gt;&lt;a href="#fnca9cbe5652874e5dbd28aac1d8c20550-3"&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
		&lt;li&gt;Excellent help system&lt;/li&gt;
		&lt;li&gt;It is fast, as advertised&lt;/li&gt;
	&lt;/ul&gt;

	&lt;h2 class="cross"&gt;What&amp;#8217;s Not Good?&lt;/h2&gt;

	&lt;ul&gt;
		&lt;li&gt;Weird sync issues on Android phone&lt;/li&gt;
		&lt;li&gt;No support for viewing / editing office files&lt;/li&gt;
	&lt;/ul&gt;

	&lt;h2&gt;Conclusion&lt;/h2&gt;

	&lt;p&gt;If you&amp;#8217;re looking to create a new business email account, or to migrate from another provider, I think you&amp;#8217;ll be happy with Fastmail. They&amp;#8217;ve been doing email for twenty five years and it shows.&lt;/p&gt;

	&lt;h2 class="footnotes"&gt;Footnotes&lt;/h2&gt;

	&lt;p class="footnote" id="fnca9cbe5652874e5dbd28aac1d8c20550-1"&gt;&lt;sup&gt;1&lt;/sup&gt; Oh yes, they dropped their famous &lt;a href="https://en.wikipedia.org/wiki/Don%27t_be_evil"&gt;motto&lt;/a&gt;, that could have been it!&lt;/p&gt;

	&lt;p class="footnote" id="fnca9cbe5652874e5dbd28aac1d8c20550-2"&gt;&lt;sup&gt;2&lt;/sup&gt; Fastmail are the primary maintainer of &lt;a href="https://www.cyrusimap.org/"&gt;Cyrus &lt;span class="caps"&gt;IMAP&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;

	&lt;p class="footnote" id="fnca9cbe5652874e5dbd28aac1d8c20550-3"&gt;&lt;sup&gt;3&lt;/sup&gt; I only use the Dropbox integration. Works well.&lt;/p&gt;</content><category term="mail"></category><category term="review"></category><category term="mail"></category><category term="business"></category></entry><entry><title>Using OpenSMTPD as a Personal Relay</title><link href="https://simonh.uk/2022/06/26/using-opensmtpd-as-a-personal-relay/" rel="alternate"></link><published>2022-06-26T00:00:00+01:00</published><updated>2022-06-26T00:00:00+01:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2022-06-26:/2022/06/26/using-opensmtpd-as-a-personal-relay/</id><summary type="html">	&lt;p&gt;Ditch third party relays and just use your own!&lt;/p&gt;</summary><content type="html">	&lt;p&gt;&lt;img alt="OpenSMTPD Logo" src="/img/logo/opensmtpd.webp" title="OpenSMTPD Logo" /&gt;&lt;/p&gt;

	&lt;p&gt;So, you&amp;#8217;ve got at least one server and you&amp;#8217;ve installed and configured opensmtpd so you can send emails. But, you&amp;#8217;re still using a third party email provider from your home computer. That didn&amp;#8217;t seem right to me, so I&amp;#8217;ve eventually figured out how to use one of my servers to route mail from home (or laptop) to its destination.&lt;/p&gt;

	&lt;h2&gt;Benefits&lt;/h2&gt;

	&lt;p&gt;1. Using what you already have. You&amp;#8217;ve got an email server. Might as well use it as a relay!&lt;br /&gt;
2. Speed. Routing mail through your own server will be &lt;em&gt;far&lt;/em&gt; quicker than using someone elses.&lt;/p&gt;

	&lt;p&gt;Below should be self explanatory. You need to edit four files, two on your server, two on your local machine.&lt;/p&gt;

	&lt;p&gt;Swap out &lt;code&gt;example.com&lt;/code&gt; for your server domain, obviously.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;###########################
#  Server: /etc/smtpd.conf
###########################

# $OpenBSD: smtpd.conf,v 1.10 2018/05/24 11:40:17 gilles Exp $

# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.

table aliases file:/etc/mail/aliases
table secrets file:/etc/mail/secrets

pki example.com key &amp;quot;/etc/letsencrypt/live/example.com/privkey.pem&amp;quot;
pki example.com cert &amp;quot;/etc/letsencrypt/live/example.com/fullchain.pem&amp;quot;

# Filters taken from prefetch.eu
filter   &amp;quot;rdns&amp;quot; phase connect match   !rdns disconnect &amp;quot;550 DNS error&amp;quot;
filter &amp;quot;fcrdns&amp;quot; phase connect match !fcrdns disconnect &amp;quot;550 DNS error&amp;quot;
filter check_dyndns phase connect match rdns regex { &amp;#39;.*\.dyn\..*&amp;#39;,
&amp;#39;.*\.dsl\..*&amp;#39; } \ disconnect &amp;quot;550 no residential connections&amp;quot;

action &amp;quot;local&amp;quot; maildir alias &amp;lt;aliases&amp;gt;
action &amp;quot;relay&amp;quot; relay

listen on localhost
listen on eth0 tls pki example.com \
filter { &amp;quot;rdns&amp;quot;, &amp;quot;fcrdns&amp;quot;, &amp;quot;check_dyndns&amp;quot; } \

listen on eth0 port 465 smtps pki example.com auth &amp;lt;secrets&amp;gt;
listen on eth0 port 587 tls-require pki example.com auth &amp;lt;secrets&amp;gt;

match for local action &amp;quot;local&amp;quot;
match from local for any action &amp;quot;relay&amp;quot;
match from any for domain &amp;quot;example.com&amp;quot; action &amp;quot;local&amp;quot;

match from auth for any action &amp;quot;relay&amp;quot;

############################
# Server: /etc/mail/secrets
############################

simon@server:~$ cat /etc/mail/secrets 
home@example.com &amp;lt;password hash created using &amp;#39;smtpctl encrypt&amp;#39; command&amp;gt;

#########################
# Local: /etc/smtpd.conf
#########################

# $OpenBSD: smtpd.conf,v 1.10 2018/05/24 11:40:17 gilles Exp $

# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.

table aliases file:/etc/mail/aliases
table secrets file:/etc/mail/secrets

listen on localhost

action &amp;quot;local&amp;quot; maildir alias &amp;lt;aliases&amp;gt;

action &amp;quot;simonh&amp;quot; relay host smtp+tls://simonh@example.com:587 \
auth &amp;lt;secrets&amp;gt; mail-from &amp;quot;home@example.com&amp;quot;

match for local action &amp;quot;local&amp;quot;
match for any action &amp;quot;simonh&amp;quot;

###########################
# Local: /etc/mail/secrets
###########################

root@computer:/etc# cat mail/secrets 
simonh home@example.com:plain_password_here&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The key things to pay attention to are (on the server):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;table secrets file:/etc/mail/secrets&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;listen on eth0 port 587 tls-require pki example.com auth &amp;lt;secrets&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;match from auth for any action &amp;quot;relay&amp;quot;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And on your local machine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;action &amp;quot;simonh&amp;quot; relay host smtp+tls://simonh@example.com:587 \&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;match for any action &amp;quot;simonh&amp;quot;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;code&gt;/etc/mail/secrets&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simonh home@example.com:plain_password_here&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The password needs to be plain text as it is sent over &lt;span class="caps"&gt;TLS&lt;/span&gt; to be checked by the remote mail server. &lt;/p&gt;

	&lt;p&gt;From what I can gather, the &lt;code&gt;simonh&lt;/code&gt; label in &lt;code&gt;/etc/mail/secrets&lt;/code&gt; will send the username and password matching that label from your &lt;code&gt;secrets&lt;/code&gt; file to the &lt;code&gt;action&lt;/code&gt; block. That had me stumped for a while&amp;#8230;&lt;/p&gt;

	&lt;p&gt;As a side note, you can avoid the auth stuff entirely if you&amp;#8217;ve got a static ip address. This is what I&amp;#8217;d been using for the last few weeks until I got the authenticated method sorted out:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;match from src your.home.ip.address for any action &amp;quot;relay&amp;quot;&lt;/code&gt;&lt;/pre&gt;</content><category term="mail"></category><category term="mail"></category><category term="smtp"></category><category term="tips"></category></entry><entry><title>Using Alpine Email Client For Applying Patches</title><link href="https://simonh.uk/2021/12/17/using-alpine-email-client-for-applying-patches/" rel="alternate"></link><published>2021-12-17T00:00:00+00:00</published><updated>2021-12-17T00:00:00+00:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-12-17:/2021/12/17/using-alpine-email-client-for-applying-patches/</id><summary type="html">	&lt;p&gt;My new mercurial patch workflow&lt;/p&gt;</summary><content type="html">	&lt;p&gt;&lt;img alt="Alpine CLI email client" src="/img/2021-12-17/alpine_main_menu.webp" title="Alpine CLI email client" /&gt;&lt;/p&gt;

	&lt;h1&gt;Alpine Mail Client&lt;/h1&gt;

	&lt;p&gt;Lately, I&amp;#8217;ve been using &lt;a href="https://alpine.x10host.com/"&gt;Alpine&lt;/a&gt; for emails on my servers. It&amp;#8217;s a great command line, curses based, mail client. This post is a quick howto for using Alpine for patching Python (or any) code on a production server. &lt;/p&gt;

	&lt;p&gt;Let&amp;#8217;s get started&amp;#8230;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# apt install alpine&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;I like to alias alpine to pine in my &lt;code&gt;.bashrc&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;The default screen when you launch Alpine is this:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Alpine Main Menu" src="/img/2021-12-17/alpine_menu.webp" title="Alpine Main Menu" /&gt;&lt;/p&gt;

	&lt;p&gt;Like many people, I prefer to see my inbox when I open my mail client. This is easily achieved by typing &lt;code&gt;S C&lt;/code&gt; from the main menu. Then, page down until you see &amp;#8220;Initial Keystroke List&amp;#8221;&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Alpine Configuration" src="/img/2021-12-17/alpine_config.webp" title="Alpine Configuration" /&gt;&lt;/p&gt;

	&lt;p&gt;Type &lt;code&gt;C&lt;/code&gt; to change the value to &lt;code&gt;i&lt;/code&gt; for inbox then &lt;code&gt;e&lt;/code&gt; to exit setup and &lt;code&gt;y&lt;/code&gt; to confirm this change. From now on, when you type &lt;code&gt;pine&lt;/code&gt; or &lt;code&gt;alpine&lt;/code&gt; you&amp;#8217;ll be straight in your inbox. If you want to go the menu, it&amp;#8217;s simply an &lt;code&gt;m&lt;/code&gt; keystroke away.&lt;/p&gt;

	&lt;p&gt;Here is my inbox:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Alpine Inbox" src="/img/2021-12-17/alpine_inbox.webp" title="Alpine Inbox" /&gt;&lt;/p&gt;

	&lt;p&gt;As you can see, I&amp;#8217;ve mailed myself 4 patches from my home computer which I&amp;#8217;ll be applying on the production server. &lt;/p&gt;

	&lt;p&gt;Highlight message 6, and then type the pipe character &lt;code&gt;|&lt;/code&gt;. Alpine now wants a command which you can see near the bottom.&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Alpine Pipe Command" src="/img/2021-12-17/alpine_patch1.webp" title="Alpine Pipe Command" /&gt;&lt;/p&gt;

	&lt;p&gt;Press &lt;code&gt;Enter&lt;/code&gt; and see what happens.&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Alpine Patching" src="/img/2021-12-17/alpine_patch2.webp" title="Alpine Patching" /&gt;&lt;/p&gt;

	&lt;p&gt;As you can see, Patch has not been able to apply the patch as I have a deliberate error. I was not in the correct directory where the code is. So what I do is make sure I&amp;#8217;m in the correct directory before I launch Alpine. Once you&amp;#8217;ve done that, all should be good. I&amp;#8217;d advise you to use the &lt;code&gt;--dry-run&lt;/code&gt; option to patch to check for errors, before actually applying the patch or patch series!&lt;/p&gt;

	&lt;h1&gt;Mercurial Patchbomb&lt;/h1&gt;

	&lt;p&gt;For the above to work, you need to enable the &lt;a href="https://www.mercurial-scm.org/wiki/PatchbombExtension"&gt;Patchbomb&lt;/a&gt; extension. It&amp;#8217;s included with Mercurial so you just need to enable it. In your &lt;code&gt;~/.hgrc&lt;/code&gt; add the extension as below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[extensions]
# uncomment these lines to enable some popular extensions
# (see &amp;#39;hg help extensions&amp;#39; for more info)
#
patchbomb = &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And finally, in your Mercurial repository &lt;code&gt;.hg/hgrc&lt;/code&gt; add the following. This will send your patches silently to your server. If you don&amp;#8217;t do this, you&amp;#8217;ll have to specify a recipient and whether you want to CC anyone. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@computer:~/code/project$ cat .hg/hgrc
[email]
to = you@server.com
cc = &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So now, you can simply run&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@computer:~/code/project$ hg email -r tip&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Patchbomb will inform you what it&amp;#8217;s sending:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@computer:~/code/project$ hg email -r tip
this patch series consists of 1 patches.


sending [PATCH] revert tacit css to unmodified version ...
simon@computer:~/code/project$&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;If you want or need to send multiple patches, you can do that like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@computer:~/code/project$ hg email -r 130:-r tip&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You&amp;#8217;ll be given the opportunity to provide some details for the patch series which appear in &lt;code&gt;[Patch 0 of 7]&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Multiple Patches" src="/img/2021-12-17/alpine_multiple_patches.webp" title="Multiple Patches" /&gt;&lt;/p&gt;

	&lt;p&gt;And it&amp;#8217;s as simple as that!&lt;/p&gt;</content><category term="mail"></category><category term="mail"></category><category term="tips"></category><category term="mercurial"></category></entry><entry><title>Get DKIM Working with OpenSMTPD</title><link href="https://simonh.uk/2021/06/23/get-dkim-working-with-opensmtpd/" rel="alternate"></link><published>2021-06-23T00:00:00+01:00</published><updated>2025-01-05T00:00:00+00:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-06-23:/2021/06/23/get-dkim-working-with-opensmtpd/</id><summary type="html">	&lt;p&gt;Anything is easy (in hindsight)&lt;/p&gt;</summary><content type="html">	&lt;p&gt;&lt;img alt="OpenSMTPD Logo" src="/img/logo/opensmtpd.webp" title="OpenSMTPD Logo" /&gt;&lt;/p&gt;

	&lt;p class="warn"&gt;As of Debian 12, dkim support for OpenSMTPD is included in Debian:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@server:~ [ssh] $ cat /etc/debian_version 
12.8
simon@server:~ [ssh] $ apt show opensmtpd-filter-dkimsign
Package: opensmtpd-filter-dkimsign
Version: 0.5-2
Priority: optional
Section: mail
Maintainer: Ryan Kavanagh &amp;lt;rak@debian.org&amp;gt;
Installed-Size: 63.5 kB
Depends: adduser, libc6 (&amp;gt;= 2.34), libopensmtpd0 (&amp;gt;= 0.7), libssl3 (&amp;gt;= 3.0.0)
Suggests: openssl
Homepage: http://imperialat.at/dev/filter-dkimsign/
Download-Size: 18.2 kB
APT-Sources: http://deb.debian.org/debian bookworm/main amd64 Packages
Description: opensmtpd filter that signs email with a dkim signature
 This OpenSMTPD filter signs emails with a DKIM signature. It supports
 the rsa and ed25519 signing algorithms.&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;There&amp;#8217;s no man page but instructions are available &lt;a href="https://salsa.debian.org/debian/opensmtpd-filter-dkimsign/-/blob/debian/sid/debian/README.Debian"&gt;here&lt;/a&gt;. Note that this is the same link as the credit to Ryan @ Debian below.&lt;/p&gt;

	&lt;p&gt;So, you should be able to go straight to &lt;em&gt;Create Group and User&lt;/em&gt; on this page. I&amp;#8217;ve added this update as this post gets quite a few views. Original post continues below.&lt;/p&gt;

	&lt;p&gt;I love opensmtpd. But as I&amp;#8217;ve never set up a mail server before, some things are hard. &lt;span class="caps"&gt;DKIM&lt;/span&gt; was one of them. Below is what I now use on four servers and all work perfectly:&lt;/p&gt;

	&lt;h2&gt;Credits&lt;/h2&gt;

	&lt;p&gt;&lt;a href="https://salsa.debian.org/debian/opensmtpd-filter-dkimsign/-/blob/debian/sid/debian/README.Debian"&gt;Ryan Kavanagh @ Debian&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;&lt;a href="http://cvsweb.openbsd.org/ports/mail/opensmtpd-filters/dkimsign/pkg/README?rev=1.2&amp;content-type=text/x-cvsweb-markup"&gt;Martijn van Duren @ OpenBSD&lt;/a&gt;&lt;/p&gt;

	&lt;h2 class="readme"&gt;&lt;span class="caps"&gt;README&lt;/span&gt;&lt;/h2&gt;

	&lt;p&gt;This is a guide to using filter-dkimsign on Debian 10. It took a bit of effort to get it working and the following is as much for my reference as anyone else&amp;#8217;s.&lt;/p&gt;

	&lt;p class="info"&gt;This is for an outgoing only mail server&lt;/p&gt;

	&lt;h2&gt;Install the requirements&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src# apt install libevent-dev libssl-dev mandoc&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Grab the files from here:&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src# wget https://simonh.uk/files/src/libopensmtpd-0.7.tar.gz
bc. root@server:/home/simon/src# wget https://simonh.uk/files/src/filter-dkimsign-0.5.tar.gz&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Extract both packages using &lt;code&gt;tar xvf &amp;lt;each_file&amp;gt;&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; into libopensmtpd first and run&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src/libopensmtpd-0.7# make -f Makefile.gnu&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You should get no errors. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src/libopensmtpd-0.7# make -f Makefile.gnu install&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, &lt;code&gt;cd&lt;/code&gt; into &lt;code&gt;../filter-dkimsign-0.5&lt;/code&gt; and run the two &lt;code&gt;make&lt;/code&gt; commands as above.&lt;/p&gt;

	&lt;h2&gt;Create Group and User&lt;/h2&gt;

	&lt;p&gt;Next, we&amp;#8217;ll create the group and user &lt;code&gt;_dkimsign&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:~# addgroup _dkimsign --force-badname 
Allowing use of questionable username.
Adding group `_dkimsign&amp;#39; (GID 1001) ...
Done.&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now add the &lt;code&gt;_dkimsign&lt;/code&gt; user to that group&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:~# useradd _dkimsign -g _dkimsign&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Create the directory to save your private key with the correct permissions:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:~# install -d -m 770 -o _dkimsign -g _dkimsign /etc/mail/dkim&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Log out as the &lt;code&gt;root&lt;/code&gt; user with &lt;code&gt;exit&lt;/code&gt; and run:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@server:~/src [ssh] $ sudo -u _dkimsign openssl genrsa -out /etc/mail/dkim/private.rsa.key 1024&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That has generated and saved our private key. Run below to get the public key that we&amp;#8217;ll save in our &lt;span class="caps"&gt;DNS&lt;/span&gt; records:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@server:~/src [ssh] $ sudo openssl rsa -in /etc/mail/dkim/private.rsa.key -pubout |     sed &amp;#39;1s/.*/v=DKIM1;p=/;:nl;${s/-----.*//;q;};N;s/\n//g;b nl;&amp;#39;
writing RSA key
v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCoaV4xJ1D4AeJ6XWU9ilt83yUnRUthPMh2R7qeMZEEHKQ+sWFiiiM5z4kpxwTsQNIvzMO2h8seh9XJIAPzVER8ac9AeCueXIAg/MwHWoZvIrBYJSeFmq6sgCacgKwayI9xp7QcqWmYGXiaBQnI21/SieA4GZsk/UTOiko7UFlE6wIDAQAB&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Copy the long line beneath &amp;#8220;writing &lt;span class="caps"&gt;RSA&lt;/span&gt; key&amp;#8221;, like so:&lt;/p&gt;

	&lt;p&gt;v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCoaV4xJ1D4AeJ6XWU9ilt83yUnRUthPMh2R7qeMZEEHKQ+sWFiiiM5z4kpxwTsQNIvzMO2h8seh9XJIAPzVER8ac9AeCueXIAg/MwHWoZvIrBYJSeFmq6sgCacgKwayI9xp7QcqWmYGXiaBQnI21/SieA4GZsk/UTOiko7UFlE6wIDAQAB&lt;/p&gt;

	&lt;p&gt;You need to save that in your &lt;span class="caps"&gt;DNS&lt;/span&gt; record section at you domain registrar as a &lt;code&gt;TXT&lt;/code&gt; record. &lt;/p&gt;

	&lt;p&gt;Following (seemingly) popular advice, I use today&amp;#8217;s date &lt;code&gt;20210622._domainkey&lt;/code&gt;. The part before the . (dot) is called the selector. We&amp;#8217;ll come back to that in a minute. &lt;/p&gt;

	&lt;p&gt;Next, we&amp;#8217;ll add the filter to our &lt;code&gt;/etc/smtpd.conf&lt;/code&gt; making sure to replace -d yourdomain.com and -s 20210622 with your domain and your selector!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;

filter dkimsign proc-exec &amp;quot;filter-dkimsign -d yourdomain.com -s 20210622 -k /etc/mail/dkim/private.rsa.key&amp;quot; user _dkimsign group _dkimsign

listen on socket filter &amp;quot;dkimsign&amp;quot;
listen on localhost filter &amp;quot;dkimsign&amp;quot;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Do a quick check that we have no syntax errors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src# smtpd -n
configuration OK&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Nearly there now! We&amp;#8217;ll restart and check that opensmtpd has no errors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon/src# systemctl restart opensmtpd
root@server:/home/simon/src# systemctl status opensmtpd
● opensmtpd.service - OpenSMTPD SMTP server
   Loaded: loaded (/lib/systemd/system/opensmtpd.service; enabled; vendor preset
   Active: active (running) since Wed 2021-06-23 15:11:43 BST; 5s ago
     Docs: man:smtpd(8)
  Process: 10351 ExecStart=/usr/sbin/smtpd (code=exited, status=0/SUCCESS)
 Main PID: 10352 (smtpd)
    Tasks: 9 (limit: 1148)
   Memory: 10.0M
   CGroup: /system.slice/opensmtpd.service
           ├─10352 /usr/sbin/smtpd
           ├─10353 smtpd: klondike
           ├─10354 smtpd: control
           ├─10355 smtpd: lookup
           ├─10356 smtpd: pony express
           ├─10357 smtpd: queue
           ├─10358 smtpd: scheduler
           ├─10359 /usr/sbin/smtpd
           └─10361 /usr/libexec/opensmtpd/filter-dkimsign -d yourdomain.com -s 20210622 

Jun 23 15:11:43 server systemd[1]: Starting OpenSMTPD SMTP server...
Jun 23 15:11:43 server smtpd[10351]: info: OpenSMTPD 6.6.4p1 starting
Jun 23 15:11:43 server systemd[1]: Started OpenSMTPD SMTP server.&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You can see in the last line, that &lt;code&gt;filter-dkimsign&lt;/code&gt; is running&lt;/p&gt;

	&lt;p&gt;Finally, we&amp;#8217;ll send an email to a gmail account and check that &lt;span class="caps"&gt;DKIM&lt;/span&gt; is a &amp;#8220;&lt;span class="caps"&gt;PASS&lt;/span&gt;&amp;#8221;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon# echo uptime | mail somebody@gmail.com&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Check your gmail account by clicking on the three dots next to reply and click &amp;#8220;Show original&amp;#8221;. If all went well, you&amp;#8217;ll see &lt;span class="caps"&gt;DKIM&lt;/span&gt; at the bottom and &amp;#8220;&lt;span class="caps"&gt;PASS&lt;/span&gt; with domain&amp;#8221; next to it:&lt;/p&gt;

	&lt;p&gt;&lt;img alt="DKIM pass at gmail" src="/img/2021-06-23/gmail_dkim.png" title="DKIM pass at gmail" /&gt;&lt;/p&gt;

	&lt;p&gt;Following these instructions, you should be &lt;span class="caps"&gt;DKIM&lt;/span&gt; friendly in about ten or fifteen minutes!&lt;/p&gt;

	&lt;p&gt;Any issues feel free to send me an email, or sign up for the opensmtpd mailing list &lt;a href="https://www.opensmtpd.org/list.html"&gt;here&lt;/a&gt; (subscribe to the misc one).&lt;/p&gt;

	&lt;h2 class="updates"&gt;Updates&lt;/h2&gt;

	&lt;p&gt;&lt;mark&gt;2025-01-05&lt;/mark&gt;: Mention that dkim is now included in Debian 12.&lt;/p&gt;</content><category term="mail"></category><category term="mail"></category><category term="smtp"></category><category term="debian"></category></entry><entry><title>Get an Email When Your Server Needs Updating</title><link href="https://simonh.uk/2021/05/01/get-an-email-when-your-server-needs-updating/" rel="alternate"></link><published>2021-05-01T00:00:00+01:00</published><updated>2021-05-01T00:00:00+01:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-05-01:/2021/05/01/get-an-email-when-your-server-needs-updating/</id><summary type="html">	&lt;p&gt;apticron to the rescue&lt;/p&gt;</summary><content type="html">	&lt;p&gt;I&amp;#8217;ve got four servers right now, and was wondering if someone had written a program to email the system adminstrator if there are any updates needed. Yep: &lt;a href="https://salsa.debian.org/debian/apticron"&gt;apticron&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Obviously, you need to be using Debian, or a derivative. &lt;/p&gt;

	&lt;p&gt;&lt;code&gt;$ sudo -s&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;# apt install apticron&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;# cp /usr/lib/apticron/apticron.conf /etc/apticron&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;# vim /etc/apticron/apticron.conf&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;And then add your email as below, found near the top of the file:&lt;/p&gt;

	&lt;p&gt;&lt;span class="caps"&gt;EMAIL&lt;/span&gt;=&amp;#8220;you@yourdomain.com&amp;#8221;&lt;/p&gt;

	&lt;p&gt;From now on, you&amp;#8217;ll get an email whenever apticron finds updates that you haven&amp;#8217;t yet installed. Below is the email that I got for one of my machines (my details hidden):&lt;/p&gt;

	&lt;p&gt;Subject: 2 Debian package update(s) for yourdomain.com&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;apticron report [Fri, 30 Apr 2021 17:42:05 +0100]
========================================================================

apticron has detected that some packages need upgrading on:

	yourdomain.com
	[ your server ip address ]

The following packages are currently pending an upgrade:

	linux-image-4.19.0-16-cloud-amd64 4.19.181-1
	linux-image-cloud-amd64 4.19+105+deb10u11

========================================================================

Package Details:

apt-listchanges: Reading changelogs...
apt-listchanges: Changelogs
---------------------------

--- Changes for linux-latest (linux-image-cloud-amd64) ---
linux-latest (105+deb10u11) buster; urgency=medium

  * Update to 4.19.0-16

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Fri, 19 Mar 2021 22:38:58 +0100

linux-latest (105+deb10u10) buster; urgency=medium

  * Update to 4.19.0-15

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Sat, 06 Mar 2021 08:37:46 +0100

linux-latest (105+deb10u9) buster-security; urgency=high

  * Update to 4.19.0-14

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Sat, 30 Jan 2021 08:43:43 +0100

linux-latest (105+deb10u8) buster; urgency=medium

  * Update to 4.19.0-13

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Fri, 27 Nov 2020 19:01:04 +0100

linux-latest (105+deb10u7) buster-security; urgency=high

  * Update to 4.19.0-12

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Sun, 18 Oct 2020 14:43:57 +0200

linux-latest (105+deb10u6) buster; urgency=medium

  * Update to 4.19.0-11

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Fri, 18 Sep 2020 20:48:30 +0200

linux-latest (105+deb10u5) buster; urgency=medium

  * Update to 4.19.0-10

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Thu, 09 Jul 2020 21:58:28 +0200

linux-latest (105+deb10u4) buster; urgency=medium

  * Update to 4.19.0-9

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Wed, 29 Apr 2020 16:16:38 +0200

linux-latest (105+deb10u3) buster; urgency=medium

  * Update to 4.19.0-8

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Fri, 31 Jan 2020 06:24:52 +0100

linux-latest (105+deb10u2) buster; urgency=medium

  * Update to 4.19.0-7

 -- Salvatore Bonaccorso &amp;lt;carnil@debian.org&amp;gt;  Sun, 29 Dec 2019 22:39:49 +0100

linux-latest (105+deb10u1) buster; urgency=medium

  * Update to 4.19.0-6

 -- Ben Hutchings &amp;lt;ben@decadent.org.uk&amp;gt;  Mon, 26 Aug 2019 02:16:02 +0100

========================================================================

You can perform the upgrade by issuing the command:

	apt-get dist-upgrade

as root on yourdomain.com

--
apticron&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;How awesome is that! &lt;/p&gt;</content><category term="mail"></category><category term="tips"></category><category term="debian"></category><category term="mail"></category></entry><entry><title>Mailutils - Tips and Tricks</title><link href="https://simonh.uk/2021/04/19/mailutils-tips-and-tricks/" rel="alternate"></link><published>2021-04-19T00:00:00+01:00</published><updated>2021-04-19T00:00:00+01:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-04-19:/2021/04/19/mailutils-tips-and-tricks/</id><summary type="html"></summary><content type="html">	&lt;p&gt;First things first: install mailutils and mailutils-doc&lt;/p&gt;

	&lt;p&gt;&lt;span class="caps"&gt;TBC&lt;/span&gt;&amp;#8230;&lt;/p&gt;</content><category term="mail"></category><category term="mailutils"></category><category term="mail"></category><category term="tips"></category></entry><entry><title>From Inbox Zero to Ten Thousand Unsorted Emails</title><link href="https://simonh.uk/2021/04/18/from-inbox-zero-to-ten-thousand-unsorted-emails/" rel="alternate"></link><published>2021-04-18T00:00:00+01:00</published><updated>2021-04-18T00:00:00+01:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-04-18:/2021/04/18/from-inbox-zero-to-ten-thousand-unsorted-emails/</id><summary type="html">	&lt;p&gt;Just breathe&amp;#8230; It&amp;#8217;s a backup!&lt;/p&gt;</summary><content type="html">	&lt;h1&gt;Inbox Zero, Always.&lt;/h1&gt;

	&lt;p&gt;I&amp;#8217;ve been hitting inbox zero on all my mail accounts for about three years now. All incoming mail gets either:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Deleted&lt;/li&gt;
		&lt;li&gt;Put into a folder&lt;/li&gt;
		&lt;li&gt;Left in the inbox if action is required &amp;#8212; and then put into a folder&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The same rules goes when I work as an employee. I get everything set up and mail is processed as it comes in. Today, I decided to backup my main gmail account with a view to ditching it one day, and also because backups are good!&lt;/p&gt;

	&lt;p&gt;I now have an backup email account with ~10100 emails. All there as one big list. The plan being (until I automate it) to forward emails each day / week to my backup account.&lt;/p&gt;

	&lt;p&gt;That&amp;#8217;s another task I was procrastinating about: done.&lt;/p&gt;</content><category term="mail"></category><category term="mail"></category><category term="backup"></category></entry><entry><title>OpenSMTPD for Outgoing Mail Only</title><link href="https://simonh.uk/2021/04/16/opensmtpd-for-outgoing-mail-only/" rel="alternate"></link><published>2021-04-16T00:00:00+01:00</published><updated>2021-04-16T00:00:00+01:00</updated><author><name>Simon Harrison</name></author><id>tag:simonh.uk,2021-04-16:/2021/04/16/opensmtpd-for-outgoing-mail-only/</id><summary type="html">	&lt;p&gt;Sending email should be easy&lt;/p&gt;</summary><content type="html">	&lt;p&gt;&lt;img alt="OpenSMTPD Logo" src="/img/logo/opensmtpd.webp" title="OpenSMTPD Logo" /&gt;&lt;/p&gt;

	&lt;h1&gt;Why?&lt;/h1&gt;

	&lt;p&gt;You&amp;#8217;ve got a server and sometimes you need to send outgoing emails. Like me, you may have messed around using someone elses &lt;span class="caps"&gt;SMTP&lt;/span&gt; server. Maybe, you&amp;#8217;ve had a go at setting up Postfix or Exim? &lt;/p&gt;

	&lt;p&gt;It&amp;#8217;s a lot of hard work, isn&amp;#8217;t it?&lt;/p&gt;

	&lt;p&gt;Well, I couldn&amp;#8217;t be arsed with all that, and eventually came across the awesome &lt;a href="http://opensmtpd.org"&gt;opensmtpd&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;If you&amp;#8217;re on Debian 10 (Buster), make sure you&amp;#8217;ve enabled Debian Backports in your sources.list and run:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install opensmtpd/buster-backports&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You need to install from backports because the configuration syntax changed. The standard buster package will give you version 6.0.3, but we want at least 6.6&lt;/p&gt;

	&lt;p&gt;Run &lt;code&gt;# smtpd -h&lt;/code&gt; to check:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon# smtpd -h
version: OpenSMTPD 6.6.4p1
usage: smtpd [-dFhnv] [-D macro=value] [-f file] [-P system] [-T trace]&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Below is the defaut config file &amp;#8220;/etc/smtpd.conf&amp;#8221;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;OpenBSD: smtpd.conf,v 1.10 2018/05/24 11:40:17 gilles Exp $
# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.
table aliases file:/etc/aliases
# To accept external mail, replace with: listen on all
#
listen on localhost
action &amp;quot;local&amp;quot; maildir alias &amp;lt;aliases&amp;gt;
action &amp;quot;relay&amp;quot; relay
# Uncomment the following to accept external mail for domain &amp;quot;example.org&amp;quot;
#
# match from any for domain &amp;quot;example.org&amp;quot; action &amp;quot;local&amp;quot;
match for local action &amp;quot;local&amp;quot;
match from local for any action &amp;quot;relay&amp;quot; &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;For outgoing mail only, we don&amp;#8217;t need to touch this at all!&lt;/p&gt;

	&lt;h2&gt;&lt;span class="caps"&gt;DNS&lt;/span&gt; Records&lt;/h2&gt;

	&lt;p&gt;We need to tell our domain registrar that we&amp;#8217;re handling our mail now. &lt;/p&gt;

	&lt;p&gt;First, we&amp;#8217;ll set an &lt;code&gt;A&lt;/code&gt; record with the IP address of our server and a hostname of &lt;code&gt;mail&lt;/code&gt; I threw in &lt;code&gt;smtp&lt;/code&gt; as well.&lt;/p&gt;

	&lt;p&gt;&lt;img alt="DNS A records" src="/img/2021-04-16/dns_a_records.png" title="DNS A records" /&gt;&lt;/p&gt;

	&lt;p&gt;Next we&amp;#8217;ll set our &lt;code&gt;MX&lt;/code&gt; records. The &lt;code&gt;10&lt;/code&gt; in the screenshot below is the priority. I usually see this as &lt;code&gt;10&lt;/code&gt; so that&amp;#8217;s what I&amp;#8217;ve been using. &lt;/p&gt;

	&lt;p&gt;&lt;img alt="DNS MX record" src="/img/2021-04-16/dns_mx_record.png" title="DNS MX record" /&gt;&lt;/p&gt;

	&lt;p&gt;Now we&amp;#8217;ll set our &lt;span class="caps"&gt;SPF&lt;/span&gt; (Sender Policy Framework). As long as we&amp;#8217;ve set our &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;MX&lt;/code&gt; records, we can just put this as a &lt;code&gt;TXT&lt;/code&gt; record:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;v=spf1 a mx -all&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;img alt="DNS TXT Record" src="/img/2021-04-16/dns_txt_record.png" title="DNS TXT Record" /&gt;&lt;/p&gt;

	&lt;p&gt;If you want to know more, here is a good article on the topic: &lt;a href="https://blog.mailtrap.io/spf-records-explained/#When_you_need_SPF"&gt;mailtrap blog&lt;/a&gt;&lt;/p&gt;

	&lt;h2&gt;Reverse &lt;span class="caps"&gt;DNS&lt;/span&gt;&lt;/h2&gt;

	&lt;p&gt;&lt;a href="https://www.cloudflare.com/en-gb/learning/dns/dns-records/dns-ptr-record/"&gt;Cloudflare&lt;/a&gt; explanation of a &lt;code&gt;PTR&lt;/code&gt; record&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;The Domain Name System, or &lt;span class="caps"&gt;DNS&lt;/span&gt;, correlates domain names with IP addresses. A &lt;span class="caps"&gt;DNS&lt;/span&gt; pointer record (&lt;span class="caps"&gt;PTR&lt;/span&gt; for short) provides the domain name associated with an IP address. A &lt;span class="caps"&gt;DNS&lt;/span&gt; &lt;span class="caps"&gt;PTR&lt;/span&gt; record is exactly the opposite of the &amp;#8216;A&amp;#8217; record, which provides the IP address associated with a domain name.&lt;br /&gt;
DNS &lt;span class="caps"&gt;PTR&lt;/span&gt; records are used in reverse &lt;span class="caps"&gt;DNS&lt;/span&gt; lookups. When a user attempts to reach a domain name in their browser, a &lt;span class="caps"&gt;DNS&lt;/span&gt; lookup occurs, matching the domain name to the IP address. A reverse &lt;span class="caps"&gt;DNS&lt;/span&gt; lookup is the opposite of this process: it is a query that starts with the IP address and looks up the domain name.&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;So, lastly, you need to set the reverse &lt;span class="caps"&gt;DNS&lt;/span&gt; or &lt;code&gt;PTR&lt;/code&gt; record for you IP on your &lt;span class="caps"&gt;VPS&lt;/span&gt; settings page. &lt;/p&gt;

	&lt;p&gt;You&amp;#8217;ll (usually) find this in your IP settings. All you need to do is put set &lt;span class="caps"&gt;RDNS&lt;/span&gt; or reverse &lt;span class="caps"&gt;DNS&lt;/span&gt; to your hostname. For this site, that&amp;#8217;d be &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simonh.uk&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Let&amp;#8217;s check opensmtpd is running correctly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@server:~ [ssh] $ systemctl status opensmtpd
● opensmtpd.service - OpenSMTPD SMTP server
   Loaded: loaded (/lib/systemd/system/opensmtpd.service; enabled; vendor preset
   Active: active (running) since Fri 2021-06-11 07:47:36 BST; 3 days ago
     Docs: man:smtpd(8)
  Process: 28100 ExecStart=/usr/sbin/smtpd (code=exited, status=0/SUCCESS)
 Main PID: 28101 (smtpd)
    Tasks: 7 (limit: 1166)
   Memory: 11.8M
   CGroup: /system.slice/opensmtpd.service
           ├─28101 /usr/sbin/smtpd
           ├─28102 smtpd: klondike
           ├─28103 smtpd: control
           ├─28104 smtpd: lookup
           ├─28105 smtpd: pony express
           ├─28106 smtpd: queue
           └─28107 smtpd: scheduler&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Send a test email:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@server:~ [ssh] $ echo &amp;quot;hello!&amp;quot; | mail -s &amp;#39;hi from server!&amp;#39; web@simonh.uk&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And in my email client (Claws Mail):&lt;/p&gt;

	&lt;p&gt;&lt;img alt="Server Email" src="/img/2021-04-16/mail.png" title="Server Email" /&gt;&lt;/p&gt;

	&lt;p&gt;So, all went well.&lt;/p&gt;

	&lt;h2&gt;Closing Notes&lt;/h2&gt;

	&lt;p&gt;Ideally, we&amp;#8217;d also set up &lt;span class="caps"&gt;DKIM&lt;/span&gt;, which along with &lt;span class="caps"&gt;SPF&lt;/span&gt; helps to improve the chances of your emails not being labelled as spam. But in my case, it wasn&amp;#8217;t worth the trouble (and I did have trouble). &lt;/p&gt;

	&lt;p&gt;As I&amp;#8217;m only sending mail to accounts I control, I can also label them as &amp;#8220;&lt;span class="caps"&gt;NOT&lt;/span&gt; &lt;span class="caps"&gt;SPAM&lt;/span&gt;&amp;#8221; if they get the dreaded &lt;code&gt;[SPAM]&lt;/code&gt; header.&lt;/p&gt;

	&lt;h2&gt;&lt;span class="caps"&gt;PKI&lt;/span&gt; Encryption (Added 2021-06-15)&lt;/h2&gt;

	&lt;p&gt;Assuming you&amp;#8217;re using Apache 2.4 as your web server:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo apt install certbot python3-certbot-apache
$ sudo certbot certonly -d yourdomain.com --apache&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;and then in your &lt;code&gt;/etc/smtpd.conf&lt;/code&gt; add the following lines&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pki yourdomain.com key &amp;quot;/etc/letsencrypt/live/yourdomain.com/privkey.pem&amp;quot;
pki yourdomain.com cert &amp;quot;/etc/letsencrypt/live/yourdomain.com/fullchain.pem&amp;quot;

listen on eth0 port 25 tls pki yourdomain.com&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then run&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon# smtpd -n
configuration OK&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Finally, restart opensmtpd, and I always check that there are no errors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@server:/home/simon# systemctl restart opensmtpd
root@server:/home/simon# systemctl status opensmtpd
● opensmtpd.service - OpenSMTPD SMTP server
   Loaded: loaded (/lib/systemd/system/opensmtpd.service; enabled; vendor preset
   Active: active (running) since Fri 2021-06-11 07:47:36 BST; 4 days ago
     Docs: man:smtpd(8)
  Process: 28100 ExecStart=/usr/sbin/smtpd (code=exited, status=0/SUCCESS)
 Main PID: 28101 (smtpd)
    Tasks: 7 (limit: 1166)
   Memory: 11.8M
   CGroup: /system.slice/opensmtpd.service
           ├─28101 /usr/sbin/smtpd
           ├─28102 smtpd: klondike
           ├─28103 smtpd: control
           ├─28104 smtpd: lookup
           ├─28105 smtpd: pony express
           ├─28106 smtpd: queue
           └─28107 smtpd: scheduler&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The final thing to do is to connect from another machine to the server and check the output. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simon@computer:~$ openssl s_client -starttls smtp -connect yourdomain.com:25
CONNECTED(00000003)                                                                                                                                                                                                                           
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1                                                                                                                                                                       
verify return:1                                                                                                                                                                                                                               
depth=1 C = US, O = Let&amp;#39;s Encrypt, CN = R3                                                                                                                                                                                                    
verify return:1                                                                                                                                                                                                                               
depth=0 CN = yourdomain.com
verify return:1  
---                                                        
Certificate chain                                          
 0 s:CN = yourdomain.com                                        
   i:C = US, O = Let&amp;#39;s Encrypt, CN = R3                    
 1 s:C = US, O = Let&amp;#39;s Encrypt, CN = R3                    
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1                                                   
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1                                                   
   i:O = Digital Signature Trust Co., CN = DST Root CA X3                                                              
---                                                        
Server certificate                                         
-----BEGIN CERTIFICATE-----                                
MIIFEjCCA/qgAwIBAgISA4O0G2Qpj6nXyJYMVicL2zLVMA0GCSqGSIb3DQEBCwUA                                                       
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD                                                       
EwJSMzAeFw0yMTA2MTUxNjQ5NDFaFw0yMTA5MTMxNjQ5NDBaMBExDzANBgNVBAMT                                                       
BmIxeC51azCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN6YKF+LQTPz                                                       
2FxMeho/DG5XoapUTlOcTVSGJf/P9v1ZW6qiOKMDv7y9LRXTQ7RdJWp8fd+XN0HT                                                       
j/gUNh5iOt3n7KEEa5inl47o7eE/KSKUgvwRkHc4HNmPEgdqQ2QrbvGaOFGzDj07                                                       
dA68TNmHk1r3sy1NeJWipTp4qVjyuEVOLShWVBsLl/RL/Esg8XvbSAYwq8LBems/                                                       
K4LFrJ4mZ1IVJYZZ+O6oyyCApjlWVy8fxvFNkeZz9Y5nMp7KQuLwRus/jWj/zRiK                                                       
KKmtnA0tGm/QydJy2ozGcsyr8inWd+7A7SDpe3KiquznM2nj/3xlg2swKVzBx9zr                                                       
Ymh4ibCJdbsCAwEAAaOCAkEwggI9MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAU                                                       
BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUj1Dv                                                       
xS3CzTjZ7bRHAf4oT/bsoqYwHwYDVR0jBBgwFoAUFC6zF7dYVsuuUAlA5h+vnYsU                                                       
wsYwVQYIKwYBBQUHAQEESTBHMCEGCCsGAQUFBzABhhVodHRwOi8vcjMuby5sZW5j                                                       
ci5vcmcwIgYIKwYBBQUHMAKGFmh0dHA6Ly9yMy5pLmxlbmNyLm9yZy8wEQYDVR0R                                                       
BAowCIIGYjF4LnVrMEwGA1UdIARFMEMwCAYGZ4EMAQIBMDcGCysGAQQBgt8TAQEB                                                       
MCgwJgYIKwYBBQUHAgEWGmh0dHA6Ly9jcHMubGV0c2VuY3J5cHQub3JnMIIBBAYK                                                       
KwYBBAHWeQIEAgSB9QSB8gDwAHYARJRlLrDuzq/EQAfYqP4owNrmgr7YyzG1P9Mz                                                       
lrW2gagAAAF6EMsQnwAABAMARzBFAiEA0wta1rOTMW7dz8zoJKN8vnPOn9vkyePd                                                       
jZt7nzKLk9gCIGV0zwsC1slAZSI48jdTh/QqgWRvh3wBBER/uepFtyJCAHYAfT7y                                                       
+I//iFVoJMLAyp5SiXkrxQ54CX8uapdomX4i8NcAAAF6EMsRKwAABAMARzBFAiAZ                                                       
SrWghf/uJDEMLg0N9K699d/0RmTr3L8uGFYp/9IBtQIhAMfeqE72W59iwARaf7jG                                                       
TmIvVKSbR3Xlls0ZhpJ2TuPoMA0GCSqGSIb3DQEBCwUAA4IBAQArgYBB2rE/PC98                                                       
TMOP/oNFRngEH0e5vVpc75r1CFy8urTbrfIW4NB7xevGK9FNQ2n7mUGmrtN1Gcra                                                       
WcRld3lzbEb/6jjbFO+X2DtAr8Xbn/MzfSCztEAW9P9iTaCjhHbqAiCsU18n13xb                                                       
f9GNkQoU+VSNOXRK6+aMWY/DAkvd0+IJ7qiZwZWFHhFlpPNO35VLSHslD+P02Fsz                                                       
BfNw0XhShOM5rBsilqQE3axr6EjTMQknTqWAj3xU/VEQj1H1VK5GonUyJzDVo7/c                                                       
X9QgI9F5nItsYFAEZLtRsctS/w8TM0JapAlfxVilgu53r1p97q4yjO94GCCB6tgL                                                       
KitlxSDz                                                   
-----END CERTIFICATE-----                                  
subject=CN = yourdomain.com                                      

issuer=C = US, O = Let&amp;#39;s Encrypt, CN = R3                &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That all looks good.&lt;/p&gt;</content><category term="mail"></category><category term="mail"></category><category term="linux"></category><category term="smtp"></category><category term="debian"></category></entry></feed>