From 4334500ef427c7e3dc179968a08cc4adb4d16dae Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 6 Nov 2026 14:00:16 +0000 Subject: [PATCH] types: add config compatibility goldens Updates #1926 --- .../compat/env-lists-maps.golden.json | 177 +++++++++++++++++ .../testdata/compat/env-only.golden.json | 156 +++++++++++++++ .../testdata/compat/env-secrets.golden.json | 161 +++++++++++++++ .../compat/example-v0.23.0.golden.json | 7 + .../compat/example-v0.24.0.golden.json | 7 + .../compat/example-v0.25.0.golden.json | 7 + .../compat/example-v0.26.0.golden.json | 7 + .../compat/example-v0.27.0.golden.json | 7 + .../compat/example-v0.28.0.golden.json | 7 + .../compat/example-v0.29.0.golden.json | 187 ++++++++++++++++++ .../compat/example-v0.29.7.golden.json | 187 ++++++++++++++++++ .../testdata/compat/hsic-default.golden.json | 169 ++++++++++++++++ .../testdata/compat/nixos-cli.golden.json | 155 +++++++++++++++ .../testdata/compat/nixos-example.golden.json | 180 +++++++++++++++++ ...data-base-domain-in-server-url.golden.json | 3 + ...-base-domain-not-in-server-url.golden.json | 158 +++++++++++++++ ...stdata-dns-override-true-error.golden.json | 3 + .../testdata-dns-override-true.golden.json | 166 ++++++++++++++++ .../compat/testdata-dns_full.golden.json | 3 + .../testdata-dns_full_no_magic.golden.json | 3 + .../compat/testdata-minimal.golden.json | 3 + ...testdata-policy-path-is-loaded.golden.json | 156 +++++++++++++++ 22 files changed, 1909 insertions(+) create mode 100644 hscontrol/types/testdata/compat/env-lists-maps.golden.json create mode 100644 hscontrol/types/testdata/compat/env-only.golden.json create mode 100644 hscontrol/types/testdata/compat/env-secrets.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.23.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.24.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.25.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.26.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.27.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.28.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.29.0.golden.json create mode 100644 hscontrol/types/testdata/compat/example-v0.29.7.golden.json create mode 100644 hscontrol/types/testdata/compat/hsic-default.golden.json create mode 100644 hscontrol/types/testdata/compat/nixos-cli.golden.json create mode 100644 hscontrol/types/testdata/compat/nixos-example.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-base-domain-in-server-url.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-base-domain-not-in-server-url.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-dns-override-true-error.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-dns-override-true.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-dns_full.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-dns_full_no_magic.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-minimal.golden.json create mode 100644 hscontrol/types/testdata/compat/testdata-policy-path-is-loaded.golden.json diff --git a/hscontrol/types/testdata/compat/env-lists-maps.golden.json b/hscontrol/types/testdata/compat/env-lists-maps.golden.json new file mode 100644 index 000000000..f8cf9929b --- /dev/null +++ b/hscontrol/types/testdata/compat/env-lists-maps.golden.json @@ -0,0 +1,177 @@ +{ + "config": { + "ServerURL": "https://hs.example.com", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": null, + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise.key", + "BaseDomain": "", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": false, + "BaseDomain": "", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": ["1.1.1.1", "8.8.8.8"], + "Split": { + "corp.example.com": ["10.0.0.1"] + } + }, + "SearchDomains": ["a.example.com", "b.example.com"], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": { + "Routes": { + "corp.example.com": [ + { + "Addr": "10.0.0.1" + } + ] + }, + "FallbackResolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "8.8.8.8" + } + ], + "Domains": ["a.example.com", "b.example.com"] + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": { + "domain_hint": "example.com" + }, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": ["no config file found, using defaults"] +} diff --git a/hscontrol/types/testdata/compat/env-only.golden.json b/hscontrol/types/testdata/compat/env-only.golden.json new file mode 100644 index 000000000..ed16d445d --- /dev/null +++ b/hscontrol/types/testdata/compat/env-only.golden.json @@ -0,0 +1,156 @@ +{ + "config": { + "ServerURL": "https://hs.example.com", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": null, + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise.key", + "BaseDomain": "", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": false, + "BaseDomain": "", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": [], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": {}, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": ["no config file found, using defaults"] +} diff --git a/hscontrol/types/testdata/compat/env-secrets.golden.json b/hscontrol/types/testdata/compat/env-secrets.golden.json new file mode 100644 index 000000000..d7c3b36ce --- /dev/null +++ b/hscontrol/types/testdata/compat/env-secrets.golden.json @@ -0,0 +1,161 @@ +{ + "config": { + "ServerURL": "https://hs.example.com", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": null, + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise.key", + "BaseDomain": "", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": false, + "BaseDomain": "", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": [], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": {}, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "https://idp.example.com", + "ClientID": "marker-client-id", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "secrets": { + "cli.api_key": "marker-cli-api-key", + "database.postgres.pass": "marker-postgres-pass", + "oidc.client_secret": "marker-oidc-secret" + }, + "warnings": ["no config file found, using defaults"] +} diff --git a/hscontrol/types/testdata/compat/example-v0.23.0.golden.json b/hscontrol/types/testdata/compat/example-v0.23.0.golden.json new file mode 100644 index 000000000..e2f101023 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.23.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key dns.use_username_in_magic_dns has been removed\n current: dns.use_username_in_magic_dns: false\n hint: remove dns.use_username_in_magic_dns; see the CHANGELOG for context\n\nFatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.24.0.golden.json b/hscontrol/types/testdata/compat/example-v0.24.0.golden.json new file mode 100644 index 000000000..5d73f533e --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.24.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.25.0.golden.json b/hscontrol/types/testdata/compat/example-v0.25.0.golden.json new file mode 100644 index 000000000..5d73f533e --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.25.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.26.0.golden.json b/hscontrol/types/testdata/compat/example-v0.26.0.golden.json new file mode 100644 index 000000000..5d73f533e --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.26.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.27.0.golden.json b/hscontrol/types/testdata/compat/example-v0.27.0.golden.json new file mode 100644 index 000000000..5d73f533e --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.27.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.28.0.golden.json b/hscontrol/types/testdata/compat/example-v0.28.0.golden.json new file mode 100644 index 000000000..5d73f533e --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.28.0.golden.json @@ -0,0 +1,7 @@ +{ + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ], + "error": "Fatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: false\n hint: Set \"randomizeClientPort\": true at the top level of your policy file (see policy.path / policy.mode), or grant the cap per-node via a \"nodeAttrs\" entry. See CHANGELOG.md (BREAKING / Configuration).\n" +} diff --git a/hscontrol/types/testdata/compat/example-v0.29.0.golden.json b/hscontrol/types/testdata/compat/example-v0.29.0.golden.json new file mode 100644 index 000000000..081523f81 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.29.0.golden.json @@ -0,0 +1,187 @@ +{ + "config": { + "ServerURL": "http://127.0.0.1:8080", + "Addr": "127.0.0.1:8080", + "MetricsAddr": "127.0.0.1:9090", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 1800000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise_private.key", + "BaseDomain": "example.com", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 1000000000, + "SkipErrRecordNotFound": true, + "ParameterizedQueries": true + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 999, + "ServerRegionCode": "headscale", + "ServerRegionName": "Headscale Embedded DERP", + "ServerPrivateKeyPath": "/var/lib/headscale/derp_server_private.key", + "ServerVerifyClients": true, + "STUNAddr": "0.0.0.0:3478", + "URLs": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": [], + "DERPMap": null, + "AutoUpdate": true, + "UpdateFrequency": 10800000000000, + "IPv4": "198.51.100.1", + "IPv6": "2001:db8::1" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "https://acme-v02.api.letsencrypt.org/directory", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "example.com", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": ["1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001"], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": [], + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "example.com" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "1.0.0.1" + }, + { + "Addr": "2606:4700:4700::1111" + }, + { + "Addr": "2606:4700:4700::1001" + } + ], + "Domains": ["example.com"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": ["configuration key \"database.gorm.prepare_stmt\" is ignored"] +} diff --git a/hscontrol/types/testdata/compat/example-v0.29.7.golden.json b/hscontrol/types/testdata/compat/example-v0.29.7.golden.json new file mode 100644 index 000000000..081523f81 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.29.7.golden.json @@ -0,0 +1,187 @@ +{ + "config": { + "ServerURL": "http://127.0.0.1:8080", + "Addr": "127.0.0.1:8080", + "MetricsAddr": "127.0.0.1:9090", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 1800000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise_private.key", + "BaseDomain": "example.com", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 1000000000, + "SkipErrRecordNotFound": true, + "ParameterizedQueries": true + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 999, + "ServerRegionCode": "headscale", + "ServerRegionName": "Headscale Embedded DERP", + "ServerPrivateKeyPath": "/var/lib/headscale/derp_server_private.key", + "ServerVerifyClients": true, + "STUNAddr": "0.0.0.0:3478", + "URLs": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": [], + "DERPMap": null, + "AutoUpdate": true, + "UpdateFrequency": 10800000000000, + "IPv4": "198.51.100.1", + "IPv6": "2001:db8::1" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "https://acme-v02.api.letsencrypt.org/directory", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "example.com", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": ["1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001"], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": [], + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "example.com" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "1.0.0.1" + }, + { + "Addr": "2606:4700:4700::1111" + }, + { + "Addr": "2606:4700:4700::1001" + } + ], + "Domains": ["example.com"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": ["configuration key \"database.gorm.prepare_stmt\" is ignored"] +} diff --git a/hscontrol/types/testdata/compat/hsic-default.golden.json b/hscontrol/types/testdata/compat/hsic-default.golden.json new file mode 100644 index 000000000..8e5945dcc --- /dev/null +++ b/hscontrol/types/testdata/compat/hsic-default.golden.json @@ -0,0 +1,169 @@ +{ + "config": { + "ServerURL": "http://hs-compat:8080", + "Addr": "", + "MetricsAddr": "0.0.0.0:9090", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/tmp/noise_private.key", + "BaseDomain": "headscale.net", + "Log": { + "Format": "text", + "Level": "trace" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 1000000, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/tmp/integration_test_db.sqlite3", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": true, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 999, + "ServerRegionCode": "headscale", + "ServerRegionName": "Headscale Embedded DERP", + "ServerPrivateKeyPath": "/tmp/derp.key", + "ServerVerifyClients": true, + "STUNAddr": "0.0.0.0:3478", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 60000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "headscale.net", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": ["127.0.0.11", "1.1.1.1"], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "headscale.net" + } + }, + "TailcfgDNSConfig": { + "FallbackResolvers": [ + { + "Addr": "127.0.0.11" + }, + { + "Addr": "1.1.1.1" + } + ], + "Domains": ["headscale.net"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": [ + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead" + ] +} diff --git a/hscontrol/types/testdata/compat/nixos-cli.golden.json b/hscontrol/types/testdata/compat/nixos-cli.golden.json new file mode 100644 index 000000000..a35023e01 --- /dev/null +++ b/hscontrol/types/testdata/compat/nixos-cli.golden.json @@ -0,0 +1,155 @@ +{ + "config": { + "ServerURL": "", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 0 + }, + "Routes": { + "HA": { + "ProbeInterval": 0, + "ProbeTimeout": 0 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 0 + }, + "PrefixV4": null, + "PrefixV6": null, + "IPAllocation": "", + "NoisePrivateKeyPath": "", + "BaseDomain": "", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": true, + "Database": { + "Type": "", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": false, + "WALAutoCheckPoint": 0 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "", + "MaxOpenConnections": 0, + "MaxIdleConnections": 0, + "ConnMaxIdleTimeSecs": 0 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": false, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": false, + "STUNAddr": "", + "URLs": null, + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 0, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "", + "HTTPListen": "", + "URL": "", + "Email": "", + "CacheDir": "" + } + }, + "DNSConfig": { + "MagicDNS": false, + "BaseDomain": "", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": null, + "Split": null + }, + "SearchDomains": null, + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": null, + "DNSChallenge": { + "PropagationTimeout": 0, + "Resolvers": null, + "ProviderName": "" + }, + "UnixSocket": "/run/headscale/headscale.sock", + "UnixSocketPermission": 0, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": false, + "Issuer": "", + "ClientID": "", + "Scope": null, + "ExtraParams": null, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": false, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": false + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "" + }, + "Tuning": { + "NotifierSendTimeout": 0, + "BatchChangeDelay": 0, + "NodeMapSessionBufferedChanSize": 0, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 0, + "NodeStoreBatchTimeout": 0 + } + } +} diff --git a/hscontrol/types/testdata/compat/nixos-example.golden.json b/hscontrol/types/testdata/compat/nixos-example.golden.json new file mode 100644 index 000000000..ac9cb7de9 --- /dev/null +++ b/hscontrol/types/testdata/compat/nixos-example.golden.json @@ -0,0 +1,180 @@ +{ + "config": { + "ServerURL": "https://headscale.example.com", + "Addr": "0.0.0.0:8080", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 1800000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise_private.key", + "BaseDomain": "tailnet.example.com", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "/var/lib/headscale/derp_server_private.key", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": [], + "DERPMap": null, + "AutoUpdate": true, + "UpdateFrequency": 86400000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "tailnet.example.com", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": ["1.1.1.1", "8.8.8.8"], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "tailnet.example.com" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "8.8.8.8" + } + ], + "Domains": ["tailnet.example.com"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": [], + "AllowedUsers": [], + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "/var/lib/headscale/policy.hujson", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + } +} diff --git a/hscontrol/types/testdata/compat/testdata-base-domain-in-server-url.golden.json b/hscontrol/types/testdata/compat/testdata-base-domain-in-server-url.golden.json new file mode 100644 index 000000000..8820131d4 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-base-domain-in-server-url.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: server_url is a subdomain of dns.base_domain\n current: server_url: \"https://server.derp.no\", dns.base_domain: \"derp.no\"\n hint: host headscale on a domain outside dns.base_domain (Tailscale takes over base_domain via MagicDNS)\n see: https://headscale.net/stable/ref/dns/\n" +} diff --git a/hscontrol/types/testdata/compat/testdata-base-domain-not-in-server-url.golden.json b/hscontrol/types/testdata/compat/testdata-base-domain-not-in-server-url.golden.json new file mode 100644 index 000000000..9f2a84e8f --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-base-domain-not-in-server-url.golden.json @@ -0,0 +1,158 @@ +{ + "config": { + "ServerURL": "https://derp.no", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "$DIR/private_key.pem", + "BaseDomain": "clients.derp.no", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "clients.derp.no", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": [], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "clients.derp.no" + } + }, + "TailcfgDNSConfig": { + "Domains": ["clients.derp.no"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + } +} diff --git a/hscontrol/types/testdata/compat/testdata-dns-override-true-error.golden.json b/hscontrol/types/testdata/compat/testdata-dns-override-true-error.golden.json new file mode 100644 index 000000000..d6f798a49 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-dns-override-true-error.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: dns.nameservers.global is required when dns.override_local_dns is true\n current: dns.override_local_dns: true, dns.nameservers.global: \"[]\"\n hint: list at least one upstream nameserver, or set dns.override_local_dns: false\n see: https://headscale.net/stable/ref/dns/\n\nFatal config error: server_url is a subdomain of dns.base_domain\n current: server_url: \"https://server.derp.no\", dns.base_domain: \"derp.no\"\n hint: host headscale on a domain outside dns.base_domain (Tailscale takes over base_domain via MagicDNS)\n see: https://headscale.net/stable/ref/dns/\n" +} diff --git a/hscontrol/types/testdata/compat/testdata-dns-override-true.golden.json b/hscontrol/types/testdata/compat/testdata-dns-override-true.golden.json new file mode 100644 index 000000000..42a7a95ab --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-dns-override-true.golden.json @@ -0,0 +1,166 @@ +{ + "config": { + "ServerURL": "https://server.derp.no", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "$DIR/private_key.pem", + "BaseDomain": "derp2.no", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "derp2.no", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": ["1.1.1.1", "1.0.0.1"], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "derp2.no" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "1.0.0.1" + } + ], + "Domains": ["derp2.no"], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + } +} diff --git a/hscontrol/types/testdata/compat/testdata-dns_full.golden.json b/hscontrol/types/testdata/compat/testdata-dns_full.golden.json new file mode 100644 index 000000000..ac6a4f5bb --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-dns_full.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: database.type has an unsupported value\n current: database.type: \"\"\n allowed: \"sqlite\", \"sqlite3\", \"postgres\"\n hint: pick one of the allowed values; sqlite is the default for single-host deployments\n see: https://headscale.net/stable/ref/database/\n\nFatal config error: no IP prefix configured for the tailnet\n current: prefixes.v4: \"\", prefixes.v6: \"\"\n hint: set at least one of prefixes.v4 (default: \"100.64.0.0/10\") or prefixes.v6 (default: \"fd7a:115c:a1e0::/48\")\n" +} diff --git a/hscontrol/types/testdata/compat/testdata-dns_full_no_magic.golden.json b/hscontrol/types/testdata/compat/testdata-dns_full_no_magic.golden.json new file mode 100644 index 000000000..ac6a4f5bb --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-dns_full_no_magic.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: database.type has an unsupported value\n current: database.type: \"\"\n allowed: \"sqlite\", \"sqlite3\", \"postgres\"\n hint: pick one of the allowed values; sqlite is the default for single-host deployments\n see: https://headscale.net/stable/ref/database/\n\nFatal config error: no IP prefix configured for the tailnet\n current: prefixes.v4: \"\", prefixes.v6: \"\"\n hint: set at least one of prefixes.v4 (default: \"100.64.0.0/10\") or prefixes.v6 (default: \"fd7a:115c:a1e0::/48\")\n" +} diff --git a/hscontrol/types/testdata/compat/testdata-minimal.golden.json b/hscontrol/types/testdata/compat/testdata-minimal.golden.json new file mode 100644 index 000000000..a7eb8e711 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-minimal.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: dns.nameservers.global is required when dns.override_local_dns is true\n current: dns.override_local_dns: true, dns.nameservers.global: \"[]\"\n hint: list at least one upstream nameserver, or set dns.override_local_dns: false\n see: https://headscale.net/stable/ref/dns/\n\nFatal config error: database.type has an unsupported value\n current: database.type: \"\"\n allowed: \"sqlite\", \"sqlite3\", \"postgres\"\n hint: pick one of the allowed values; sqlite is the default for single-host deployments\n see: https://headscale.net/stable/ref/database/\n\nFatal config error: dns.base_domain is required when dns.magic_dns is true\n current: dns.magic_dns: true, dns.base_domain: \"\"\n hint: set dns.base_domain to a domain you control (e.g. \"ts.example.net\"), or set dns.magic_dns: false\n see: https://headscale.net/stable/ref/dns/\n\nFatal config error: no IP prefix configured for the tailnet\n current: prefixes.v4: \"\", prefixes.v6: \"\"\n hint: set at least one of prefixes.v4 (default: \"100.64.0.0/10\") or prefixes.v6 (default: \"fd7a:115c:a1e0::/48\")\n" +} diff --git a/hscontrol/types/testdata/compat/testdata-policy-path-is-loaded.golden.json b/hscontrol/types/testdata/compat/testdata-policy-path-is-loaded.golden.json new file mode 100644 index 000000000..45c67be2b --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-policy-path-is-loaded.golden.json @@ -0,0 +1,156 @@ +{ + "config": { + "ServerURL": "https://derp.no", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 120000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "$DIR/private_key.pem", + "BaseDomain": "", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 10800000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": false, + "BaseDomain": "", + "OverrideLocalDNS": false, + "Nameservers": { + "Global": [], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": {}, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": ["1.1.1.1:53", "8.8.8.8:53"], + "ProviderName": "" + }, + "UnixSocket": "/var/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": ["openid", "profile", "email"], + "ExtraParams": {}, + "AllowedDomains": null, + "AllowedUsers": null, + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "/etc/policy.hujson", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": ["configuration key \"acl_policy_path\" is deprecated; use \"policy.path\" instead"] +}