Update docker/headscale/start.sh
This commit is contained in:
parent
33f58b4116
commit
39df4cea32
|
@ -80,6 +80,28 @@ ensure_private_key_exists() {
|
||||||
echo testgen derp private key
|
echo testgen derp private key
|
||||||
ensure_private_key_exists
|
ensure_private_key_exists
|
||||||
|
|
||||||
|
ensure_noise_private_key_exists() {
|
||||||
|
local key_path="/var/lib/headscale/noise_private.key"
|
||||||
|
|
||||||
|
# Check if the file exists and is a valid private key
|
||||||
|
if [[ -f "$key_path" ]] && openssl rsa -check -noout -in "$key_path" > /dev/null 2>&1; then
|
||||||
|
echo "Valid Noise private key already exists at $key_path."
|
||||||
|
else
|
||||||
|
# Generate a new 2048-bit RSA private key
|
||||||
|
mkdir -p /var/lib/headscale
|
||||||
|
openssl genpkey -algorithm RSA -out "$key_path" -pkeyopt rsa_keygen_bits:2048
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo "New Noise private key generated at $key_path."
|
||||||
|
else
|
||||||
|
echo "Failed to generate Noise private key."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo testgen noise private key
|
||||||
|
ensure_noise_private_key_exists
|
||||||
|
|
||||||
|
|
||||||
# Run the function to replace variables and start headscale
|
# Run the function to replace variables and start headscale
|
||||||
replace_config_values
|
replace_config_values
|
||||||
|
|
Loading…
Reference in New Issue