Conversation
Linkfix to wiki
|
@evilsocket seems #118 was not proper after all? 🤔 |
|
I think i found the spot where the packaged version in the @gustavo-iniguez-goya could you please make that file a symbolic link to the one in the master tree at: https://github.com/evilsocket/opensnitch/blob/master/daemon/opensnitchd.service 🤔 It will eliminate further discrepancies between the packaged version and the sources of the daemon... |
|
@lainedfles in reply to #1018 (comment)
When not using absolute paths, systemd is using it's own default (build-in) path to find the executables see: systemd-path search-binaries-default.
That makefile could/should be changed to use this access-mode anyway to make that directory more secure... 🤷♀️
The
Nice catch, i expected for it to become empty in the expansion so i didn't expect that 👍
It can be removed when the functionality you mention is implemented, but until then lets keep it in the unit.
|
Applied suggested changes by @lainedfles
If things do go wrong or just to be extra specific we could add |
|
Any progress here ? |
|
@luzpaz ,If i would have made any more changes they would be shown in this thread as commits so no, the PR is still waiting for merging/acceptance... Feel free to do a review if you want though 👍 |
| Wants=network-pre.target | ||
| Conflicts=shutdown.target | ||
| # Don't start when 'no-appfw` is in kernel command-line, to allow booting without it. | ||
| ConditionKernelCommandLine=!no-appfw |
There was a problem hiding this comment.
Is no-appfw a well known kernel command line option, or introduced here?
There was a problem hiding this comment.
I invented it just for this service 😉
|
Note, Debian uses fragments from this patch in 1030-systemd-service-earlier.patch. It would be nice to know if at least these parts will make it into master. |
|
In NixOS we currently hand-roll our own minimal version of the systemd service here, without any of these patches: https://github.com/NixOS/nixpkgs/blob/ee930f9755f58096ac6e8ca94a1887e0534e2d81/nixos/modules/services/security/opensnitch.nix#L202-L245 I was intending to add the systemd hardening options to opensnitch, and i was considering upstreaming those - that would result in a merge conflict on this file, but is mostly an orthogonal change set in terms of logic. |
Implements: #1018
Summary:
The systemd service unit can be enhanced to start BEFORE any network is configured, and thus allow interception and protection at an earlier stage...
Notable changes/additions:
Unit filename:
⚠️ The service filename needs tobe changed to
opensnitchd.service!!!This was needed for automatically using the unit name in the service definition using the
%Nspecifier...See: Specifiers@man
systemd.unit#Specifiersdin it's name !Unit ordering:
Made sure the daemon starts before any network related devices or services are created/started by using
network-pre.target, See:Startup target / run-level:
Changed the default install target to
basic.targetinstead ofmulti-user.target.This will allow it to run in any "run-level" in SysV terms.
See: Units managed by the system service manager@man
systemd.special#basic.targetAutomatically disable using a kernel-command-line option:
Just in case it is needed, i added the ability to disable the daemon using a kernel-command-line option using the
ConditionKernelCommandLinedirective.When the
no-appfwoption is present in the kernel-command-line, the daemon will not startup.This option functions same as the well-known
quiteoption. (only applies when present as a separate word)Automatically create rules directory:
Let systemd automatically create the "rules" directory with proper mode, when non-existent yet, upon starting the daemon service by using the
ConfigurationDirectoryandConfigurationDirectoryModedirectives.Automatically check for kernel support before starting:
Automatically prevent startup when required kernel support is not present by using the
-check-requirementsflag in aExecConditiondirective.(This assumes the command returns a non-zero exit status when not satisfied.)
Reload functionality:
Added support for reloading the daemon using the
ExecReloaddirective.Signal-info was taken from the init.d script, but it just exits and then systemd restarts the service...
So this functionality either needs to be implemented in the daemon's code or a different signal needs to be sent to it.
But at least the functionality is now present in the unit file.
Prevent from being killed by the OOM-Killer:
Prevented the daemon to be killed by the Linux kernel's Out-Of-Memory (OOM) killer, using the
OOMScoreAdjust=-1000directive.See: OOMScoreAdjust@man
systemd.exec#OOMScoreAdjust(This will ensure that the protection keeps functioning even when other processes cause an OOM)
Admin overrides using drop-ins:
Added support for easily adjusting the directory used for rules and extra options by the local admin.
The local admin can create "drop-in" config(s) under
/etc/systemd/system/opensnitchd.service.d/even when the service file is installed in other places by the package maintainer, See: 16.14. Extending the default unit configuration@redhat.comExample drop-in(s) contents that can-be-used:
To change the rules directory to be used:
$custom_cfgis supplied as an argument to the-rules-pathoption of the daemon.systemd.unit#Specifiers%Eexpands to/etc%Nexpands to the unit nameopensnitchd/etc/opensnitchd/rules-specialTo enable debug output:
$optsis supplied as extra argument(s) to the daemon.Combination of both: