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

Write PIDFile inside /var/run/usbguard directory #498

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#endif

#ifndef USBGUARD_PID_FILE
#define USBGUARD_PID_FILE "/var/run/usbguard.pid"
#define USBGUARD_PID_FILE "/var/run/usbguard/usbguard.pid"
#endif

using namespace usbguard;
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/Sanity/ldap-nsswitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

COUNTER="0"
declare -A BAD
PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

function grep_and_fail ()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/UseCase/ldap-test-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sudo -n cat "$ldap_path"

sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

${LDAP_UTIL} delete && true
${LDAP_UTIL} setup
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/UseCase/ldap-test-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sudo -n cat "$ldap_path"

sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

${LDAP_UTIL} delete && true
${LDAP_UTIL} setup
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/UseCase/ldap-test-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sudo -n cat "$ldap_path"

sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

${LDAP_UTIL} delete && true
# ${LDAP_UTIL} setup
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/UseCase/ldap-test-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sudo -n cat "$ldap_path"

sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

# ${LDAP_UTIL} delete && true
# ${LDAP_UTIL} setup
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/LDAP/UseCase/ldap-test-5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ sudo -n cat "$ldap_path"

sudo -n cp "$ldap_path" /etc/usbguard/usbguard-ldap.conf

PIDFILE="/var/run/usbguard.pid"
PIDFILE="/var/run/usbguard/usbguard.pid"

${LDAP_UTIL} delete && true
${LDAP_UTIL} setup
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/UseCase/004_daemonize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source "${USBGUARD_TESTLIB_BASH}" || exit 129
export USBGUARD_TESTLIB_TMPDIR="$(mktemp -d --tmpdir usbguard-test.XXXXXX)"

export config_path="${USBGUARD_TESTLIB_TMPDIR}/daemon.conf"
export pidfile_path="${USBGUARD_TESTLIB_TMPDIR}/usbguard.pid"
export pidfile_path="${USBGUARD_TESTLIB_TMPDIR}/usbguard/usbguard.pid"
export logfile="${USBGUARD_TESTLIB_TMPDIR}/daemon.log"

function test_cli_daemonize()
Expand Down
5 changes: 3 additions & 2 deletions usbguard.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ IPAddressDeny=any
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
PIDFile=/run/usbguard.pid
PIDFile=/run/usbguard/usbguard.pid
PrivateDevices=yes
PrivateTmp=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectKernelModules=yes
ProtectSystem=yes
ReadOnlyPaths=-/
ReadWritePaths=-/dev/shm -%localstatedir%/log/usbguard -/tmp -%sysconfdir%/usbguard/ -/var/run
ReadWritePaths=-/dev/shm -%localstatedir%/log/usbguard -/tmp -%sysconfdir%/usbguard/ -/var/run/usbguard
Restart=on-failure
RestrictAddressFamilies=AF_UNIX AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
RuntimeDirectory=usbguard
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=forking
Expand Down