opensnitch icon indicating copy to clipboard operation
opensnitch copied to clipboard

[Feature Request] Apply rule if pattern does not match

Open nihil-admirari opened this issue 4 years ago • 2 comments

I want to create a rule to block all but localhost connections. Rules editor tells me to use negated character classes:

[x] Action: deny
[x] To this destination IP: [^:127.0.0.1:]

AFAIK, there are no custom character classes in regex, and the above pattern is equivalent to [^0127.:], i.e. it's gonna match 172.21.0.17 and similar addresses besides 127.0.0.1.

Since negative lookarounds are not supported, can you please add an ability to invert a match (like grep -v)?

nihil-admirari avatar May 19 '21 14:05 nihil-admirari

Maybe you could do it with two rules : The first with a name like 000-allow-application_name wich allow connections to ^(127.0.0.1)$ and check the case Priority rule in the rules editor. The second with a name like 111-deny-application_name wich deny all connections and check the case Priority rule in the rules editor.

NRGLine4Sec avatar May 19 '21 19:05 NRGLine4Sec

Making an allow priority rule does work in this case.

Nonetheless, I'm leaving this feature request open, since an ability to invert a match is nice to have.

nihil-admirari avatar May 21 '21 09:05 nihil-admirari