1

I’m trying to set up an email server. I can’t seem to get port 25 to open for me. I literally just did:

ufw disable

ufw reset

ufw default deny incoming

ufw default allow outgoing

sudo ufw allow 22/tcp

sudo ufw allow 25

sudo ufw enable

And then sudo ufw status verbose…

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere                  
25                         ALLOW IN    Anywhere                  
22/tcp (v6)                ALLOW IN    Anywhere (v6)             
25 (v6)                    ALLOW IN    Anywhere (v6)   

However, one cursory glance of sudo netstat -tulpn | grep LISTEN and..

tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      512/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      664/sshd: /usr/sbin 
tcp6       0      0 :::22                   :::*                    LISTEN      664/sshd: /usr/sbin 

and telnet [my server IP] 25:

telnet: Unable to connect to remote host: Connection refused

What gives? How can I open up my ports?

UPDATE

At the advice of the users here, I decided to install Postfix now and check again if the ports are now being acknowledged..

sudo netstat -tulpn | grep LISTEN
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      512/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      664/sshd: /usr/sbin 
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      43246/master        
tcp6       0      0 :::22                   :::*                    LISTEN      664/sshd: /usr/sbin 
tcp6       0      0 :::25                   :::*                    LISTEN      43246/master     

and

telnet [my server IP] 25
Trying [my server IP]...
Connected to [my server IP]
Escape character is '^]'.
220 ubuntu-s-1vcpu-1gb-lon1-01 ESMTP Postfix (Ubuntu)

It seems it's connected, but does that mean the port is open?

sangstar
  • 43
  • 6
  • @MichaelHampton I'm afraid not. There is no firewall setup on my droplet. Nothing is listening on the port. – sangstar Feb 01 '21 at 14:08
  • Then that does answer the original question. Your edit 3 changed the entire nature of the question though. It's not recommended to edit your post to ask a different question after someone has already answered it. – Michael Hampton Feb 01 '21 at 15:28

1 Answers1

1

It appears as though you don't have an SMTP server listening on port 25. Start your mail daemon, and try again. (Also, SMTP never uses UDP, so you can change those '25' to '25/tcp' and it'll make your firewall more secure.)

sjcaged
  • 126
  • 2
  • But why would it need the mail daemon started? Surely it should just tell me that it's listening on port 25 without there being something sent down it. – sangstar Feb 01 '21 at 14:07
  • 1
    If there's no program listening on a port, there is nothing listening on that port, so it will not tell you that there's anything listening on that port. – sjcaged Feb 02 '21 at 00:39