feat: add urandom seed as source for machine-id generation
This commit is contained in:
parent
7724b2b922
commit
260a9b4fae
|
@ -13,12 +13,13 @@ main() {
|
||||||
# Accumulate data to create unique machine id
|
# Accumulate data to create unique machine id
|
||||||
local mac_addresses=$(cat /sys/class/net/*/address | uniq | sort)
|
local mac_addresses=$(cat /sys/class/net/*/address | uniq | sort)
|
||||||
local device_model=$(cat /sys/firmware/devicetree/base/model)
|
local device_model=$(cat /sys/firmware/devicetree/base/model)
|
||||||
|
local urandom_seed=$(cat /etc/urandom.seed | sha256sum | cut -d ' ' -f1)
|
||||||
|
|
||||||
# Ensure destination directory
|
# Ensure destination directory
|
||||||
mkdir -p "$(dirname "$machine_id_file")"
|
mkdir -p "$(dirname "$machine_id_file")"
|
||||||
|
|
||||||
# Generate SHA256 hash of data and save it to $machine_id_file
|
# Generate SHA256 hash of data and save it to $machine_id_file
|
||||||
echo "$mac_adresses $device_model" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
|
echo "$mac_adresses $device_model $urandom_seed" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
Loading…
Reference in New Issue