smtp not accepting connections on port 25 reddit / selfhosted ---------------------------------------------------------------------- kajvans · 2023-12-15 22:26 Hi everyone i am trying to run my own mail server but this hiccup i cant find any fix for. i tried connecting to port 25 using telnet on my machine where i run the server and it works fine with localhost and [mail.domain.com](https://mail.domain.com) but when try this from my personal computer i get a connection timeout. Cant find any postfix error logs or some other error logs. The port does react to pings. things i tried: disabling firewall, disabling helo configuration further i dont know what maybe can fix it: postfix configuration: alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no broken_sasl_auth_clients = yes compatibility_level = 2 home_mailbox = Maildir/ inet_interfaces = all inet_protocols = all mailbox_command = mailbox_size_limit = 0 mydestination = $myhostname, mail.quiztimes.nl, quiztimes.nl, smtp.quiztimes.nl, debian, localhost.localdomain, localhost mydomain = quiztimes.nl myhostname = mail.quiztimes.nl mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = smtp_tls_CApath = /etc/ssl/certs smtp_tls_note_starttls_offer = yes smtp_tls_security_level = may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_use_tls = yes smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname, check_helo_access hash:/etc/postfix/helo_access smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_tls_cert_file = /etc/letsencrypt/live/mail.quiztimes.nl/fullchain.pem smtpd_tls_key_file = /etc/letsencrypt/live/mail.quiztimes.nl/privkey.pem smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_security_level = may smtpd_use_tls = yes ​ ---------------------------------------------------------------------- RedditSlayer2020 · 2023-12-15 22:36 check the mynetworks part I think it only listens on local host for ipv4. ipv6 seems ok ---------------------------------------------------------------------- adamshand · 2023-12-15 22:37 If I'm understanding correctly, on the mail server itself you can telnet successfully to both localhost:25 and the DNS name (eg. mail.domain.com:25)? But if you try from another computer it doesn't work? If so, your Postfix configuration is fine. You have something breaking the connections. Either a firewall rule on the mail server (run `iptables -L -N`) or perhaps a network firewall? Or a network misconfiguration which isn't allowing connections. ---------------------------------------------------------------------- kajvans · 2023-12-15 22:44 Yes you understood correctly. I tried disabling the firewall but it did nothing and also removed all the help restrictions but also no success. I don't know what other configuration could cause it ---------------------------------------------------------------------- kajvans · 2023-12-15 22:46 Inet&interfaces and inet_protocols are both set to all ---------------------------------------------------------------------- thekrautboy · 2023-12-15 22:51 > The port does react to pings. Hint: Ports themself dont react to pings, sort of. You ping a IP with ICMP ECHO (which technically uses a specific port) and then the IP might respond (unless the service is instructed not to (firewall?), so no response to a PING doesnt mean the machine is dead). If you want to check if a port is open, test for connections to it. curl, wget, nmap, plenty of options. Try /r/HomeNetworking ---------------------------------------------------------------------- adamshand · 2023-12-15 22:53 I can't help more than that, sorry. It's almost certainly not Postfix if you can connect locally. You have something blocking (or misdirecting) the data. I don't think it's used much any more, but check /etc/hosts.deny (and hosts.allow). If that's blocking, you should see something in your logs though. Make sure you've checked all your logs carefully though. Did you run the iptables command I gave you and make sure that there are no lingering rules? ---------------------------------------------------------------------- kajvans · 2023-12-15 23:01 my vps is rented so that is not local, nmap says port 25 is filtert also when firewall is disabled so dont got any new information sadly. i contacted the hosters of the vps if they block port 25. could it be that my homenetwork is not letting any connections out? ---------------------------------------------------------------------- kajvans · 2023-12-15 23:03 i dont use iptables i use ufw, but it is not firewall related because same problem when ufw is disabled. tried running nmap and it says the state of the port is filtered but i dont know why ---------------------------------------------------------------------- thekrautboy · 2023-12-15 23:03 Outward shouldnt be a problem. Its very likely that your VPS host doesnt allow incoming port 25 SMTP connections, regardless of what your VPS firewall is set to. So i would recommend you wait for a response from them. Or simply look at the FAQ etc that they probably provide and the answer will be there. ---------------------------------------------------------------------- kajvans · 2023-12-15 23:05 oke thanks for your help, is it maybe an idea to change port of smtp to test it? ---------------------------------------------------------------------- thekrautboy · 2023-12-15 23:10 Of course you can set your SMTP server to listen to a different port and then try to connect with telnet from the outside as example, just to confirm this. But typically proper email servicing requires a port 25 for SMTP. Often very cheap VPS providers block this because they get abused for spam emails otherwise. So if that is where you found yourself now, you probably need to either pay more at your current provider or switch to another. ---------------------------------------------------------------------- kajvans · 2023-12-15 23:13 yes fixed. i am going to contact them and ask them if they can open it, but if they dont do you think it is going to be a problem if i run it on another port? ---------------------------------------------------------------------- thekrautboy · 2023-12-15 23:24 Imo it simply wont work for a lot of mail delivery because other servers expect your port 25 to be open to accept emails. If you move it to another port, how would another server know that?... Email to selfhost is a bitch. ---------------------------------------------------------------------- RedditSlayer2020 · 2023-12-16 00:01 just for your interest interfaces means your network adapters and protocols mean tcp/udp both have nothing to do with ip addresses, subnets like 127.0 0.1/24 ---------------------------------------------------------------------- adamshand · 2023-12-16 00:29 UFW is just a front end to iptables. Run `iptables -L -n` it sounds like you still have some rules. ---------------------------------------------------------------------- thekrautboy · 2023-12-16 00:31 Imo its very likely that the cheap VPS provider is blocking port 25 for SMTP on their end, so no matter what OP does on their VPS they cant get around that. ---------------------------------------------------------------------- adamshand · 2023-12-16 00:35 Yes, good point. I'd assumed they were running it at home, but ... duh. ---------------------------------------------------------------------- thekrautboy · 2023-12-16 00:39 I assumed the same based on the phrasing in the actual OP. But then they confirmed in a comment that its a rented VPS, so them blocking port 25/SMTP makes the most sense. If it quaks like a duck...