refactor: Harmonize ownership

fix #1608: Use same moethod to define ownership in bot makeOVPN and makeCONF scripts
This commit is contained in:
4s3ti 2022-11-29 00:05:34 +01:00
parent f7f81e1bf4
commit 704d9f9795
No known key found for this signature in database
GPG key ID: AC2D3B898F96BC51

View file

@ -14,6 +14,10 @@ INDEX="/etc/openvpn/easy-rsa/pki/index.txt"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${setupVars}" source "${setupVars}"
# shellcheck disable=SC2154
userGroup="${install_user}:${install_user}"
## Functions ## Functions
err() { err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2 echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
@ -286,7 +290,7 @@ done
# shellcheck disable=SC2154 # shellcheck disable=SC2154
if [[ ! -d "${install_home}/ovpns" ]]; then if [[ ! -d "${install_home}/ovpns" ]]; then
mkdir "${install_home}/ovpns" mkdir "${install_home}/ovpns"
chown "${install_user}:${install_user}" "${install_home}/ovpns" chown "${userGroup}" "${install_home}/ovpns"
chmod 0750 "${install_home}/ovpns" chmod 0750 "${install_home}/ovpns"
fi fi
@ -456,7 +460,7 @@ if [[ "${iOS}" == 1 ]]; then
-name "${NAME}" \ -name "${NAME}" \
-out "${install_home}/ovpns/${NAME}.ovpn12" -out "${install_home}/ovpns/${NAME}.ovpn12"
chown "${install_user}:${install_user}" "${install_home}/ovpns/${NAME}.ovpn12" chown "${userGroup}" "${install_home}/ovpns/${NAME}.ovpn12"
chmod 640 "${install_home}/ovpns/${NAME}.ovpn12" chmod 640 "${install_home}/ovpns/${NAME}.ovpn12"
printf "========================================================\n" printf "========================================================\n"