cjdns service: ensure that generated passwd has requested length

`head -cNUM ... | tr -dc SET` might generate output containing fewer
than NUM characters.  Given the limited alphabet, this could result in a
fairly weak passphrase. The construction `tr </dev/urandom | head
-cNUM`, however, is sure to give us the full `NUM`.
This commit is contained in:
Joachim Fasting 2016-10-24 20:33:34 +02:00
parent e94bd6f31d
commit 9654e09b5a
1 changed files with 1 additions and 1 deletions

View File

@ -229,7 +229,7 @@ in
fi
if [ -z "$CJDNS_ADMIN_PASSWORD" ]; then
echo "CJDNS_ADMIN_PASSWORD=$(${pkgs.coreutils}/bin/head -c 96 /dev/urandom | ${pkgs.coreutils}/bin/tr -dc A-Za-z0-9)" \
echo "CJDNS_ADMIN_PASSWORD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 96)" \
>> /etc/cjdns.keys
fi
'';