postsrsd: fix secret generation
This commit is contained in:
parent
c8ca34e269
commit
b12646cb79
1 changed files with 5 additions and 1 deletions
|
@ -95,7 +95,11 @@ in {
|
|||
preStart = ''
|
||||
if [ ! -e "${cfg.secretsFile}" ]; then
|
||||
echo "WARNING: secrets file not found, autogenerating!"
|
||||
mkdir -p -m750 "$(dirname "${cfg.secretsFile}")"
|
||||
DIR="$(dirname "${cfg.secretsFile}")"
|
||||
if [ ! -d "$DIR" ]; then
|
||||
mkdir -p -m750 "$DIR"
|
||||
chown "${cfg.user}:${cfg.group}" "$DIR"
|
||||
fi
|
||||
dd if=/dev/random bs=18 count=1 | base64 > "${cfg.secretsFile}"
|
||||
chmod 600 "${cfg.secretsFile}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue