mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
17d711e258
this will mean that we just lost /var/run/tor - creating it in the maintainer script if it doesn't exist. svn:r13208
57 lines
1.8 KiB
Bash
57 lines
1.8 KiB
Bash
#!/bin/sh -e
|
|
|
|
# checking debian-tor account
|
|
|
|
uid=`getent passwd debian-tor | cut -d ":" -f 3`
|
|
home=`getent passwd debian-tor | cut -d ":" -f 6`
|
|
|
|
# if there is the uid the account is there and we can do
|
|
# the sanit(ar)y checks otherwise we can safely create it.
|
|
|
|
if [ "$uid" ]; then
|
|
if [ "$home" = "/var/lib/tor" ]; then
|
|
:
|
|
#echo "debian-tor homedir check: ok"
|
|
else
|
|
echo "ERROR: debian-tor account has an unexpected home directory!"
|
|
echo "It should be '/var/lib/tor', but it is '$home'."
|
|
echo "Removing the debian-tor user might fix this, but the question"
|
|
echo "remains how you got into this mess to begin with."
|
|
exit 1
|
|
fi
|
|
else
|
|
adduser --quiet \
|
|
--system \
|
|
--disabled-password \
|
|
--home /var/lib/tor \
|
|
--no-create-home \
|
|
--shell /bin/bash \
|
|
--group \
|
|
debian-tor
|
|
fi
|
|
|
|
|
|
for i in lib run log; do
|
|
if ! [ -d "/var/$i/tor" ]; then
|
|
echo "Something or somebody made /var/$i/tor disappear."
|
|
echo "Creating one for you again."
|
|
mkdir "/var/$i/tor"
|
|
fi
|
|
done
|
|
|
|
find /var/lib/tor ! -user debian-tor -o ! -group debian-tor -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
|
|
find /var/lib/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02700
|
|
find /var/lib/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
|
|
|
|
find /var/run/tor ! -user debian-tor -o ! -group debian-tor -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
|
|
find /var/run/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
|
|
find /var/run/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
|
|
|
|
find /var/log/tor ! -user debian-tor -o ! -group adm -print0 | xargs -0 --no-run-if-empty chown debian-tor:adm
|
|
find /var/log/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
|
|
find /var/log/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00640
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|