Cannot use SMTP - unable to connect

Discussion in 'HOWTO-Related Questions' started by esseclive, Dec 6, 2007.

  1. esseclive

    esseclive New Member

    Hello,

    I followed the tutorial Virtual Users And Domains With Postfix, Courier And MySQL (Debian Etch).

    Everything seems to work fine, but I cannot connect to the SMTP server outside the server network :
    When I try to
    Code:
    telnet SERVER.IP 25
    from my computer at home, nothing append, and I get a error
    Code:
    unable to connect
    .
    This work from the server itself (telnet localhost 25) or from another server on the same network.

    - iptables are empty
    - Webmail works fine (roundcube and squirrelmail / POP and IMAP)

    Here is my main.cf from Postfix :
    Code:
    
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    # My(...) config
    myhostname = egroups.esseclive.com
    myorigin = /etc/mailname
    mydestination = deb3144.oxyd.net, localhost.oxyd.net, localhost
    mynetworks = 127.0.0.0/8
    
    # Config classique
    #relay_domains = mailman.esseclive.com
    mailbox_size_limit = 0
    recipient_delimiter = +
    owner_request_special = no
    unknown_local_recipient_reject_code = 550
    mailman_destination_recipient_limit = 1
    receive_override_options = no_address_mappings
    maximal_queue_lifetime = 3d
    
    # Alias
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    alias_database = hash:/etc/aliases
    
    # Virtual
    virtual_alias_domains = 
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    transport_maps = mysql:/etc/postfix/mysql-virtual_transports.cf
    
    # SASL
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    
    # TLS
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    
    content_filter = amavis:[127.0.0.1]:10024
    
    # Restrictions contre le spam
    # HELO Restrictions (pour limiter le spam)
    smtpd_helo_required = yes
    #smtpd_helo_restrictions = permit_mynetworks, reject_unauth_pipelining, warn_if_reject, reject_non_fqdn_hostname, reject_unknown_hostname, reject_invalid_hostname, permit
    
    # Sender (spam)
    #smtpd_sender_restrictions = permit_sasl_authenticated permit_mynetworks reject_non_fqdn_sender reject_unknown_sender_domain permit
    
    # Recipients
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    
    relayhost = 
    inet_interfaces = all
    
    
    
    As you can see this is exactly the same as in the tutorial, execpt that I remove the "proxy:" from the mysql lines ...


    Thanks in advance for your answer, I was unable to find any answer so far !
     
  2. volksman

    volksman New Member

    what is the output of:

    netstat -tap

    ???

    Only other thing I can think of is is this machine behind any other kind of firewall? You say iptables is empty so that's a good start but is there a router or firewall in front of this machine that maybe you either need to port map or add a rule for?
     
  3. esseclive

    esseclive New Member

    Hi !

    Thanks for your answer.

    Here is the output of netstat -tap

    Code:
    
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
    tcp        0      0 *:imaps                 *:*                     LISTEN     4793/couriertcpd    
    tcp        0      0 *:pop3s                 *:*                     LISTEN     4826/couriertcpd    
    tcp        0      0 deb3144.oxyd.net:10024  *:*                     LISTEN     5565/amavisd (ch4-a 
    tcp        0      0 deb3144.oxyd.net:10025  *:*                     LISTEN     5105/master         
    tcp        0      0 deb3144.oxyd.net:mysql  *:*                     LISTEN     17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:909    *:*                     LISTEN     2005/famd           
    tcp        0      0 *:pop3                  *:*                     LISTEN     4805/couriertcpd    
    tcp        0      0 *:imap2                 *:*                     LISTEN     4774/couriertcpd    
    tcp        0      0 deb3144.oxyd.net:spamd  *:*                     LISTEN     26830/spamd.pid     
    tcp        0      0 *:sunrpc                *:*                     LISTEN     1440/portmap        
    tcp        0      0 *:www                   *:*                     LISTEN     10165/apache2       
    tcp        0      0 *:webmin                *:*                     LISTEN     16250/perl          
    tcp        0      0 *:ftp                   *:*                     LISTEN     8632/proftpd: (acce 
    tcp        0      0 *:ssh                   *:*                     LISTEN     1945/sshd           
    tcp        0      0 *:smtp                  *:*                     LISTEN     5105/master         
    tcp        0      0 *:https                 *:*                     LISTEN     10165/apache2       
    tcp        0      0 deb3144.oxyd.net:51908  gsmtp93.google.com:smtp TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:51906  gsmtp93.google.com:smtp TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39201  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39203  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39204  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39205  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39217  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39219  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39223  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:53880  deb3144.oxyd.net:mysql  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:53881  deb3144.oxyd.net:mysql  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:53904  deb3144.oxyd.net:mysql  ESTABLISHED5565/amavisd (ch4-a 
    tcp        0      0 deb3144.oxyd.net:53905  deb3144.oxyd.net:mysql  ESTABLISHED5565/amavisd (ch4-a 
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39226  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39227  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39232  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:smtp   deb3144.oxyd.net:39234  TIME_WAIT  -                   
    tcp        0   3058 deb3144.oxyd.net:webmin darkstar.fullsix.c:2127 ESTABLISHED5717/index.cgi      
    tcp        0      0 deb3144.oxyd.net:39666  deb3144.oxyd.net:mysql  ESTABLISHED5687/smtpd          
    tcp        0      0 deb3144.oxyd.net:39667  deb3144.oxyd.net:mysql  ESTABLISHED5687/smtpd          
    tcp        0      0 deb3144.oxyd.net:39658  deb3144.oxyd.net:mysql  ESTABLISHED5688/cleanup        
    tcp        0      0 deb3144.oxyd.net:39659  deb3144.oxyd.net:mysql  ESTABLISHED5688/cleanup        
    tcp        0      0 deb3144.oxyd.net:39652  deb3144.oxyd.net:mysql  ESTABLISHED5682/cleanup        
    tcp        0      0 deb3144.oxyd.net:39653  deb3144.oxyd.net:mysql  ESTABLISHED5682/cleanup        
    tcp        0      0 deb3144.oxyd.net:39640  deb3144.oxyd.net:mysql  ESTABLISHED5681/trivial-rewrit 
    tcp        0      0 deb3144.oxyd.net:39641  deb3144.oxyd.net:mysql  ESTABLISHED5681/trivial-rewrit 
    tcp        0      0 deb3144.oxyd.net:39642  deb3144.oxyd.net:mysql  ESTABLISHED5679/smtpd          
    tcp        0      0 deb3144.oxyd.net:39643  deb3144.oxyd.net:mysql  ESTABLISHED5679/smtpd          
    tcp        0      0 deb3144.oxyd.net:39194  deb3144.oxyd.net:smtp   TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:39200  deb3144.oxyd.net:smtp   TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:53904  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:53905  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:39101  deb3144.oxyd.net:10024  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:39111  deb3144.oxyd.net:10024  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46565  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46574  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46571  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46569  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46582  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46580  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39640  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39641  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46577  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39642  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39643  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46588  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46586  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:10025  deb3144.oxyd.net:46584  TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:www    88.181.116.22:4696      TIME_WAIT  -                   
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39658  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39659  ESTABLISHED17596/mysqld        
    tcp        0      0 deb3144.oxyd.net:mysql  deb3144.oxyd.net:39652  ESTABLISHED17596/mysqld        
    
    
    It seems that I have a ot of MySQL connections (from postfix + amavis) ...

    Apparently, I don't have localhost.localdomain, like in the tutorial

    To be sure that everything is clear, here's the iptable -L output :

    Code:
    > iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
    The server is a dedicated server rented to a hosting provider. I will ask them if they block port 25 from outside their network ...
     
  4. falko

    falko Super Moderator ISPConfig Developer

    If the server is behind a router, the router must forward port 25 to the server.
     
  5. volksman

    volksman New Member

    tcp 0 0 *:smtp *:* LISTEN

    Says that your server is listening properlly. There has to be a firewall or something blocking requests from the outside. Likely your provider needs to open a port for you....
     
  6. esseclive

    esseclive New Member

    Hi everyone,

    I've been investigating a little bit for a few days, and I realized that my server was responding when I use different SMTP test sites on the net (eg : http://www.checkor.com/ whereas http://www.spamhelp.org/shopenrelay/ cannot connect ... weird).

    But I still cannot access it from my personnal computer for example (it still does not connect at all).

    Is there any postfix config variable that would limit access to "undefinied" hosts such as personnal computers ... ?

    Thanks again for your help ...
     
  7. falko

    falko Super Moderator ISPConfig Developer

    Do you use some kind of personal firewall on your desktop computer? Maybe that's the problem...

    Or do you use Denyhosts/fail2ban/Blockhosts on your mail server?
     
  8. esseclive

    esseclive New Member

    Hi

    Finally I got the answer : my ISP (as well as other ones here in France) block port 25 by default, to avoid spam from "zomby machines" ...

    That's why I was not able to simply connect to the server.
    All lot of research and stress for nothing finally.

    A good place to start if anyone got the same problem.

    Anyway, thanks for your help.
     

Share This Page