gustavo-iniguez-goya / opensnitch

OpenSnitch is a GNU/Linux application firewall
GNU General Public License v3.0
394 stars 20 forks source link

Command line regexp error for WINE apps #33

Open metal450 opened 4 years ago

metal450 commented 4 years ago

When a WINE app tries to call out to the internet, the notification will come from process "wine-preloader," with a command matching the Windows path of the application (i.e. "C:\Program Files\Microsoft Office\Office16\ONENOTE.EXE"). So to create rules for that specific WINE app, one would just use "from this command line." Selecting that & adding the rule works great.

However, if you then try to edit the rule (i.e. just to rename it - since you can't rename directly from the notification dialog ;) ), it prevents you from applying any edits, saying "Command line regexp error." I guess it's recognizing "C:\Program Files\Microsoft Office\Office16\ONENOTE.EXE" as a regexp, failing to validate it, & therefore rejecting any other edits - even if you just open that dialog & only change the rule name.

gustavo-iniguez-goya commented 4 years ago

I see, the thing is that I didn't want to put a check in every field to indicate that it was a regex rule, but I suspected that we could run into this kind of problems.

And I still don't want to add it, because it overcomplicates the GUI and is hard to maintain, so the solution for now is to convert it to a regex:

C:\Program Files\Microsoft Office\Office16\ONENOTE.EXE

I've been thinking lately in adding a info icon next to the fields, explaining what the field is and examples of regex and data you can type on it. A link to the documentation would be also useful.

metal450 commented 4 years ago

Well, it was auto-added by just checking "from this command line" in the notification - I didn't manually type the path. So either way, it should be able to accept the value it auto-generates.

gustavo-iniguez-goya commented 4 years ago

mmm, if it was autogenerated the type of rule is "simple", so the daemon will just test if a string is equal (byte per byte) to another. The problem is when editing the rule, that it interprets that is a regex.

I think I've got an idea to workaround this situation.

metal450 commented 4 years ago

In the interim, since I can't rename these rules from the editor, is there an easy way to make it reload them all from disk? Then I can just browse to & rename the filename to rename those rules :)

Edit: neverind, looks like just closing & reopening is enough. I thought it wasn't working, but I was just renaming the files, didn't realize I had to also edit the json. Renaming and modifying the json lets me change the names of these entries :)

gustavo-iniguez-goya commented 4 years ago

uh, can't it be edited from the GUI? what's the name of the rule? is there any error in the logs?

metal450 commented 4 years ago

Referring back to my 1st comment: "if you then try to edit the rule (i.e. just to rename it - since you can't rename directly from the notification dialog ;) ), it prevents you from applying any edits, saying "Command line regexp error.".

I guess it could from the UI - I figured it might be quicker to just edit the file though, when the command-line has a super long path or ton of special characters, each of which needs to be manually escaped to convert it to a regexp before the UI will let you edit the name. And that can be easy to make a mistake, so I was just editing the file directly to more easily change the name.

gustavo-iniguez-goya commented 4 years ago

ah ok, you're right. I thought it was a different problem.