Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

opensnitch: Add at v1.6.7 #4783

wants to merge 4 commits into from

Conversation

uni-dos
Copy link
Contributor

@uni-dos uni-dos commented Jan 10, 2025

Summary

  • adds the package.yml to include opensnitch.

Test Plan

  • Once installed, open the gui and see outgoing traffic.
  • There is a conflict with wireguard and opensnitch. Need ebf module.

Checklist

  • Package was built and tested against unstable
  • This change could gainfully be listed in the weekly sync notes once merged

Resolves #289

@uni-dos uni-dos force-pushed the opensnitch branch 9 times, most recently from c78cdb0 to e231295 Compare January 13, 2025 21:36
@uni-dos uni-dos marked this pull request as ready for review January 13, 2025 21:37
@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 15, 2025

I did a quick ripgrep for /etc/opensnitchd and updated the locations. Hopefully that was all of them.

@EbonJaeger
Copy link
Member

Almost there. Just changing the locations isn't enough; we want users to be able to copy the default configs to /etc, modify them, and have them be loaded. So, we need to check if a file exists in the /etc tree, and use that if there is, otherwise use the /usr/share/defaults/etc path. Does that make sense?

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 15, 2025

Ah got it. I am not familiar with go but Ill give it a shot

**Summary**
- add python-qt-material a dependecy of opensnitch
@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 15, 2025

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.

@uni-dos uni-dos requested a review from EbonJaeger January 15, 2025 16:09
@EbonJaeger EbonJaeger added the Topic: Sync Notes This PR/Issue can be highlighted in sync notes label Jan 17, 2025
@EbonJaeger
Copy link
Member

Hm I should have clicked Comment instead of Request Changes. Oops.

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 22, 2025

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.

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 22, 2025

An issue I just experienced is that the /etc/opensnitchd/rules is not being created

Copy link
Member

@EbonJaeger EbonJaeger left a 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.

packages/o/opensnitch/files/update-config.patch Outdated Show resolved Hide resolved
Copy link
Member

@silkeh silkeh left a 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.

packages/o/opensnitch/files/correct-systemd-service.patch Outdated Show resolved Hide resolved
if args.socket == None:
# default
- args.socket = "unix:///tmp/osui.sock"
+ args.socket = "unix:///run/user/1000/opensnitch/osui.sock"
Copy link
Member

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.

Copy link
Member

@silkeh silkeh Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not resolved correctly with the updated version (using os.environ.get would be required), but (after playing with the PR result) I think it shouldn't be user-bound at all as this socket is something that the daemon (running as root) and the user use to communicate.

Instead, I think this should be the following:

args.socket = "unix:///run/opensnitch/osui.sock"

However, there are some other components needed to make this work:

  • A systemd sysusers.d definition to create an opensnitch group (if you don't want to use an existing group like adm).
  • A systemd tmpfiles.d definition to create /run/opensnitch with mode 0775 and group opensnitch (or an existing group).

The libvirt package has both of these if you are looking for an example.

Lastly, users would need to add themselves to the group to use opensnitch (eg: sudo usermod -a -G opensnitch $USER).

packages/o/opensnitch/files/update-config.patch Outdated Show resolved Hide resolved
packages/o/opensnitch/files/update-config.patch Outdated Show resolved Hide resolved
packages/o/opensnitch/files/update-config.patch Outdated Show resolved Hide resolved
packages/o/opensnitch/files/update-config.patch Outdated Show resolved Hide resolved
**Summary**
- adds opensnitch a firewall inspired by Little Snitch
@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 30, 2025

Hm, opensnitch isn' giving me a pop up to allow ssh. Let me test a bit further.

@silkeh
Copy link
Member

silkeh commented Jan 30, 2025

Hm, opensnitch isn' giving me a pop up to allow ssh. Let me test a bit further.

Yeah, I think my XDG_RUNTIME_DIR suggestion wasn't correct. See the other thread for a suggestion on how to improve this.

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 31, 2025

So I added the changes and now the socket is not being created. I also am getting a weird issue where the ui is parsing the config file incorrectly. It is interpreting the quotes from default-config.json

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 31, 2025

I also am getting a weird issue where the ui is parsing the config file incorrectly. It is interpreting the quotes from default-config.json

I see an extra quote but it is not creating the socket.

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 31, 2025

Maybe the issue is create_socket_dirs?

@uni-dos
Copy link
Contributor Author

uni-dos commented Jan 31, 2025

I was able to get opensnitch to connect to the /run/opensnitch socket but I was not able to get a prompt for eopkg and ssh. I was able to get these without changing the socket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: Sync Notes This PR/Issue can be highlighted in sync notes
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

OpenSnitch (T6067)
3 participants