News for hackers. Stuff that matters.
Re:SMTP protocol basics from scratch in Go: receiving email ... by don-code on Saturday April 09, 2022 @09:50PM (#30973790)
Mail self-hoster here. There's an additional wrinkle, which luckily you may never encounter in the public cloud space: in addition to typically being unable to _send_ mail from residential Internet connections, it's many times also not possible to _receive_ mail on a residential Internet connection.

On the outbound side, many accepters of mail will deny mail from SMTP servers on a residential IP address, as provided by the Spamhaus Policy Block List (https://www.spamhaus.org/pbl/) or equivalent. Unfortunately, there's not much one can do to get off this list - ISPs self-publish their own residential IP space onto it. In order to self-host from home, business-class service or higher is in order. Or, again, use the public cloud, and hope your compute instance's IP isn't on some other block list.

On the inbound side, though, many ISPs block inbound port 25. Since that's the agreed-upon port for mail receipt, there's no real way around this. Several times while I self-hosted off residential, I was able to call Comcast support and ask for the ban to be lifted, but not before fighting through several layers of level one support asking me to configure my mail client differently. The real kicker, though, is any time my modem was rebooted (I owned my modem, too!), I had to call in and request it _again_. My (very small local) ISP in upstate New York also performed this blocking, but _would not_, in the face of any complaining, lift the block.

Re:SMTP protocol basics from scratch in Go: receiving email ... by throwawayboise on Saturday April 09, 2022 @10:11PM (#30973882)
In the ISP's defense, 99% of the time an SMTP sender in their residential address space is going to be a compromised device sending spam. It's pretty understandable that they would just decide that pissing off the relatively very few customers who want to run their own mail servers is a cost they are willing to accept.
Re:SMTP protocol basics from scratch in Go: receiving email ... by koolba on Saturday April 09, 2022 @10:55PM (#30974096)
I bet it’s more than 99% too. Even amongst the tech savvy, there’s special level of dedication to run your own mail infrastructure. It’s like one in 10-25K.
Re:SMTP protocol basics from scratch in Go: receiving email ... by oefrha on Saturday April 09, 2022 @11:14PM (#30974187)
There’s running your own mail, then there’s running your own mail from residential. The dozens of us who do the former mostly don’t do the latter, thanks to the obvious vicious cycle.
Re:SMTP protocol basics from scratch in Go: receiving email ... by cm2187 on Sunday April 10, 2022 @04:16AM (#30975290)
Though I belong to the former, I do use my residential ip as a failover server for when my primary server is down, to not lose incoming emails.
Re:SMTP protocol basics from scratch in Go: receiving email ... by james_in_the_uk on Sunday April 10, 2022 @05:13AM (#30975529)
What’s the benefit of this over a cheap VPS? Privacy?
Re:SMTP protocol basics from scratch in Go: receiving email ... by cm2187 on Sunday April 10, 2022 @07:13AM (#30976089)
Just cheaper. I mean again I do pay for a server in a datacentre as my primary server. I have a home server too anyway, so using it as a mail failover adds redundancy for free.

Also I am using windows (smartermail) so even a cheap vps isn’t that cheap.

Re:SMTP protocol basics from scratch in Go: receiving email ... by neurostimulant on Sunday April 10, 2022 @05:57AM (#30975709)
I remembered finding some mails originating from my laptop in my gmail spam folder around the time I switched to mac from linux around 2012. I was tinkering with an instance of wordpress in that laptop and turns out sendmail in OSX was capable of sending out email to gmail out of the box without any configuration from my part (I don't remember configuring sendmail in that machine). The wordpress instance was simply used php's sendmail support and happily blasting emails without my knowledge (thankfully only to my own's address). I wonder if recent version of mac still ships with sendmail.
Re:SMTP protocol basics from scratch in Go: receiving email ... by jjav on Sunday April 10, 2022 @01:58AM (#30974760)
No special level of dedication needed. I'm one of the many who run my own email infrastructure and it is very little work. Nearly none, really, aside from initial setup.

However, I don't run it from home over residential ISP connection.

Re:SMTP protocol basics from scratch in Go: receiving email ... by cm2187 on Sunday April 10, 2022 @04:19AM (#30975299)
Still, it’s not trivial to set up, particularly if you want TLS connections, monitoring brute force attacks, etc.
Re:SMTP protocol basics from scratch in Go: receiving email ... by necovek on Sunday April 10, 2022 @07:30AM (#30976167)
Not the poster you are replying to, but as a self-hoster (on a static residential IP though) I don't necessarily care about brute forcing that doesn't completely kill off my connection (I've actually got two residential connections used as fail-over: 1Gbit/200Mbit + 500Mbit/50Mbit, though set up as round-robin on the incoming domains [same priority]).

I mostly run the mail for my family and myself, so the attack surface is reasonably small.

My network mostly only dies when one of the ISP-provided modems slows down too much without actually killing off the actual connection (so pings seem to keep working from my OpenWRT router to detect dead connections), which requires resetting that modem (happens only every few months, rare enough for me to bother debugging it: it's usually my dad who pings me early the next morning that his email is not working :)).

Re:SMTP protocol basics from scratch in Go: receiving email ... by cm2187 on Sunday April 10, 2022 @07:44AM (#30976235)
Sorry, I didn't mean brute force as in DDOS, but as in brute forcing passwords. Particularly if you run it for your family, you are at the mercy of one having a weak password, and as soon as a bot has access to one of your mail accounts, it will send spam and you can kiss goodbye your IP/domain reputation.
Re:SMTP protocol basics from scratch in Go: receiving email ... by necovek on Sunday April 10, 2022 @09:15AM (#30976697)
Yeah, I got that, and while I am mildly worried about that, it hasn't been an issue in the last almost 20 years.

I am only mentioning bandwidth because someone could easily saturate my internet connections by extensively brute forcing, and that's another mild concern (perhaps those are things that kill my modems?).

In practice, biggest issue is that Gmail in particular will never rank your server as trusted because you are sending too low a volume (how's that for an anti spam measure?), and 1/3rd of recepients report emails ending up in spam folders. Curiously, only Gmail does that.

Re:SMTP protocol basics from scratch in Go: receiving email ... by jjav on Sunday April 10, 2022 @04:20PM (#30981290)
> Sorry, I didn't mean brute force as in DDOS, but as in brute forcing passwords.

That's super easy to avoid. Use strong passwords.

Heat death of the universe will arrive before anything brute forces a 30 character password generated off /dev/random

I don't have any of my users (just family) set their email passwords, those are generated to be strong. These are not passwords that need to be seen or remembered by anyone, they just go into the IMAP client config.

Re:SMTP protocol basics from scratch in Go: receiving email ... by pkulak on Sunday April 10, 2022 @02:57AM (#30974994)
Yeah, but we’re talking about inbound port 25.
Re:SMTP protocol basics from scratch in Go: receiving email ... by seedie on Sunday April 10, 2022 @04:55AM (#30975454)
I guess the argument for inbound blocking is that its way too easy to configure an open relay which is then used to send spam.
Re:SMTP protocol basics from scratch in Go: receiving email ... by u801e on Sunday April 10, 2022 @06:50AM (#30975979)
But the outbound block would prevent the relay from sending any mail over port 25, so there's no real point to block inbound connections.
Re:SMTP protocol basics from scratch in Go: receiving email ... by xanaxagoras on Sunday April 10, 2022 @12:19PM (#30978554)
I'm thinking the ISP in upstate New York misunderstood the situation in a way similar to the comment above you.
Re:SMTP protocol basics from scratch in Go: receiving email ... by seedie on Monday April 11, 2022 @03:21AM (#30985686)
I've no argument beyond that. You're right.
Re:SMTP protocol basics from scratch in Go: receiving email ... by amelius on Sunday April 10, 2022 @06:36AM (#30975903)
> In the ISP's defense, 99% of the time an SMTP sender in their residential address space is going to be a compromised device sending spam

99% of people don't use their home computer to write programs. Some people who write computer programs at home cause trouble. Should we therefore ban programming languages for individuals?

Re:SMTP protocol basics from scratch in Go: receiving email ... by necovek on Sunday April 10, 2022 @07:31AM (#30976174)
Most ISPs do not outright ban it. They just default to blocking outgoing port 25 packets. Usually it's a support request away from opening it for a customer, especially with a static IP address (I've done that for the last ~19 years with a Serbian ISP).

Of course, how well your support requests are handled is another matter.

Re:SMTP protocol basics from scratch in Go: receiving email ... by jamal-kumar on Sunday April 10, 2022 @11:03AM (#30977560)
Ohhhhhh there's a way! Pure End-To-End SMTP sending and receiving! It involves some pretty interesting tomfoolery using IPSEC tunnels on a pure OpenBSD setup, but even works when you don't have a fixed IP.

https://www.exoticsilicon.com/jay/smtp_via_ipsec_tunnels

Re:SMTP protocol basics from scratch in Go: receiving email ... by guiambros on Sunday April 10, 2022 @11:05PM (#30984127)
"In this guide, Jay shows us how to setup an IPSEC tunnel between a local machine running OpenBSD, and a remote VM hosted at OpenBSD Amsterdam..."

A tunnel to a vm hosted on a cloud provider is far from "running SMTP servers on a residential IP address" that OP was referring to.

Re:SMTP protocol basics from scratch in Go: receiving email ... by jamal-kumar on Monday April 11, 2022 @11:06AM (#30989814)
If you're not as impressed by end to end SMTP as I am then I feel you're missing out! Oviously you need domains with RDNS and everything to point to a public IP address for relay, but if it's a really cheap VPS that's pretty cool. Sure is a LOT lighter than running a full mail server with three or four protocols to get things right and keeping that up to date and exposed to the public.