3 Replies Latest reply: Apr 25, 2014 7:43 PM by Catch-22 RSS

    SMTP Server Non-standard Port Detection

    Ramaraju

      Hi all,

      What is SMTP Server Non-standard Port Detection in Linux?

      How to verify the SMTP port configuration settings.?

       

      Thanks,

      Ramaraju.

        • 2. Re: SMTP Server Non-standard Port Detection
          Ramaraju

          Hi,

          How to verify the SMTP port configuration settings and which port configuration is secure ? and how to change port values?

           

          Thanks,

          Ramaraju

          • 3. Re: SMTP Server Non-standard Port Detection
            Catch-22

            To check the system what service you have listening on which port:

             

            # lsof -i TCP

            COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

            master  1547 root   12u  IPv4  11631      0t0  TCP localhost:smtp (LISTEN)

            master  1547 root   13u  IPv6  11639      0t0  TCP localhost:smtp (LISTEN)

            etc.

             

            Then grep the port number in /etc/services

             

            # grep smtp /etc/services

            smtp            25/tcp          mail

            smtp            25/udp          mail

             

            Alternatively you an also use the following command: lsof -i TCP:25

             

            Most default configurations for sendmail in Oracle Linux 5 or postfix in Oracle Linux 6 use the alias name smtp defined in /etc/services file. To change the the port you can simply change the port number assigned in the services file and restart the mail server.

             

            For instance, edit /etc/services and make the following change:

             

            smtp            26/tcp          mail

            smtp            26/udp          mail

             

            If you have SELinux set to enforce (default) you will either have to set it to permissive, disable it or add the new port as following:

             

            # yum -y install policycoreutils-python

             

            # semanage port -a -t smtp_port_t -p tcp 26

            (can take a minute)

            # semanage port -l | grep -w smtp_port_t

            smtp_port_t                    tcp      26, 25, 465, 587

             

            Then simply restart sendmail under Oracle Linux 5 or postfix under Oracle Linux 6

             

            # service postfix restart

             

            # lsof -i TCP:26

            COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

            master  7835 root   12u  IPv4  24163      0t0  TCP localhost:smtp (LISTEN)

            master  7835 root   13u  IPv6  24165      0t0  TCP localhost:smtp (LISTEN)

             

            To finally verify:

             

            # yum -y install telnet

            # telnet localhost 26

            Trying ::1...

            Connected to localhost.

            Escape character is '^]'.

            220 vm213.example.com ESMTP Postfix

            helo you

            250 vm213.example.com

             

             

            Note: When using any different port than 25 you will not be able to communicate with other smtp gateways. You may also have to change your Firewall settings. Changing the default smtp port from 25 to something else will only give you limited security because enough software an online services exist that can scan your system for open ports available.

             

            But I hope that answers your question.