mikejsavage.co.uk / blog

RSS feed

08 Sep 2018 / Least effort image self-hosting

My requirements:

I already have mail clients on my PC/phone, and a mail server running on my VPS, so writing it as an MDA seemed like the least effort approach. It ended up being one line in smtpd.conf, 70 lines of python, and a DNS entry.

The smtpd.conf entry looks like this:

accept from any for domain "topsecret.mikejsavage.co.uk" virtual { "alsotopsecret" => mike } deliver to mda "mkgallery" as gallery

The subdomain and recipient kind of act as passwords, obviously that’s bogus but it’s good enough to keep the kids out.

And the code: mkgallery.py

Attaching images in the iOS mail client is kind of annoying and you can only send a few images at once because smtpd rejects huge messages, but it’s still better than everyone else’s image hosting services and I knocked it out in like a day so whatever.