-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opensnitch: Add at v1.6.7 #4783
base: main
Are you sure you want to change the base?
Conversation
c78cdb0
to
e231295
Compare
I did a quick ripgrep for /etc/opensnitchd and updated the locations. Hopefully that was all of them. |
Almost there. Just changing the locations isn't enough; we want users to be able to copy the default configs to |
Ah got it. I am not familiar with go but Ill give it a shot |
**Summary** - add python-qt-material a dependecy of opensnitch
Not my best work but I think it's done. /etc/rules is created when running opensnitch since these are user preferences. Not sure if the directory will be created each time though. |
Hm I should have clicked Comment instead of Request Changes. Oops. |
About the /etc/rules. I did not make sense to me that the rules directory should be in /usr/ because these will be created by the user and not Solus itself. |
An issue I just experienced is that the /etc/opensnitchd/rules is not being created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I might see why.
**Summary** - adds opensnitch a firewall inspired by Little Snitch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I had a few (admittedly minor) comments on the systemd and Go patches.
if args.socket == None: | ||
# default | ||
- args.socket = "unix:///tmp/osui.sock" | ||
+ args.socket = "unix:///run/user/1000/opensnitch/osui.sock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (haven't checked) this should use $XDG_RUNTIME_DIR
instead of hardcoding the UID.
- c.file = "/etc/opensnitchd/system-fw.json" | ||
+ _, fileErr := os.Stat("/etc/opensnitchd/system-fw.json") | ||
+ | ||
+ if fileErr == nil { | ||
+ c.file = "/etc/opensnitchd/system-fw.json" | ||
+ } else { | ||
+ c.file = "/usr/share/defaults/etc/opensnitchd/system-fw.json" | ||
+ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably only catch fs.ErrNotExist
to make things like permission issues more obvious. That also allows you to invert the if-statement making the patch cleaner:
- c.file = "/etc/opensnitchd/system-fw.json" | |
+ _, fileErr := os.Stat("/etc/opensnitchd/system-fw.json") | |
+ | |
+ if fileErr == nil { | |
+ c.file = "/etc/opensnitchd/system-fw.json" | |
+ } else { | |
+ c.file = "/usr/share/defaults/etc/opensnitchd/system-fw.json" | |
+ } | |
c.file = "/etc/opensnitchd/system-fw.json" | |
+ | |
+ if _, err := os.Stat(c.file); errors.Is(err, fs.ErrNotExist) { | |
+ c.file = "/usr/share/defaults/etc/opensnitchd/system-fw.json" | |
+ } | |
+ |
+ | ||
+func userConfigExists() (string) { | ||
+ _, err := os.Stat("/etc/opensnitchd/default-config.json") | ||
+ if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same:
+ if err == nil { | |
+ if !errors.Is(fs.ErrNotExist) { |
|
||
+func userConfigExists() (string) { | ||
+ _, err := os.Stat("/etc/opensnitchd/default-config.json") | ||
+ if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ if err == nil { | |
+ if !errors.Is(err, fs.ErrNotExist) { |
logUTC = true | ||
logMicro = false | ||
rulesPath = "/etc/opensnitchd/rules/" | ||
- configFile = "/etc/opensnitchd/default-config.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply change this line to configFile = userConfigExists()
?
+ os.MkdirAll("/etc/opensnitchd/rules", 755) | ||
+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this in favour of the systemd unit.
Summary
Test Plan
Checklist
Resolves #289