Can't connect to a postfix server though port 25 is open

9,036

Your postfix server is configured to be reachable on the loopback interface only, as witnessed by the postconf output line:

inet_interfaces = localhost

If you want it to be reachable from other hosts you need to change that configuration by entering:

sudo postconf -e "inet_interfaces = all"
Share:
9,036
prognoza
Author by

prognoza

Updated on September 18, 2022

Comments

  • prognoza
    prognoza almost 2 years

    I'm trying to connect via outlook to a postfix server (send example message via smtp). On the server it seems the port is open:

     nmap -sT -O localhost
    
    Starting Nmap 6.40 ( http://nmap.org ) at 2016-09-24 15:23 EDT
    Nmap scan report for localhost (127.0.0.1)
    Host is up (0.000046s latency).
    Other addresses for localhost (not scanned): 127.0.0.1
    rDNS record for 127.0.0.1: localhost.localdomain
    Not shown: 990 closed ports
    PORT      STATE SERVICE
    21/tcp    open  ftp
    22/tcp    open  ssh
    25/tcp    open  smtp
    80/tcp    open  http
    110/tcp   open  pop3
    143/tcp   open  imap
    993/tcp   open  imaps
    995/tcp   open  pop3s
    3306/tcp  open  mysql
    10000/tcp open  snet-sensor-mgmt
    No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
    
    
    Network Distance: 0 hops
    
    OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
    Nmap done: 1 IP address (1 host up) scanned in 12.06 seconds
    

    but when I try to connect to the server via Outlook it seems it doesn't respond at all. Here is a telnet check I've made(hostname9727.com is defined in my host file):

    C:\Users\A>telnet hostname9727.com 25
    Connecting To hostname9727.com...Could not open connection to the host, on port 25: Connect failed
    

    While with other ports like 110:

    +OK Dovecot ready.
    

    A connection is created

    postconf -n

    postconf -n

    alias_database = hash:/etc/aliases home_mailbox = /home/virtual/mail/
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
    home_mailbox = /home/virtual/mail/
    html_directory = no
    inet_interfaces = localhost
    inet_protocols = all
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    mydomain = hostname9727.com
    mynetworks = 127.0.0.0/8, 10.0.0.0/24
    myorigin = $myhostname
    newaliases_path = /usr/bin/newaliases.postfix
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
    sample_directory = /usr/share/doc/postfix-2.10.1/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_banner = $myhostname ESMTP
    unknown_local_recipient_reject_code = 550
    

    postconf -M

    smtp       inet  n       -       n       -       -       smtpd
    pickup     unix  n       -       n       60      1       pickup
    cleanup    unix  n       -       n       -       0       cleanup
    qmgr       unix  n       -       n       300     1       qmgr
    tlsmgr     unix  -       -       n       1000?   1       tlsmgr
    rewrite    unix  -       -       n       -       -       trivial-rewrite
    bounce     unix  -       -       n       -       0       bounce
    defer      unix  -       -       n       -       0       bounce
    trace      unix  -       -       n       -       0       bounce
    verify     unix  -       -       n       -       1       verify
    flush      unix  n       -       n       1000?   0       flush
    proxymap   unix  -       -       n       -       -       proxymap
    proxywrite unix  -       -       n       -       1       proxymap
    smtp       unix  -       -       n       -       -       smtp
    relay      unix  -       -       n       -       -       smtp
    showq      unix  n       -       n       -       -       showq
    error      unix  -       -       n       -       -       error
    retry      unix  -       -       n       -       -       error
    discard    unix  -       -       n       -       -       discard
    local      unix  -       n       n       -       -       local
    virtual    unix  -       n       n       -       -       virtual
    lmtp       unix  -       -       n       -       -       lmtp
    anvil      unix  -       -       n       -       1       anvil
    scache     unix  -       -       n       -       1       scache
    
  • prognoza
    prognoza almost 8 years
    I did those changes, yet, I'm not table to connect to the relevant port. nmap -sT -O hostname9727.com Starting Nmap 6.40 ( nmap.org ) at 2016-09-25 23:39 EDT Nmap scan report for hostname9727.com (31.220.108.9) Host is up (0.000059s latency). Not shown: 990 closed ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http 110/tcp open pop3 143/tcp open imap 993/tcp open imaps 995/tcp open pop3s 3306/tcp open mysql 10000/tcp open snet-sensor-mgmt 33354/tcp open unknown Thanks!
  • Tilman Schmidt
    Tilman Schmidt over 7 years
    nmap isn't the optimal tool for diagnosing this. First check your config again to see whether it now says inet_interfaces = all. Also make sure to restart the postfix service after changing the config. Then check which address the postfix master process actually listens on with netstat -antp, and check whether you can connect to port 25 on the external address from the server itself with telnet 31.220.108.9 25.