Skip to content

Commit

Permalink
Write PIDFile inside /var/run/usbguard directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Spencer committed Nov 20, 2021
1 parent 03f40c2 commit 51bb953
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
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
4 changes: 2 additions & 2 deletions usbguard.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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
Expand Down

0 comments on commit 51bb953

Please sign in to comment.