add security for temp file

This commit is contained in:
Simon Vieille 2019-08-01 11:03:12 +02:00
부모 2a9538eaab
커밋 182544a6fe
로그인 계정: deblan
GPG 키 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"