From 443f3a0ecd76e9697eb01bd09a616340963e0b79 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sat, 7 Nov 2026 20:07:02 +0000 Subject: [PATCH] types: pin effective config of shipped examples Updates #1926 --- hscontrol/types/config_test.go | 200 ++++++++++++++ .../compat/bad-policy-mode.golden.json | 3 + .../testdata/compat/bad-values.golden.json | 170 ++++++++++++ .../types/testdata/compat/env-cli.golden.json | 161 +++++++++++ .../testdata/compat/env-empty.golden.json | 176 ++++++++++++ .../compat/env-extra-records.golden.json | 6 + .../compat/env-legacy-ignored.golden.json | 168 ++++++++++++ .../compat/env-legacy-removed.golden.json | 6 + .../compat/env-lists-maps.golden.json | 197 ++++++++++++++ .../testdata/compat/env-only.golden.json | 165 ++++++++++++ .../compat/env-precedence.golden.json | 181 +++++++++++++ .../testdata/compat/env-secrets.golden.json | 170 ++++++++++++ .../testdata/compat/env-shapes.golden.json | 217 +++++++++++++++ .../testdata/compat/example-main.golden.json | 200 ++++++++++++++ .../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 | 203 ++++++++++++++ .../compat/example-v0.29.7.golden.json | 203 ++++++++++++++ .../compat/file-everything.golden.json | 253 ++++++++++++++++++ .../testdata/compat/hsic-default.golden.json | 181 +++++++++++++ .../testdata/compat/hsic-postgres.golden.json | 184 +++++++++++++ .../testdata/compat/nixos-cli.golden.json | 155 +++++++++++ .../testdata/compat/nixos-example.golden.json | 192 +++++++++++++ .../testdata/compat/nixos-nixpkgs.golden.json | 188 +++++++++++++ ...data-base-domain-in-server-url.golden.json | 3 + ...-base-domain-not-in-server-url.golden.json | 167 ++++++++++++ ...stdata-dns-override-true-error.golden.json | 3 + .../testdata-dns-override-true.golden.json | 178 ++++++++++++ .../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 | 165 ++++++++++++ 36 files changed, 4146 insertions(+) create mode 100644 hscontrol/types/testdata/compat/bad-policy-mode.golden.json create mode 100644 hscontrol/types/testdata/compat/bad-values.golden.json create mode 100644 hscontrol/types/testdata/compat/env-cli.golden.json create mode 100644 hscontrol/types/testdata/compat/env-empty.golden.json create mode 100644 hscontrol/types/testdata/compat/env-extra-records.golden.json create mode 100644 hscontrol/types/testdata/compat/env-legacy-ignored.golden.json create mode 100644 hscontrol/types/testdata/compat/env-legacy-removed.golden.json 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-precedence.golden.json create mode 100644 hscontrol/types/testdata/compat/env-secrets.golden.json create mode 100644 hscontrol/types/testdata/compat/env-shapes.golden.json create mode 100644 hscontrol/types/testdata/compat/example-main.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/file-everything.golden.json create mode 100644 hscontrol/types/testdata/compat/hsic-default.golden.json create mode 100644 hscontrol/types/testdata/compat/hsic-postgres.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/nixos-nixpkgs.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/config_test.go b/hscontrol/types/config_test.go index c967b2cb6..b4b89a93f 100644 --- a/hscontrol/types/config_test.go +++ b/hscontrol/types/config_test.go @@ -8,6 +8,7 @@ import ( "go/parser" "go/token" "io/fs" + "maps" "net/netip" "net/url" "os" @@ -1850,6 +1851,205 @@ func TestDNSDomainsCompat(t *testing.T) { } } +// compatRecord is the golden for one config input: what the loader produced. +type compatRecord struct { + Config json.RawMessage `json:"config,omitempty"` + Secrets map[string]string `json:"secrets,omitempty"` // secret strings the JSON form hides + Warnings []string `json:"warnings,omitempty"` + LogErrors []string `json:"log_errors,omitempty"` // input the loader logged and dropped + Error string `json:"error,omitempty"` // an error-only golden pins today's rejection +} + +// TestConfigCompat pins what real-world config inputs load to, so a loader +// change shows up as a golden diff, and each such diff needs a BREAKING +// CHANGELOG entry. Every compat/.{yaml,json,env} set is one row; a name +// ending in -cli uses the CLI loader. Fixtures are frozen inputs: to change +// one, add a new fixture. Refresh with HEADSCALE_UPDATE_GOLDEN=1. +// +// Sources: example-.yaml is `git show :config-example.yaml`; +// example-main.yaml is a frozen copy of the root file; nixos-*.yaml are the +// files `nix build` writes for the flake module with nix/example-configuration.nix +// (services.headscale.configFile, environment.etc."headscale/config.yaml") and +// for the nixpkgs module with only server_url, dns.base_domain and +// dns.nameservers.global set; hsic-* mirror integration/hsic's +// MinimumConfigYAML and DefaultConfigEnv. +func TestConfigCompat(t *testing.T) { + type row struct{ name, file, envFile string } + + compatDir := filepath.Join("testdata", "compat") + + entries, err := os.ReadDir(compatDir) + require.NoError(t, err) + + var rows []*row + + byName := map[string]*row{} + + for _, e := range entries { + f, ext := e.Name(), filepath.Ext(e.Name()) + if strings.HasSuffix(f, ".golden.json") || (ext != ".yaml" && ext != ".json" && ext != ".env") { + continue + } + + name := strings.TrimSuffix(f, ext) + if byName[name] == nil { + byName[name] = &row{name: name} + rows = append(rows, byName[name]) + } + + if ext == ".env" { + byName[name].envFile = filepath.Join(compatDir, f) + } else { + byName[name].file = filepath.Join(compatDir, f) + } + } + + legacy, err := filepath.Glob(filepath.Join("testdata", "*.yaml")) + require.NoError(t, err) + + for _, f := range legacy { + rows = append(rows, &row{name: "testdata-" + strings.TrimSuffix(filepath.Base(f), ".yaml"), file: f}) + } + + update := os.Getenv("HEADSCALE_UPDATE_GOLDEN") != "" + + // Ambient HEADSCALE_* would leak into the goldens. + for _, kv := range os.Environ() { + if k, _, _ := strings.Cut(kv, "="); strings.HasPrefix(k, "HEADSCALE_") { + t.Setenv(k, "") // registers the restore + require.NoError(t, os.Unsetenv(k)) + } + } + + for _, tt := range rows { + t.Run(tt.name, func(t *testing.T) { + rec := loadCompat(t, tt.file, tt.envFile, strings.HasSuffix(tt.name, "-cli")) + + out, err := json.MarshalIndent(rec, "", " ") + require.NoError(t, err) + + out = append(out, '\n') + gpath := filepath.Join(compatDir, tt.name+".golden.json") + + if update { + require.NoError(t, os.WriteFile(gpath, out, 0o600)) + + return + } + + want, err := os.ReadFile(gpath) + require.NoErrorf(t, err, "missing golden %s: run with HEADSCALE_UPDATE_GOLDEN=1", gpath) + + if d := cmp.Diff(string(want), string(out)); d != "" { + t.Errorf("config compat mismatch (-golden +got):\n%s", d) + } + }) + } +} + +// loadCompat loads one fixture set the way headscale does, from a temp dir +// so relative paths and the error text do not depend on the checkout. +func loadCompat(t *testing.T, file, envFile string, cli bool) compatRecord { + t.Helper() + + viper.Reset() + t.Cleanup(viper.Reset) + + dir := t.TempDir() + + if file != "" { + data, err := os.ReadFile(file) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(dir, "config"+filepath.Ext(file)), data, 0o600)) //nolint:gosec // dir is t.TempDir() + } + + if envFile != "" { + raw, err := os.ReadFile(envFile) + require.NoError(t, err) + + // docker --env-file syntax: no quoting, # comments. + for line := range strings.SplitSeq(string(raw), "\n") { + line = strings.TrimSpace(line) + if line == "" || strings.HasPrefix(line, "#") { + continue + } + + k, v, ok := strings.Cut(line, "=") + require.Truef(t, ok, "%s: %q is not KEY=VALUE", envFile, line) + t.Setenv(k, v) + } + } + + var buf bytes.Buffer + + oldLogger, oldLevel := log.Logger, zerolog.GlobalLevel() + log.Logger = zerolog.New(&buf) + + // Tests run at ErrorLevel (testlog.go); the loaders then set the level + // from log.level, as in production. + zerolog.SetGlobalLevel(zerolog.TraceLevel) + t.Cleanup(func() { + log.Logger = oldLogger + + zerolog.SetGlobalLevel(oldLevel) + }) + + var cfg *Config + + err := LoadConfig(dir, false) + if err == nil { + if cli { + cfg, err = LoadCLIConfig() + } else { + cfg, err = LoadServerConfig() + } + } + + norm := func(s string) string { return strings.ReplaceAll(s, dir, "$DIR") } + + var rec compatRecord + + for line := range strings.SplitSeq(buf.String(), "\n") { + if line == "" { + continue + } + + var entry struct{ Level, Message string } + + require.NoError(t, json.Unmarshal([]byte(line), &entry)) + + switch entry.Level { + case zerolog.LevelWarnValue: + rec.Warnings = append(rec.Warnings, norm(entry.Message)) + case zerolog.LevelErrorValue: + rec.LogErrors = append(rec.LogErrors, norm(entry.Message)) + } + } + + if err != nil { + rec.Error = norm(err.Error()) + } + + if cfg != nil { + if cfg.Tuning.BatcherWorkers == DefaultBatcherWorkers() { + cfg.Tuning.BatcherWorkers = 0 // depends on runtime.NumCPU + } + + raw, err := json.Marshal(cfg) + require.NoError(t, err) + + rec.Config = json.RawMessage(norm(string(raw))) + rec.Secrets = map[string]string{ + "database.postgres.pass": cfg.Database.Postgres.Pass, + "oidc.client_secret": cfg.OIDC.ClientSecret, + "cli.api_key": cfg.CLI.APIKey, + } + maps.DeleteFunc(rec.Secrets, func(_, v string) bool { return v == "" }) + } + + return rec +} + func TestDERPServerPrivateKeyPath(t *testing.T) { tests := []struct { name string diff --git a/hscontrol/types/testdata/compat/bad-policy-mode.golden.json b/hscontrol/types/testdata/compat/bad-policy-mode.golden.json new file mode 100644 index 000000000..edde87c38 --- /dev/null +++ b/hscontrol/types/testdata/compat/bad-policy-mode.golden.json @@ -0,0 +1,3 @@ +{ + "error": "Fatal config error: policy.mode has an unsupported value\n current: policy.mode: \"databse\"\n allowed: \"file\", \"database\"\n see: https://headscale.net/stable/ref/policy/\n" +} diff --git a/hscontrol/types/testdata/compat/bad-values.golden.json b/hscontrol/types/testdata/compat/bad-values.golden.json new file mode 100644 index 000000000..895ff7aac --- /dev/null +++ b/hscontrol/types/testdata/compat/bad-values.golden.json @@ -0,0 +1,170 @@ +{ + "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": "10.0.0.0/8", + "PrefixV6": null, + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise.key", + "BaseDomain": "", + "Log": { + "Format": "", + "Level": "debug" + }, + "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": 0, + "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", + "\n################################################################\n### __ __ _ _ ###\n### \\ \\ / / (_) | | ###\n### \\ \\ /\\ / /_ _ _ __ _ __ _ _ __ __ _| | ###\n### \\ \\/ \\/ / _` | '__| '_ \\| | '_ \\ / _` | | ###\n### \\ /\\ / (_| | | | | | | | | | | (_| |_| ###\n### \\/ \\/ \\__,_|_| |_| |_|_|_| |_|\\__, (_) ###\n### __/ | ###\n### |___/ ###\n################################################################\n### ###\n### You have overridden the default Headscale IP prefixes ###\n### with a range outside of the standard CGNAT and/or ULA ###\n### ranges. This is NOT a supported configuration. ###\n### ###\n### Using subsets of the default ranges (100.64.0.0/10 for ###\n### IPv4, fd7a:115c:a1e0::/48 for IPv6) is fine. Using ###\n### ranges outside of these will cause undefined behaviour ###\n### as the Tailscale client is NOT designed to operate on ###\n### any other ranges. ###\n### ###\n### Please revert your prefixes to subsets of the standard ###\n### ranges as described in the example configuration. ###\n### ###\n### Any issue raised using a range outside of the ###\n### supported range will be labelled as wontfix ###\n### and closed. ###\n### ###\n################################################################" + ], + "log_errors": [ + "Could not parse log format: xml. Valid choices are 'json' or 'text'", + "Failed to parse url, ignoring..." + ] +} diff --git a/hscontrol/types/testdata/compat/env-cli.golden.json b/hscontrol/types/testdata/compat/env-cli.golden.json new file mode 100644 index 000000000..aa849c454 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-cli.golden.json @@ -0,0 +1,161 @@ +{ + "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": false, + "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": "/var/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": "headscale.example.com:443", + "Timeout": 10000000000, + "Insecure": true + }, + "Policy": { + "Path": "", + "Mode": "" + }, + "Tuning": { + "NotifierSendTimeout": 0, + "BatchChangeDelay": 0, + "NodeMapSessionBufferedChanSize": 0, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 0, + "NodeStoreBatchTimeout": 0 + } + }, + "secrets": { + "cli.api_key": "marker-cli-api-key" + }, + "warnings": [ + "no config file found, using defaults" + ] +} diff --git a/hscontrol/types/testdata/compat/env-empty.golden.json b/hscontrol/types/testdata/compat/env-empty.golden.json new file mode 100644 index 000000000..4835b1baa --- /dev/null +++ b/hscontrol/types/testdata/compat/env-empty.golden.json @@ -0,0 +1,176 @@ +{ + "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": "debug" + }, + "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": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "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/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/env-extra-records.golden.json b/hscontrol/types/testdata/compat/env-extra-records.golden.json new file mode 100644 index 000000000..47580f7f0 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-extra-records.golden.json @@ -0,0 +1,6 @@ +{ + "warnings": [ + "no config file found, using defaults" + ], + "error": "Fatal config error: dns.extra_records cannot be parsed\n current: dns.extra_records: \"\u003cinline records\u003e\"\n why: unmarshalling dns extra records: decoding failed due to the following error(s):\n\n'[0]' expected a map or struct, got \"string\"\n'[1]' expected a map or struct, got \"string\"\n'[2]' expected a map or struct, got \"string\"\n hint: check the YAML syntax; see config-example.yaml for the expected shape\n" +} diff --git a/hscontrol/types/testdata/compat/env-legacy-ignored.golden.json b/hscontrol/types/testdata/compat/env-legacy-ignored.golden.json new file mode 100644 index 000000000..f9d1da521 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-legacy-ignored.golden.json @@ -0,0 +1,168 @@ +{ + "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": "/etc/headscale/tls.crt", + "KeyPath": "/etc/headscale/tls.key", + "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", + "configuration key \"dns_config.magic_dns\" is deprecated; use \"dns.magic_dns\" instead", + "configuration key \"ephemeral_node_inactivity_timeout\" is deprecated; use \"node.ephemeral.inactivity_timeout\" instead", + "configuration key \"database.gorm.prepare_stmt\" is ignored" + ] +} diff --git a/hscontrol/types/testdata/compat/env-legacy-removed.golden.json b/hscontrol/types/testdata/compat/env-legacy-removed.golden.json new file mode 100644 index 000000000..4bad80b8d --- /dev/null +++ b/hscontrol/types/testdata/compat/env-legacy-removed.golden.json @@ -0,0 +1,6 @@ +{ + "warnings": [ + "no config file found, using defaults" + ], + "error": "Fatal config error: configuration key acl_policy_path has been removed; use policy.path instead\n current: acl_policy_path: \"/etc/headscale/acl.hujson\"\n hint: remove acl_policy_path and set policy.path\n\nFatal config error: configuration key randomize_client_port has been removed\n current: randomize_client_port: \"true\"\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\nFatal config error: configuration key oidc.expiry has been removed; use node.expiry instead\n current: oidc.expiry: \"1d\"\n hint: remove oidc.expiry and set node.expiry\n" +} 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..b09dd58e0 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-lists-maps.golden.json @@ -0,0 +1,197 @@ +{ + "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..0ed6680ea --- /dev/null +++ b/hscontrol/types/testdata/compat/env-only.golden.json @@ -0,0 +1,165 @@ +{ + "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-precedence.golden.json b/hscontrol/types/testdata/compat/env-precedence.golden.json new file mode 100644 index 000000000..f6ee3b970 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-precedence.golden.json @@ -0,0 +1,181 @@ +{ + "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": "warn" + }, + "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": { + "b.example.com": [ + "10.0.0.2" + ] + } + }, + "SearchDomains": [ + "y.example.com" + ], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": { + "Routes": { + "b.example.com": [ + { + "Addr": "10.0.0.2" + } + ] + }, + "Domains": [ + "y.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": { + "c": "d" + }, + "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/env-secrets.golden.json b/hscontrol/types/testdata/compat/env-secrets.golden.json new file mode 100644 index 000000000..16ddcce7e --- /dev/null +++ b/hscontrol/types/testdata/compat/env-secrets.golden.json @@ -0,0 +1,170 @@ +{ + "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/env-shapes.golden.json b/hscontrol/types/testdata/compat/env-shapes.golden.json new file mode 100644 index 000000000..3515feed3 --- /dev/null +++ b/hscontrol/types/testdata/compat/env-shapes.golden.json @@ -0,0 +1,217 @@ +{ + "config": { + "ServerURL": "https://hs.example.com", + "Addr": "", + "MetricsAddr": "", + "TrustedProxies": [ + "10.0.0.0/8", + "192.168.0.0/16" + ], + "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": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "a.example.com", + "Path": "/derp.json", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + }, + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "b.example.com", + "Path": "/derp.json", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": null, + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 30, + "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": {} + }, + "SearchDomains": [ + "[\"a.example.com\",\"b.example.com\"]" + ], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "" + } + }, + "TailcfgDNSConfig": { + "FallbackResolvers": [ + { + "Addr": "1.1.1.1,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": 448, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": [ + "openid", + "profile", + "email" + ], + "ExtraParams": { + "Domain_Hint": "env", + "n": "" + }, + "AllowedDomains": [ + "[\"example.com\"]" + ], + "AllowedUsers": null, + "AllowedGroups": [ + "a", + "b" + ], + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": false + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "NotifierSendTimeout": 800000000, + "BatchChangeDelay": 800, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 0, + "RegisterCacheMaxEntries": 0, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + }, + "warnings": [ + "no config file found, using defaults", + "failed to parse node.expiry, defaulting to no expiry" + ] +} diff --git a/hscontrol/types/testdata/compat/example-main.golden.json b/hscontrol/types/testdata/compat/example-main.golden.json new file mode 100644 index 000000000..0b3446dc0 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-main.golden.json @@ -0,0 +1,200 @@ +{ + "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 + } + } +} 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..b69daede8 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.29.0.golden.json @@ -0,0 +1,203 @@ +{ + "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..b69daede8 --- /dev/null +++ b/hscontrol/types/testdata/compat/example-v0.29.7.golden.json @@ -0,0 +1,203 @@ +{ + "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/file-everything.golden.json b/hscontrol/types/testdata/compat/file-everything.golden.json new file mode 100644 index 000000000..c535af103 --- /dev/null +++ b/hscontrol/types/testdata/compat/file-everything.golden.json @@ -0,0 +1,253 @@ +{ + "config": { + "ServerURL": "https://headscale.example.com", + "Addr": "0.0.0.0:8443", + "MetricsAddr": "127.0.0.1:9091", + "TrustedProxies": [ + "10.0.0.0/8", + "192.168.0.0/16" + ], + "Node": { + "Expiry": 7776000000000000, + "Ephemeral": { + "InactivityTimeout": 2700000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 20000000000, + "ProbeTimeout": 7000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 259200000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "random", + "NoisePrivateKeyPath": "$DIR/noise_private.key", + "BaseDomain": "tailnet.example.net", + "Log": { + "Format": "json", + "Level": "debug" + }, + "DisableUpdateCheck": false, + "Database": { + "Type": "postgres", + "Debug": true, + "Gorm": { + "Debug": true, + "SlowThreshold": 2000000000, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": true + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "db.example.com", + "Port": 5433, + "Name": "headscale", + "User": "headscale", + "Ssl": "true", + "MaxOpenConnections": 20, + "MaxIdleConnections": 5, + "ConnMaxIdleTimeSecs": 1800 + } + }, + "DERP": { + "ServerEnabled": true, + "AutomaticallyAddEmbeddedDerpRegion": false, + "ServerRegionID": 900, + "ServerRegionCode": "hs", + "ServerRegionName": "Headscale Embedded DERP", + "ServerPrivateKeyPath": "$DIR/derp_server_private.key", + "ServerVerifyClients": false, + "STUNAddr": "0.0.0.0:3479", + "URLs": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + }, + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "derp.example.com", + "Path": "/map.json", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": [ + "/etc/headscale/derp.yaml" + ], + "DERPMap": null, + "AutoUpdate": false, + "UpdateFrequency": 3600000000000, + "IPv4": "198.51.100.1", + "IPv6": "2001:db8::1" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "headscale.example.com", + "ChallengeType": "TLS-ALPN-01", + "HTTPListen": ":8081", + "URL": "https://acme-staging-v02.api.letsencrypt.org/directory", + "Email": "admin@example.com", + "CacheDir": "$DIR/acme-cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "tailnet.example.net", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": [ + "1.1.1.1", + "https://dns.nextdns.io/abc123" + ], + "Split": { + "corp.example.com": [ + "10.0.0.1" + ] + } + }, + "SearchDomains": [ + "corp.example.com" + ], + "ExtraRecords": [ + { + "Name": "grafana.tailnet.example.net", + "Type": "A", + "Value": "100.64.0.3" + } + ], + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "tailnet.example.net" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "https://dns.nextdns.io/abc123" + } + ], + "Routes": { + "corp.example.com": [ + { + "Addr": "10.0.0.1" + } + ] + }, + "Domains": [ + "tailnet.example.net", + "corp.example.com" + ], + "Proxied": true, + "ExtraRecords": [ + { + "Name": "grafana.tailnet.example.net", + "Type": "A", + "Value": "100.64.0.3" + } + ] + }, + "DNSChallenge": { + "PropagationTimeout": 180000000000, + "Resolvers": [ + "9.9.9.9:53" + ], + "ProviderName": "" + }, + "UnixSocket": "/run/headscale/headscale.sock", + "UnixSocketPermission": 448, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": false, + "Issuer": "https://idp.example.com", + "ClientID": "headscale", + "Scope": [ + "openid", + "profile", + "email", + "groups" + ], + "ExtraParams": { + "login_hint": "file" + }, + "AllowedDomains": [ + "example.com" + ], + "AllowedUsers": [ + "alice@example.com" + ], + "AllowedGroups": [ + "/headscale" + ], + "EmailVerifiedRequired": false, + "UseExpiryFromToken": true, + "PKCE": { + "Enabled": true, + "Method": "plain" + } + }, + "LogTail": { + "Enabled": true + }, + "Taildrop": { + "Enabled": false + }, + "AutoUpdate": { + "Enabled": true + }, + "CLI": { + "Address": "headscale.example.com:443", + "Timeout": 15000000000, + "Insecure": true + }, + "Policy": { + "Path": "", + "Mode": "database" + }, + "Tuning": { + "NotifierSendTimeout": 1000000000, + "BatchChangeDelay": 500000000, + "NodeMapSessionBufferedChanSize": 50, + "BatcherWorkers": 4096, + "RegisterCacheExpiration": 1200000000000, + "RegisterCacheMaxEntries": 2000, + "NodeStoreBatchSize": 50, + "NodeStoreBatchTimeout": 250000000 + } + }, + "secrets": { + "cli.api_key": "marker-cli-api-key", + "database.postgres.pass": "marker-postgres-pass", + "oidc.client_secret": "marker-oidc-secret-from-file" + }, + "warnings": [ + "Warning: when using tls.acme.hostname with TLS-ALPN-01 as challenge type, headscale must be reachable on port 443, i.e. listen_addr should probably end in :443" + ] +} 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..13da97338 --- /dev/null +++ b/hscontrol/types/testdata/compat/hsic-default.golden.json @@ -0,0 +1,181 @@ +{ + "config": { + "ServerURL": "http://hs-compat:8080", + "Addr": "0.0.0.0:8080", + "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/hsic-postgres.golden.json b/hscontrol/types/testdata/compat/hsic-postgres.golden.json new file mode 100644 index 000000000..97687d87e --- /dev/null +++ b/hscontrol/types/testdata/compat/hsic-postgres.golden.json @@ -0,0 +1,184 @@ +{ + "config": { + "ServerURL": "http://hs-compat:8080", + "Addr": "0.0.0.0:8080", + "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": "postgres", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 1000000, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "postgres-compat", + "Port": 0, + "Name": "headscale", + "User": "headscale", + "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 + } + }, + "secrets": { + "database.postgres.pass": "headscale" + }, + "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..628882097 --- /dev/null +++ b/hscontrol/types/testdata/compat/nixos-example.golden.json @@ -0,0 +1,192 @@ +{ + "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/nixos-nixpkgs.golden.json b/hscontrol/types/testdata/compat/nixos-nixpkgs.golden.json new file mode 100644 index 000000000..2a76d347f --- /dev/null +++ b/hscontrol/types/testdata/compat/nixos-nixpkgs.golden.json @@ -0,0 +1,188 @@ +{ + "config": { + "ServerURL": "https://headscale.example.com", + "Addr": "127.0.0.1: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" + ], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "tailnet.example.com" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + } + ], + "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": "", + "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..06a531337 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-base-domain-not-in-server-url.golden.json @@ -0,0 +1,167 @@ +{ + "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..98a8d8c52 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-dns-override-true.golden.json @@ -0,0 +1,178 @@ +{ + "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..24cefeb87 --- /dev/null +++ b/hscontrol/types/testdata/compat/testdata-policy-path-is-loaded.golden.json @@ -0,0 +1,165 @@ +{ + "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" + ] +}