Fix telemetry_id if missing

This commit is contained in:
Jamil Bou Kheir
2022-02-04 06:47:14 -08:00
parent bf6c1cbd6b
commit cde7e86934
2 changed files with 2 additions and 8 deletions

View File

@@ -67,13 +67,6 @@ class Firezone
node.consume_attributes('firezone' => secrets)
rescue Errno::ENOENT
begin
telemetry_id = if node['firezone'] && node['firezone']['telemetry_id']
Chef::Log.warn 'Using telemetry_id from firezone.json. This value should really be managed in secrets.json. Writing to secrets.json.'
node['firezone']['telemetry_id']
else
Chef::Log.warn 'No telemetry_id set! Generating and writing one to secrets.json. If this Firezone installation has multiple hosts, you must duplicate the secrets.json file exactly across all hosts.'
SecureRandom.uuid()
end
secret_key_base = if node['firezone'] && node['firezone']['secret_key_base']
Chef::Log.warn 'Using secret_key_base from firezone.json. This value should really be managed in secrets.json. Writing to secrets.json.'
node['firezone']['secret_key_base']
@@ -118,7 +111,6 @@ class Firezone
end
secrets = {
'telemetry_id' => telemetry_id,
'secret_key_base' => secret_key_base,
'live_view_signing_salt' => live_view_signing_salt,
'cookie_signing_salt' => cookie_signing_salt,

View File

@@ -39,6 +39,8 @@ Firezone::Config.load_or_create_secrets!(
node
)
node.default['firezone']['telemetry_id'] ||= SecureRandom.uuid()
node.default['firezone']['wireguard_public_key'] =
`echo '#{node['firezone']['wireguard_private_key']}' | #{node['firezone']['install_directory']}/embedded/bin/wg pubkey`.chomp