Setting up email server, need a good order of operations reddit / selfhosted ---------------------------------------------------------------------- erik530195 · 2023-11-23 17:38 I own a couple domain names through gandi. I do not have the ability to get a static IP from my ISP. My main goal is to get an email server up and running on docker which I can use with mail clients like thunderbird on various devices. (I understand the drawbacks of self hosting email, this is to learn and reduce cost.) I'm not sure where to start though, do I use something like duckdns first to get my domain name hosted on my server, then do postfix or something? I think once I have a good order of operations I can handle it from there. This may complicate things, the server in question is a desktop with docker running all my self hosted stuff. The desktop has mullvad on 24/7. Will this vpn interfere with anything I'm trying to do here? If so I will need to figure out a way to split tunnel. ---------------------------------------------------------------------- foofusdotcom · 2023-11-23 18:16 You're going to somehow need a static IP for this. I recommend getting some inexpensive VPS to do this on at least in the short term so you don't make it MUCH harder than it needs to be! A basic order of operations is: 1) Get your VPS and a Static IP 2) Install a server platform (Linux, BSD, etc) 3) Once you've tightened the platform down a bit (e.g, lock SSH down to pubkey or strengthen your passwords, etc) you can start the email bits 4) In your DNS portal, you want to register a MX record. This tells everywhere else what server handles mail for your domain. 5) While you're at it, setup a "SPF" record (google it) which is very simple and is a TXT record entry in DNS. 6) Once your DNS has propogated and the MX record points to your static IP, 7) You can install mailserver daemons. Postfix is a great one start out with. Configure it as an internet mailserver. 8) Time to tune postfix for antispam - make sure you aren't an open relay, etc. By the end of Step 8 you should be able to send and receive email. 9 (and onward) - Here you tune things. Install spam filter daemons, DKIM and DMARC (so you don't get filtered by others!) (( learndmarc.com is a great resource here )), install an imap server for fetching your mail, etc. ---------------------------------------------------------------------- Other-Technician-718 · 2023-11-23 18:19 There are some basics that are not optional - they are a must have: static IP with reverse DNS (PTR) record nothing in your PTR record seeming like an IP address or a residential internet line (ideally you can set that PTR record) open port 25 for sending and recieving DKIM spf SSL/TLS your IP not on any block list good IP reputation (if you messed up a few months ago - or your IP neighbours - then your mail will end in spam more often) I guess that list is not complete... I used the guide at workaround.org ---------------------------------------------------------------------- foofusdotcom · 2023-11-23 18:20 For even more info, here's the slides from a talk I gave at a security conference on why running your own mailserver will help you learn security. Some of the order of operation stuff is outlined in the order of slides. https://foofus.com/a/p/ryom.pdf ---------------------------------------------------------------------- erik530195 · 2023-11-23 18:29 Is there not some kind of workaround for a static ip? If I have to get a VPS, even if inexpensive, it negates one of my reasons for doing this and I'd do just as well to just pay gandi to keep hosting my email. (However I may still play around with a LAN only one just to learn how to do it) ---------------------------------------------------------------------- lesigh · 2023-11-23 18:30 Self hosting without a static IP is a great way for your emails to be rejected.+1 for vps ---------------------------------------------------------------------- erik530195 · 2023-11-23 18:31 Ok, so something like duckdns *can* be used, but is just going to cause headaches later on? ---------------------------------------------------------------------- foofusdotcom · 2023-11-23 18:32 It is technically possible to run a mailserver without a static IP, but practically speaking that introduces SO much complexity and unreliability that I can't in good conscience recommend it to someone who is just learning. That'd be like giving a brand new student pilot a four-engine experimental aircraft with two jets and two propellors to fly around. ---------------------------------------------------------------------- erik530195 · 2023-11-23 18:37 Understandable. I think I'll just pony up to gandi right now to keep things simple. But like I said I may do a locally hosted mailserver with postfix just to screw around with, not something to be used outside my own network. ---------------------------------------------------------------------- floler · 2023-11-23 19:54 VPS + „Mail Server in a Box“ easy to setup all in one solution ---------------------------------------------------------------------- wing03 · 2023-11-23 20:28 In order to be taken seriously (not presumed to be a spambot), need rDNS. No ISP (aka the owner of the IP) will do that for you. Should have a static IP that can earn and maintain a reputation. ISP DHCP address pools are pretty much all blacklisted from the getgo and ISPs will block all tcp 25 traffic going in and out of those blocks. ---------------------------------------------------------------------- pandaeye0 · 2023-11-24 07:22 >duckdns In case you are not yet familiar with static or dynamic IP, or what is dynamic DNS, you probably need some google first. But to say simply, duckdns is a dynamic DNS, which can give you a domain name that detects changes in your dynamic IP and point to it dynamically. So you mailserver would still be running with a dynamic IP address, with all the disadvantages mentioned in the other replies. Therefore unless you can get a static IP from your ISP, VPS is the second option.