blob: b0fe0ad06d38f4b060fa19098e6de0028a6b2172 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
post_install() {
PASSWORDFILE="/etc/duckcloud/password.cred"
TMPFILE="/tmp/password.txt"
if [ -f "$PASSWORDFILE" ]; then
echo "$PASSWORDFILE already exists, do nothing"
else
echo "Generate the password file at $PASSWORDFILE"
openssl rand -hex 32 | head -n1 > "$TMPFILE"
sudo systemd-creds encrypt --name=password "$TMPFILE" "$PASSWORDFILE"
shred -u "$TMPFILE"
fi
}
|