Browse Source

add security for temp file

master
Simon Vieille 3 months ago
parent
commit
182544a6fe
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      bin/vhost-add

+ 4
- 2
bin/vhost-add View File

@@ -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"

Loading…
Cancel
Save