Can I make "From this exectuable" optional? #1647
|
I use yt-dlp and sometimes it runs python from the command line and sometimes it runs it "from this executable" and removes I tried to make "run from this executable" optional by making it a non-capturing group in regex: (the executable requires the exact python version here, ie currently python3.14 so I opted to use .* so it won't break when python version changes) And the command line like this: (python on command line is ran via "python" not the exact version) I run the command line like this: (I actually have an alias, but this is what is being ran in the terminal) OR The quotes around I know using non-capturing groups with regex works with the command line because the optional "--cookies-from-browser" works, but it seems to not work with the executable, or is it the anchoring and ending (^ & $)? I tried removing them but it didn't work without them either. Thank you in advance! |
Replies: 2 comments 1 reply
|
I guess the answer is no then and I need two rules, this changes randomly and I have no idea why, I updated yt-dlp yesterday so it must come from there, not opensnitch. The same thing happens with deluge so I need two rules there too. But you are wrong about non-capturing groups (the way it is written in OP) not working with opensnitch, because I CAN use it with or without the Good catch about -p & -P, I also just noticed this about an hour ago but forgot to edit my post here. Thank you for the clarification about the quotes, I figured it had something to do with the shell. 😸 |
|
You're right, and I need to correct my earlier answer: OpenSnitch's Go toolchain does support non-capturing groups such as Your last idea is also the one-rule solution: uncheck “From this executable”, keep “From this command line” checked, and make the Python launcher/path prefix optional. For the forms described here, this is a compact version: ^(?:(?:/usr/bin/)?python[0-9.]* +)?(?:/usr/bin/)?yt-dlp +--no-windows-filenames +--embed-chapters(?: +--cookies-from-browser +firefox)? +-P +/path/to/download +-o +%\(title\)s\.%\(ext\)s +.+$That accepts all of these command prefixes: so you do not need two rules if a command-only allow rule has the security scope you want. The lowercase If you want to keep an executable restriction as well, one path regexp can enumerate the actual paths shown in Events, but that independently accepts every allowed path with every allowed command shape. If you need the two path/command pairs to remain strictly correlated, use two rules; OpenSnitch combines fields within one rule with AND, not an OR of pairs. Thanks for challenging the non-capturing-group point—the correction matters here. |
You're right, and I need to correct my earlier answer: OpenSnitch's Go toolchain does support non-capturing groups such as
(?:...). My claim that the daemon rejects them was wrong—sorry about that. Your working rule is consistent with both OpenSnitch v1.8.0 and Go 1.23/1.24.Your last idea is also the one-rule solution: uncheck “From this executable”, keep “From this command line” checked, and make the Python launcher/path prefix optional. For the forms described here, this is a compact version:
That…