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:
parent
e94bd6f31d
commit
9654e09b5a
|
@ -229,7 +229,7 @@ in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$CJDNS_ADMIN_PASSWORD" ]; then
|
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
|
>> /etc/cjdns.keys
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue