LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-01-2021, 01:24 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
How to ensure a given port is open


I have a 1&1 virtual Centos7 server. 1&1 has a firewall that sits above my virtual machine and I need to open ports on it as well as the local firewalld. The ports are open on both firewalls but some of them (993, 1338, 5432, 7869) show as being closed when I telenet from my PC or use https://www.yougetsignal.com/tools/open-ports/. To rule out an issue on my end, I have stopped the firewalld service, but no change. I contacted 1&1 and they said it was not on their end. I asked if was possible to disable their server and politely got a no. I would like to completely rule out an issue on my end.

Do I need to do more that just stop the firewalld service? 1&1 suggested I reboot the server and even though I knew it wouldn't work tried it and sure enough no difference. Is it possible there is another firewall running, and if so how could it be identified? I looked at /var/log/firewalld which showed nothing (which prompted this post). Some of the ports show as having some service running on them (lsof -i:5432 shows postgres) but others do not. Is there a different way to check if a port is open if a service is running on it?

Is there anything else I should do before going back to 1&1. Thanks
 
Old 07-01-2021, 01:42 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,982

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
port is open only if there is an application running (which is listening on that port).
First you need to check if those apps are really running (and if you really need them). Where are these port numbers coming from?
Next you need to check if those apps were configured properly and accept connection. And now, if that was ok you can check your firewall.
 
1 members found this post helpful.
Old 07-02-2021, 08:49 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Thank you pan64,

Quote:
Originally Posted by pan64 View Post
Where are these port numbers coming from?
A PHP debugger service listens to 7869. When a PHP IDE application is opened on other machines, it uses SSH to start the service. I don't even think 7869 needs to be open for the PHP debugger/IDE to work but after recently upgrading it, things stopped working and am just ruling things out.

Quote:
Originally Posted by pan64 View Post
port is open only if there is an application running (which is listening on that port).
Sounds a little like if a tree falls in a forest and no one hears it, does it make a sound?

lsof -i:7869 tells me that a service is listening to the port but telenet/etc doesn't confirm that the port is open. As another test, made sure the IDE app was closed, killed the service, ran another service on the port (httpd), and now shows as open. Missing solved and I know for sure!

Doesn't really matter but still curious why I couldn't detect the port being open when the debugger was running on it. Think it might have something to do with ssh tunnels and the like but don't really know.
 
Old 07-07-2021, 10:59 AM   #4
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
I use online tools like testers for udp or tcp.

For instance, you can use a online web tester and do http://YOURIP:1234 to test connect to port 1234.
You can use also use portquiz.net for tcp.

check-host.net lets you test generic inbound connections.

Of course it won't work but you can trace the packet from the internet down to your server using tcpdump.
 
Old 07-07-2021, 03:23 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,737

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
I tend to use netstat or ss to see what is listening and where:
Code:
netstat -tnlp
If the listening daemon doesn’t respond to a telnet connection, telnet will report the port closed/unable to connect. That doesn’t mean the port is not open.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i tried using this code for deleting a user given character from a user given string mecrazyme1234 Linux - Newbie 2 06-04-2011 04:59 PM
i tried using this code for deleting a user given character from a user given string mecrazyme1234 Programming 7 06-04-2011 11:47 AM
merge files, given its odd and even given timepassman Linux - Software 1 05-08-2008 01:17 AM
how to ensure only one record exist with the same name. meluser Programming 5 03-18-2003 02:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration