LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 10-21-2015, 09:00 AM   #1
nix84
Member
 
Registered: Apr 2014
Posts: 276

Rep: Reputation: Disabled
What ports are really open & can I close all but 80 & 443


When I used the firewall configurer (available in F22 Gnome Software) it shows that TCP & UDP are set up to be open for 1025-65535.
As I understand it most of the Firewall ports except 80 & 443 could be blocked as my usage is only for internet and my local wifi (library).
Would this be correct?

I am confused because when I ran nmap -A localhost it showed only port 631 for TCP.

netstat -tulpn showed 323, 5353, and 49575 for UDP in addition to 631 for TCP as being open.

This seems like it is inconsistent even if nmap was showing what it thought was closed. What did I do incorrectly? Hope someone can help out here.
 
Old 10-21-2015, 10:58 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

Firstly regarding the open ports you mention:

- 631 is used by CUPS (printing)
- 5353 is multicast DNS
- I'm not sure what UDP ports 323 and 49575 are used for - which process does netstat say are using them?

Are these services listening on all interfaces (0.0.0.0ort in the "Local Address" column, or only on the loopback interface (127.0.0.1ort)?

Regarding nmap, the "nmap -A localhost" command doesn't scan UDP ports, which explains the difference between it's output and that from netstat. Try "nmap -sU -A localhost" to see open UDP ports.

Regarding nmap/netstat vs the firewall rules, they can easily differ. If a service isn't running at the moment, it won't show in nmap/netstat. That doesn't mean it will be blocked by the firewall, though, so it might inadvertently become accessible if it is started. It's therefore better to block everything except the services you specifically want to be accessible, to future proof the configuration a little.

To see what is actually open from a firewall point of view, it's best to look at the iptables listing. Start with the output from "sudo iptables -t filter -L".

Is the machine in question your workstation, or a server?

I'm afraid I'm not familiar with the specific firewall configuration tool you're using. From a quick online search it seems similar to other tools, though. Most likely what you are looking at is the ports which are open for connections from outside to your computer. Outgoing connections from your computer are usually allowed on all ports. If this is a workstation, you should not need to open these ports to the outside. For ports 80 and 443 for example, you only need them open if you're running a web server on your machine, and want to access it from another machine.

For ports 1025-65535, it looks like these were opened by default in F21 Workstation - see https://lwn.net/Articles/626302/. You should be able to safely close these in most cases.

If this doesn't answer your question, please post the output from the iptables command above, then we can elaborate further.

Regards,

Clifford
 
1 members found this post helpful.
Old 10-21-2015, 11:29 AM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
I'm going to agree with cliffordw on this to a degree. What you see inside the system might not be seen outside the system. Everything you are running is on the system and there are ports that the system needs working in order for the system to function correctly. If you are going to scan the system with nmap then you should be doing this from outside the system to get a true picture of what is seen and what is not.

Unless you are running some sort of service that needs to be accessed form the outside there is no need to open any inbound ports. If you running a workstation then the following rules will lock you down properly:

Code:
iptables -F
iptables -Z
iptbales -X
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -j DROP
iptables -A OUTPUT -m state --state NEW -j ACCEPT
 
1 members found this post helpful.
Old 10-22-2015, 07:39 PM   #4
nix84
Member
 
Registered: Apr 2014
Posts: 276

Original Poster
Rep: Reputation: Disabled
What ports are really open & can I close all but 80 & 443

First of all thanks for the info. Appreciate confirmation re nmap from outside. The readings I had suggested nmapping with a localhost target and since that pointed at 631 I was in doubt.
The "Firewall-config 0.3.13 from Red Hat shows 1025-65535, and on re-read it does say "add ports needing to be accessable". So I am guessing that those ports are all open ports thru the Firewall (BTW it outputs that info (pre me) when I point at ports.

Can either of you suggest why that config program would specify 1025-65535 as open (?my guess) and not specify any of the common ports as being open?
t came that way).

@LazyDog: My understanding is that the firewall is intercalated into the kernel. I guess this is why the config program. After writing my firewall for Slackware 13.37 I don't look forward to punching those commands into the kernel.

Other than this RH config program I have run into some references to "fuzer". Is that possibly a means to put commands into the kernel without having to recompile the kernel?
@Cliffordw: That config software did not specify where it was listening but I think it must be 127.0.0.1 as that is where I pointed it.
Thanks again for the input from both of you
ASAP I will run that sudo IPTables command.
PS
Ran that command and got "anything" "everywhere"for source and destination, respectively, so it looks all open -- will need a refresh course on reading that output, as the output is a bit strange to me.

Last edited by nix84; 10-22-2015 at 08:39 PM.
 
Old 10-22-2015, 08:23 PM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
If you want to see what ports are open/closed/stealhed and get port definitions etc go here:
https://www.grc.com/x/ne.dll?bh0bkyd2
This willmshow you what the outside world sees
 
Old 10-22-2015, 09:45 PM   #6
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
If you're using fedora 22, a default installation will use firewalld not iptables. Look at the man page for firewall-cmd for command line help. With firewalld, you have to make two changes to open/close any ports, once for the runtime, and again for permanent settings. If you change just the runtime setting any changes to the firewall configuration will be lost on reboot/restart of firewalld.
 
1 members found this post helpful.
Old 10-25-2015, 05:17 PM   #7
nix84
Member
 
Registered: Apr 2014
Posts: 276

Original Poster
Rep: Reputation: Disabled
@Doug G: Thanks Whew! saved me some work. I'll follow those points when I switch over to F22. BTW Firewall-config (aka firewalled) has to be loaded from the Software area of the default install.
If permanent settings are made does this not apply to runtime?
Will fiddle with that app a bit but don't recall the two alternatives.
 
Old 10-25-2015, 08:12 PM   #8
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Quote:
If permanent settings are made does this not apply to runtime?
There are some examples in the command line tool man page ( it's firewall-cmd ). I haven't used the gui tool for quite a while, but I seem to recall having to select the runtime page, then the permanent page in order to make a permanent change active.

I think there is a reload from the command line, so you can change the permanent setting then reload the runtime to use the changes, but in any case it seems to be a two step process.
 
Old 10-26-2015, 12:00 PM   #9
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by nix84 View Post
@LazyDog: My understanding is that the firewall is intercalated into the kernel. I guess this is why the config program. After writing my firewall for Slackware 13.37 I don't look forward to punching those commands into the kernel.

Other than this RH config program I have run into some references to "fuzer". Is that possibly a means to put commands into the kernel without having to recompile the kernel?
There is no reason to recompile the kernel. The kernel reads the config file and applies it.

I find it hard to believe that the firewall is already setup to allow 1024-65xxx through already.
 
  


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
How do I open ports 443 and 80 running Novell Data Synchronizer centreback Linux - Newbie 2 10-31-2012 09:01 AM
[SOLVED] Firestarter denying connections on ports 80 & 443 despite settings. edooze Linux - Newbie 1 04-19-2011 02:54 AM
open ports for utorrent using iptables n close smpt to that ports shtorrent00 Linux - Networking 2 09-30-2008 03:34 PM
How to open & close printer PORT 515 kapu Linux - Newbie 2 08-31-2008 06:37 PM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 12:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 06:13 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