Skip to content

Commit

Permalink
cjdns service: ensure that generated passwd has requested length
Browse files Browse the repository at this point in the history
`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`.
  • Loading branch information
joachifm committed Oct 27, 2016
1 parent e94bd6f commit 9654e09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/cjdns.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
Expand Down

0 comments on commit 9654e09

Please sign in to comment.