[WIP] Fix SELinux permissions

This commit is contained in:
Vladimir Stoilov 2024-08-27 14:30:04 +03:00
parent 9bae1afd73
commit f7abb700bf
No known key found for this signature in database
GPG key ID: 2F190B67A43A81AF
4 changed files with 26 additions and 5 deletions

View file

@ -34,8 +34,9 @@ AmbientCapabilities=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_ne
CapabilityBoundingSet=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_net_broadcast cap_net_raw cap_sys_module cap_sys_ptrace cap_dac_override cap_fowner cap_fsetid cap_sys_resource cap_bpf cap_perfmon
StateDirectory=portmaster
# TODO(ppacher): add --disable-software-updates once it's merged and the release process changed.
ExecStart=/usr/bin/portmaster-core --data /opt/safing/portmaster -- $PORTMASTER_ARGS
ExecStopPost=-/usr/bin/portmaster-core recover-iptables
WorkingDirectory=/var/lib/portmaster/data
ExecStart=/usr/lib/portmaster/portmaster-core --data /var/lib/portmaster/data -devmode -- $PORTMASTER_ARGS
ExecStopPost=-/usr/bin/portmaster/portmaster-core recover-iptables
[Install]
WantedBy=multi-user.target

View file

@ -1,5 +1,16 @@
#!/bin/bash
chmod +x /usr/lib/portmaster/portmaster-core
#
# Fix selinux permissions for portmaster-core if we have semanage
# available.
#
if command -V semanage >/dev/null 2>&1; then
semanage fcontext -a -t bin_t -s system_u $(realpath /usr/lib)'/portmaster/portmaster-core' || :
restorecon -R /usr/lib/portmaster/portmaster-core 2>/dev/null >&2 || :
fi
systemctl daemon-reload
systemctl enable portmaster.service

View file

@ -1 +1,10 @@
#!/bin/bash
#
# Remove selinux permissions for portmaster-core if we have semanage
# available.
#
if command -V semanage >/dev/null 2>&1; then
semanage fcontext --delete $(realpath /usr/lib)'/portmaster/portmaster-core' || :
restorecon -R /usr/lib/portmaster/portmaster-core 2>/dev/null >&2 || :
fi

View file

@ -63,7 +63,7 @@ func New(instance instance) (*Updates, error) {
binIndex := registry.UpdateIndex{
Directory: "/usr/lib/portmaster",
DownloadDirectory: "/var/portmaster/new_bin",
DownloadDirectory: "/var/lib/portmaster/new_bin",
Ignore: []string{"databases", "intel", "config.json"},
IndexURLs: []string{"http://localhost:8000/test-binary.json"},
IndexFile: "bin-index.json",
@ -71,8 +71,8 @@ func New(instance instance) (*Updates, error) {
}
intelIndex := registry.UpdateIndex{
Directory: "/var/portmaster/intel",
DownloadDirectory: "/var/portmaster/new_intel",
Directory: "/var/lib/portmaster/intel",
DownloadDirectory: "/var/lib/portmaster/new_intel",
IndexURLs: []string{"http://localhost:8000/test-intel.json"},
IndexFile: "intel-index.json",
AutoApply: true,