add security for temp file

This commit is contained in:
Simon Vieille 2019-08-01 11:03:12 +02:00
父節點 2a9538eaab
當前提交 182544a6fe
簽署人: deblan
GPG Key ID: 03383D15A1D31745
共有 1 個文件被更改,包括 4 次插入2 次删除

查看文件

@ -99,8 +99,9 @@ export WEB_HTTPS_DEFAULT_CERT_PRIVKEY
export WEB_HTTPS_DEFAULT_CERT_CHAIN
TMP_FILE="/tmp/vhost-add-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
template summary > "$TMP_FILE"
touch "$TMP_FILE"
chmod 600 "$TMP_FILE"
template summary > "$TMP_FILE"
whiptail --textbox "$TMP_FILE" 25 80
rm "$TMP_FILE"
@ -168,7 +169,8 @@ done
export USER_PASSWORD
TMP_FILE="/tmp/vhost-add-$(tr -dc "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" < /dev/urandom | head -c 16)"
template result > "$TMP_FILE"
touch "$TMP_FILE"
chmod 600 "$TMP_FILE"
template result > "$TMP_FILE"
whiptail --textbox "$TMP_FILE" 25 80
rm "$TMP_FILE"