Results 1 to 5 of 5

Thread: How to Close Email Ports in Ubuntu 16.04?

  1. #1
    Join Date
    Jan 2020
    Beans
    11
    Distro
    Ubuntu 18.04 Bionic Beaver

    How to Close Email Ports in Ubuntu 16.04?

    Hi All,

    For security purpose i want to close he Email Ports in my webserver ubuntu 16.04. Please send me the commands for close the email ports.

    Thank You!

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    14,739
    Distro
    Kubuntu 19.10 Eoan Ermine

    Re: How to Close Email Ports in Ubuntu 16.04?

    Unless you installed SMTP or IMAP software like Postfix or dovecot, there should be nothing listening on those ports, so there's no reason to close them specifically. Ubuntu ships with nothing listening on any port.

    You can add iptables rules to block those ports, but they are extraneous:
    Code:
    sudo iptables -I INPUT -p tcp --dport 25  -j REJECT   # smtp
    sudo iptables -I INPUT -p tcp --dport 465 -j REJECT   # ssmtp
    sudo iptables -I INPUT -p tcp --dport 143 -j REJECT   # imap
    sudo iptables -I INPUT -p tcp --dport 993 -j REJECT   # imaps
    sudo iptables -I INPUT -p tcp --dport 110 -j REJECT   # pop3
    sudo iptables -I INPUT -p tcp --dport 995 -j REJECT   # pop3s
    Last edited by SeijiSensei; 4 Weeks Ago at 08:59 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Jan 2020
    Beans
    11
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How to Close Email Ports in Ubuntu 16.04?

    Quote Originally Posted by SeijiSensei View Post
    Unless you installed SMTP or IMAP software like Postfix or dovecot, there should be nothing listening on those ports, so there's no reason to close them specifically. Ubuntu ships with nothing listening on any port.

    You can add iptables rules to block those ports, but they are extraneous:
    Code:
    sudo iptables -I INPUT -p tcp --dport 25  -j REJECT   # smtp
    sudo iptables -I INPUT -p tcp --dport 465 -j REJECT   # ssmtp
    sudo iptables -I INPUT -p tcp --dport 143 -j REJECT   # imap
    sudo iptables -I INPUT -p tcp --dport 993 -j REJECT   # imaps
    sudo iptables -I INPUT -p tcp --dport 110 -j REJECT   # pop3
    sudo iptables -I INPUT -p tcp --dport 995 -j REJECT   # pop3s
    Thank You SeijiSensei. I will try it.

  4. #4
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,815
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to Close Email Ports in Ubuntu 16.04?

    The iptables method will definitely work unless you want to run the commands within ufw. Just depends on your preference.

  5. #5
    Join Date
    Jan 2020
    Beans
    11
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How to Close Email Ports in Ubuntu 16.04?

    Quote Originally Posted by kevdog View Post
    The iptables method will definitely work unless you want to run the commands within ufw. Just depends on your preference.
    Yes, its working fine. All email functions got stop now. Thanks a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •