LinuxQuestions.org
Help answer threads with 0 replies.
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 02-17-2023, 04:59 PM   #1
jason.brooks
LQ Newbie
 
Registered: Feb 2023
Posts: 1

Rep: Reputation: 0
centos 7 firewalld not selectively allowing traffic into ssh


Hello,

This is a centos 7 system sitting out in front of a firewall for...reasons.

it has one ethernet port and one ip address, non rfc1918. i am making changes on the commandline console.

First, my ultimate goal is the following connection policy:
zone=drop
allow inbound traffic to ssh port ONLY from a known set of ip addresses.
allow all traffic to a set of udp/tcp ports.

So if I use "zone=drop" only, I am not allowed to connect via the network in any way.
firewall-cmd --zone=drop
-- this is good

if i add the ssh service to zone=drop, i am able to login. From anywhere.
firewall-cmd --permanent --zone=drop --add-service=ssh
firewall-cmd --complete-reload
-- this matches expected behaviour

BUT: if I try to add the following, I am still able to ssh in from anywhere.
firewall-cmd --permanent --zone=drop --add-source=<my company address>
firewall-cmd --complete-reload

The output of firewall-cmd --list-all shows:

drop (active)
target: DROP
icmp-block-inversion: no
interfaces: ens192
sources: <my company address>
services: ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports;
icmp-blocks:
rich rules:


I was under the impression that the "--add-source" stanza implied connections to services on this zone were going to be allowed and all others blocked.

am I wrong?

I have even tried using a rich rule: "rule family=ipv4 service name=ssh source <company ip> accept"
but this still allows anyone to ssh into this system.

I am probably going to try a --direct rule injection into iptables.

Thank you for your time

--jason
 
  


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
Fedora 36: firewalld not allowing UDP over wifi hotspot (mosh on 60003) byron.hawkins Linux - Networking 1 01-16-2023 04:17 PM
Firewalld Zones Internal Rules Allowing Traffic Through metallica1973 Linux - Security 1 03-08-2021 06:59 PM
Firewalld allowing traffic between main interface and OpenVPN tun0 williamk7 CentOS 7 07-09-2020 03:36 PM
firewalld and pptp - How to allow tcp traffic? (icmp traffic works) Mark L. Wise Linux - Networking 1 06-21-2017 01:50 PM
iptables selectively allowing ports through mrsteveman1 Linux - Networking 1 06-21-2006 09:50 AM

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

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