Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The best way is to configure a firewall on the server.
If that is not possible, or not an option, then you have to modify (or close) the application that is listening to the port.
Just to be clear - a port is not just "open" by it self, there is always an application that is listening on that specific port.
As soon as that application are closed, then the port is gone, as in "stealth".
Some applications can be configured to listen only on a specific network interface, but if that is not possible then a firewall is the only solution.
Additionally, you should figure out what the services are that are listening. If you do not need them, they should 1) not be running/listening; 2) not even be installed in some cases.
For exemple. I run nmap on my server and I found some open ports. How do I close them?
Thanks
Quote:
Originally Posted by SciFi-Bob
The best way is to configure a firewall on the server.
<snip>
You close a port by turning off services. You can't turn off a service by blocking with a firewall. All you'd be doing is blocking (the service would still be running).
Turn off the service/app first, as that's the proper way to disable such things. You can use a FW as an additional security layer to you doing the correct thing (disabling the service).
Several people have offered that iptables can solve the OP's situation. Again (as I stated in my previous post above), that method will block the communication but NOT actually turn off the service. If someone gains access to the machine, they'd have local access to the running services that they could possibly exploit. That's one reason why it is better to outright turn off the service (vs. using the FW to block the network connections to the service).
But it does. It depends on the service and usage though. Some can be configured to listen to Unix sockets or for instance TCP/IP (say database connections). Then there's interfaces on different networks (say running your MTA for local machine use only).
The OP should be way more specific by now though. Details g_paschoal!
But it does. It depends on the service and usage though. Some can be configured to listen to Unix sockets or for instance TCP/IP (say database connections). Then there's interfaces on different networks (say running your MTA for local machine use only).
The OP should be way more specific by now though. Details g_paschoal!
True, but you wouldn't TOTALLY block the service, like in the case of a DB connection. You'd block it from everywhere BUT certain clients...if you TOTALLY blocked it, there's no point in a network listener. Same with the different interfaces...you'd leave the service open on that ONE address...but still open. But the socket program, good point.
I'm reading it as just use IP tables to totally block the port, not use it as a custom solution, as it can be. But as you say...details!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.