Open Bogdan107 opened 3 years ago
What's missing is skuid
and skgid
matching. Then you could use rich rules.
e.g.
# firewalld -cmd --add-rich-rule='port port=1234 protocol=tcp socket uid=1000 accept'
Firewalld currently lacks the socked uid=1000
support. We should also be able to support actual user names, e.g. socket uid=root
.
I also need skuid and skgid matching on puppet-managed RHEL with firewalld+nftables. Is there any known workarounds for this use case?
I also need skuid and skgid matching on puppet-managed RHEL with firewalld+nftables. Is there any known workarounds for this use case?
No. If you want to DROP traffic based on skuid/skgid, then you can use a direct rule. But ACCEPT won't work as the packet still needs to pass through nftables.
Thank you for advice @erig0 . This solved my current problem:
firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -d xxx.xxx.xxx.xxx/32 -p tcp -m tcp --dport 443 -m owner ! --uid only_allowed_user -j REJECT --reject-with icmp-port-unreachable
+1 for skuid/skgid matching support!
PSA: upstream nftables has proposed patches for INPUT and OUTPUT socket matching. Currently skuid/skgid matching is limited to OUTPUT only.
INPUT support means we could say things like "only apache can accept https connections".
PSA: upstream nftables has proposed patches for INPUT and OUTPUT socket matching. Currently skuid/skgid matching is limited to OUTPUT only.
INPUT support means we could say things like "only apache can accept https connections".
Yes! I want a quick and easy mechanism to limit just OUTPUT traffic! This is an extremely high priority function for me!
With this function, I can allow only WHITELISTED programs. So, any user installed programs, which needs to use internet, must be configured to use system proxy server (in my case - this is Privoxy) or configured personally by firewalld administrator. So, any unconfigured program can-not access internet or can use internel only in very limited mode.
Add new tab "Limit OUTPUT" into Settings/Zones/\
If user select checkbox "Deny OUTPUT connections from all unselected users/groups", then spinbox with "Limit rate" must be disabled. If user select checkbox "Use global configuration", then config for limit output conenctions per zone must be as in global config for "Limit OUTPUT" (e.g. config for zone must use "jump" to global chain, which configured for control output connections).
Changes by my proposal - is trivial or usual, but not "feat".
The more I think about socket matching, the more I like the idea of implementing them as a zone source, e.g. --zone apache --add-source gid:apache
. Then you can use the zone and policy filtering features.
# firewall-cmd --zone apache --add-service https
This also means different processes groups (e.g. users, cgroups) can be represented by zones.
I might be really mistaken (as I am not yet firewalld user), but that example firewall-cmd --zone apache --add-service https
would not work because skuid
/skgid
only works for OUTPUT
, meanwhile zones in firewalld is about INPUT
?
For policies though I do get it, as policies implement OUTPUT / FORWARD filtering, right?
I might be really mistaken (as I am not yet firewalld user), but that example
firewall-cmd --zone apache --add-service https
would not work becauseskuid
/skgid
only works forOUTPUT
, meanwhile zones in firewalld is aboutINPUT
?
IIRC, there were recent nftables patches to allow INPUT socket matching. i.e. meta skuid
, meta skgid
, and meta cgroup
should work on both INPUT/OUTPUT on modern kernel/nftables.
I have not verified this though.
Adding "blocked" because this requires support in nftables.
I am using a firewall on my laptop and I have no relationship to networking.
Production routers:
Personal laptop:
Long time I using self-writted script for control nftables daemon. Now I am learning firewald and have some troubles due to the fact that firewalld does not have some feature, because focused to serving forwarded network packets as many others firewall's...
I usу DENY policy by default, and allow network usage only for controlled list of system users. Users with uid>=1000 can connect to internet only over local proxy (like squid or privoxy), and each user program (web-browser, torrent, media-player) for network activity outside the laptop must have their own login/password for proxy authentification.
Some lines from my script:
I need command line options for: