feat: use dedicated 'libretime' user

BREAKING CHANGE: The default `www-data` user has been replaced by a dedicated  `libretime` user to run the services. Be sure to change the ownership of the libretime files.
This commit is contained in:
jo 2022-07-06 16:21:40 +02:00 committed by Kyle Robbertze
parent 0bb792d047
commit 2f205544c2
16 changed files with 50 additions and 25 deletions

View file

@ -98,7 +98,7 @@ EOF
# Configuration
# > User used to run LibreTime.
LIBRETIME_USER=${LIBRETIME_USER:-"www-data"}
LIBRETIME_USER=${LIBRETIME_USER:-"libretime"}
# > Listen port for LibreTime.
LIBRETIME_LISTEN_PORT=${LIBRETIME_LISTEN_PORT:-"80"}
# > Public URL for LibreTime.
@ -177,6 +177,8 @@ done
PYTHON="python3"
PIP="$PYTHON -m pip"
DEFAULT_WEB_USER="www-data"
# Paths
CONFIG_DIR="/etc/libretime"
CONFIG_FILEPATH="$CONFIG_DIR/config.yml"
@ -394,6 +396,11 @@ prepare_packages_install
install_packages git make
make VERSION
info "creating project user"
if ! id "$LIBRETIME_USER" &> /dev/null; then
useradd --no-create-home --home-dir "$WORKING_DIR" "$LIBRETIME_USER"
fi
info "creating project directories"
# TODO: Config dir should not be owned by www-data and should be readonly
mkdir_and_chown "$LIBRETIME_USER" "$CONFIG_DIR"