2

I installed Fedora 25 (Workstation) on one of my computers recently. This is my first experience with a RH-style distro -- I've previously only used Debian-based systems, and on those systems I used ufw to configure my firewall. I am at a complete loss to explain why I can't get firewalld to work.

I am trying to only allow access to the following ports for incoming connection: 22/tcp (SSH), 3306/tcp (mysql)

I set the default zone as public and manually set my network interface to the public zone. I added SSH and mysql services to the public zone, which should have effected the changes in the runtime firewall, but no luck. My computer is refusing all attempts to make an SSH connection. nmap of my ip shows the following:

Nmap scan report for 192.168.1.241
Host is up (0.000014s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
111/tcp  open  rpcbind
3306/tcp open  mysql

I tried making the changes to the runtime firewall and I've tried making the settings permanent. Neither one has yielded any change in the open ports. No matter what I do (including REMOVING mysql as an allowed service), nothing changes the output of an nmap scan. From what I understand, firewalld is simply a wrapper for iptables similar to ufw, however I've never run into an issue configuring a firewall with ufw. This has me at a loss. I appreciate any help you can offer. Thanks.

These are the settings in effect:

$ firewall-cmd --get-default-zone
public



$ firewall-cmd --get-zone-of-interface=enp0s25
public


$ cat /etc/firewalld/zones/public.xml 
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="mysql" />
</zone>


$ cat /usr/lib/firewalld/services/ssh.xml 
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>SSH</short>
  <description>Secure Shell (SSH) is a protocol for logging into and executing commands on remote machines. It provides secure encrypted communications. If you plan on accessing your machine remotely via SSH over a firewalled interface, enable this option. You need the openssh-server package installed for this option to be useful.</description>
  <port protocol="tcp" port="22"/>
</service>


$ cat /usr/lib/firewalld/services/mysql.xml 
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>MySQL</short>
  <description>MySQL Database Server</description>
  <port protocol="tcp" port="3306"/>
</service>


$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s25 
HWADDR=<removed>
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
DNS1=8.8.8.8
DNS2=8.8.4.4
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s25
UUID=<removed>
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
ZONE=public
IPADDR=192.168.1.241
PREFIX=24
GATEWAY=192.168.1.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


$ iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N FORWARD_IN_ZONES
-N FORWARD_IN_ZONES_SOURCE
-N FORWARD_OUT_ZONES
-N FORWARD_OUT_ZONES_SOURCE
-N FORWARD_direct
-N FWDI_public
-N FWDI_public_allow
-N FWDI_public_deny
-N FWDI_public_log
-N FWDO_public
-N FWDO_public_allow
-N FWDO_public_deny
-N FWDO_public_log
-N INPUT_ZONES
-N INPUT_ZONES_SOURCE
-N INPUT_direct
-N IN_public
-N IN_public_allow
-N IN_public_deny
-N IN_public_log
-N OUTPUT_direct
-A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j INPUT_direct
-A INPUT -j INPUT_ZONES_SOURCE
-A INPUT -j INPUT_ZONES
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -d 192.168.122.0/24 -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT
-A FORWARD -i virbr0 -o virbr0 -j ACCEPT
-A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i lo -j ACCEPT
-A FORWARD -j FORWARD_direct
-A FORWARD -j FORWARD_IN_ZONES_SOURCE
-A FORWARD -j FORWARD_IN_ZONES
-A FORWARD -j FORWARD_OUT_ZONES_SOURCE
-A FORWARD -j FORWARD_OUT_ZONES
-A FORWARD -m conntrack --ctstate INVALID -j DROP
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -o virbr0 -p udp -m udp --dport 68 -j ACCEPT
-A OUTPUT -j OUTPUT_direct
-A FORWARD_IN_ZONES -i enp0s25 -g FWDI_public
-A FORWARD_IN_ZONES -g FWDI_public
-A FORWARD_OUT_ZONES -o enp0s25 -g FWDO_public
-A FORWARD_OUT_ZONES -g FWDO_public
-A FWDI_public -j FWDI_public_log
-A FWDI_public -j FWDI_public_deny
-A FWDI_public -j FWDI_public_allow
-A FWDI_public -p icmp -j ACCEPT
-A FWDO_public -j FWDO_public_log
-A FWDO_public -j FWDO_public_deny
-A FWDO_public -j FWDO_public_allow
-A INPUT_ZONES -i enp0s25 -g IN_public
-A INPUT_ZONES -g IN_public
-A IN_public -j IN_public_log
-A IN_public -j IN_public_deny
-A IN_public -j IN_public_allow
-A IN_public -p icmp -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 3306 -m conntrack --ctstate NEW -j ACCEPT

closed as off-topic by Jeff Schaller, thrig, mdpc, countermode, GAD3R Mar 2 '17 at 10:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, thrig, mdpc, countermode, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I didn't explicitly state this in the question, but for clarification, after I made the permanent settings I did reload the firewall with no effect. – Coop Jan 18 '17 at 22:44
2

Problem was solved. I completely overlooked the fact that Fedora Workstation does not come preloaded with OpenSSH. Since there was no sshd running, the nmap scan didn't show the open port, irrespective of the firewall configuration.

  • Perhaps you could accept your own answer so this question can be identified as solved – roaima Mar 1 '17 at 19:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.