ensure Tor daemon files have correct permissions

Message ID f79e04e3-89b2-fffb-0d32-f79f90b7bf11@ipfire.org
State Accepted
Commit a10b0e5b448bf7e4a9bcc334e177ddae09806dc7
Headers
Series ensure Tor daemon files have correct permissions |

Commit Message

Peter Müller March 16, 2019, 4 a.m. UTC
  Set permissions for /var/lib/tor and /var/ipfire/tor to
tor:tor, regardless whether Tor user has been created before
or not.

This ensures Tor starts properly on existing systems after
reinstallation of the add-on. Thanks to Michael for the hint.

Further, a comment for new Tor user in /etc/passwd has been added.

Fixes #11779.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 src/paks/tor/install.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/src/paks/tor/install.sh b/src/paks/tor/install.sh
index e1ed33331..268bccecd 100644
--- a/src/paks/tor/install.sh
+++ b/src/paks/tor/install.sh
@@ -29,12 +29,12 @@  if ! getent group tor &>/dev/null; then
 fi
 
 if ! getent passwd tor; then
-       useradd -u 119 -g tor -d /var/empty -s /bin/false tor
-
-       # Adjust some folder permission for new UID/GID
-       chown -R tor:tor /var/lib/tor /var/ipfire/tor
+       useradd -u 119 -g tor -c "Tor daemon user" -d /var/empty -s /bin/false tor
 fi
 
+# Adjust some folder permission for new UID/GID
+chown -R tor:tor /var/lib/tor /var/ipfire/tor
+
 extract_files
 restore_backup ${NAME}
 start_service --background ${NAME}