[LEDE-DEV] [PATCH v4] base-files: seed /dev/urandom
Daniel Gimpelevich
daniel at gimpelevich.san-francisco.ca.us
Thu Jun 23 08:19:00 PDT 2016
On Thu, 2016-06-16 at 09:38 +0000, Etienne CHAMPETIER wrote:
> +SEED=/etc/urandom.seed
> +
> +error_exit() {
> + logger -t urandom_seed "$1"
> + exit 1
> +}
> +
> +save() {
> + touch $SEED.tmp || error_exit "touch failed"
> + chown root:root $SEED.tmp || error_exit "chown failed"
> + chmod 600 $SEED.tmp || error_exit "chmod failed"
> + getrandom 512 > $SEED.tmp || error_exit "getrandom failed"
> + mv $SEED.tmp $SEED || error_exit "mv failed"
> +}
The .tmp file should go in /tmp, and maybe SEED would be better off
in /etc/config, so that it gets picked up by sysupgrade?
More information about the Lede-dev
mailing list