mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Failsafe home dir obtaining
+ When estimating $INSTALL_HOME, assure grep can only match user names, to avoid possible wrong multi-line value + Remove possible trailing slash from $INSTALL_HOME, to avoid double slash in "$INSTALL_HOME/ovpns" + Avoid "cat <file> | grep <pattern>", since grep can process files directly Signed-off-by: MichaIng <micha@dietpi.com>
This commit is contained in:
parent
9ee4c6179f
commit
73b23c525b
1 changed files with 3 additions and 2 deletions
|
@ -1131,7 +1131,8 @@ confOVPN() {
|
||||||
# verify server name to strengthen security
|
# verify server name to strengthen security
|
||||||
$SUDO sed -i "s/SRVRNAME/${SERVER_NAME}/" /etc/openvpn/easy-rsa/pki/Default.txt
|
$SUDO sed -i "s/SRVRNAME/${SERVER_NAME}/" /etc/openvpn/easy-rsa/pki/Default.txt
|
||||||
|
|
||||||
INSTALL_HOME=$(cat /etc/passwd | grep "$INSTALL_USER" | cut -d: -f6)
|
INSTALL_HOME=$(grep -m1 "^${INSTALL_USER}:" /etc/passwd | cut -d: -f6)
|
||||||
|
INSTALL_HOME=${INSTALL_HOME%/} # remove possible trailing slash
|
||||||
if [ ! -d "$INSTALL_HOME/ovpns" ]; then
|
if [ ! -d "$INSTALL_HOME/ovpns" ]; then
|
||||||
$SUDO mkdir "$INSTALL_HOME/ovpns"
|
$SUDO mkdir "$INSTALL_HOME/ovpns"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue