mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-19 11:57:07 +09:00
policy/v2: reject policy DERP nodes on tailscale.com like SaaS
SaaS also rejects its DERP servers' IPs; that needs its live server list. Updates #2918
This commit is contained in:
1 parent
b54570d375
commit
69e01ca7f8
13 files changed
+796
-7
No files matched your search
@@ -18,6 +18,17 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// derpMapSkipReasons lists the policies SaaS rejects for a reason headscale
|
||||
// cannot check. An entry headscale starts to reject fails, so a fix must
|
||||
// delete it.
|
||||
//
|
||||
// TAILSCALE_DERP_IPS — SaaS rejects a custom node on the IP of one of its
|
||||
// DERP servers. That takes Tailscale's live server list; the one in the
|
||||
// tailscale.com module is a stale fallback.
|
||||
var derpMapSkipReasons = map[string]string{
|
||||
"nodeattrs-derpmap-node-tailscale-ip": "TAILSCALE_DERP_IPS",
|
||||
}
|
||||
|
||||
func TestDERPMapPolicyCompat(t *testing.T) {
|
||||
files, err := filepath.Glob(filepath.Join("testdata", "nodeattrs_results", "nodeattrs-derpmap-*.hujson"))
|
||||
require.NoError(t, err)
|
||||
@@ -32,15 +43,25 @@ func TestDERPMapPolicyCompat(t *testing.T) {
|
||||
err = pol.validate()
|
||||
}
|
||||
|
||||
if reason, ok := derpMapSkipReasons[tf.TestID]; ok {
|
||||
require.NoError(t, err, "headscale refuses this policy; delete derpMapSkipReasons[%q]", tf.TestID)
|
||||
t.Skip(reason)
|
||||
}
|
||||
|
||||
if tf.Input.APIResponseCode == http.StatusOK {
|
||||
require.NoError(t, err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
msg := tf.Input.APIResponseBody.Message
|
||||
|
||||
require.Error(t, err)
|
||||
|
||||
msg := tf.Input.APIResponseBody.Message
|
||||
// SaaS names its own DERP servers by host; headscale has no list of
|
||||
// them and rejects them by their domain.
|
||||
msg = strings.Replace(msg, "Tailscale host name", "Tailscale hostname or subdomain", 1)
|
||||
|
||||
if !strings.HasPrefix(msg, "json:") {
|
||||
assert.Contains(t, err.Error(), msg)
|
||||
}
|
||||
|
||||
@@ -130,7 +130,9 @@ func parsePrefixes(t *testing.T, name string, s []string) []netip.Prefix {
|
||||
// NO_USER_ROLES — `autogroup:admin` and `autogroup:owner` depend on
|
||||
// user-role and tailnet-ownership concepts headscale does not
|
||||
// model.
|
||||
// TAILSCALE_DERP_IPS — see derpMapSkipReasons.
|
||||
var nodeAttrsSkipReasons = map[string]string{
|
||||
"nodeattrs-derpmap-node-tailscale-ip": "TAILSCALE_DERP_IPS",
|
||||
"nodeattrs-ippool-g1-admin": "IPPOOL_ALLOCATOR",
|
||||
"nodeattrs-ippool-g2-group": "IPPOOL_ALLOCATOR",
|
||||
"nodeattrs-ippool-g3-mixed": "IPPOOL_ALLOCATOR",
|
||||
|
||||
Generated
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
// nodeattrs-derpmap-node-tailscale-certname
|
||||
//
|
||||
// Policy derpMap custom node with a Tailscale CertName -- checked too?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:09:20Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-certname",
|
||||
"description": "Policy derpMap custom node with a Tailscale CertName -- checked too?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:09:20.486737469Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"error": true,
|
||||
"input": {
|
||||
"api_response_code": 400,
|
||||
"api_response_body": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale host name \"derp1h.tailscale.com\""
|
||||
},
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node with a Tailscale CertName -- checked too?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-certname\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp900.example.com\", \"CertName\": \"derp1h.tailscale.com\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-certname.hujson",
|
||||
"full_policy": {
|
||||
"derpMap": {"Regions": {"900": {"Nodes": [{
|
||||
"CertName": "derp1h.tailscale.com",
|
||||
"HostName": "derp900.example.com",
|
||||
"Name": "900a",
|
||||
"RegionID": 900
|
||||
}], "RegionCode": "custom", "RegionID": 900}}},
|
||||
"tagOwners": {"tag:server": ["odin@example.com"]}
|
||||
}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:09:30.265389738Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {
|
||||
"derpMap": {"Regions": {"900": {"Nodes": [{
|
||||
"CertName": "derp1h.tailscale.com",
|
||||
"HostName": "derp900.example.com",
|
||||
"Name": "900a",
|
||||
"RegionID": 900
|
||||
}], "RegionCode": "custom", "RegionID": 900}}},
|
||||
"tagOwners": {"tag:server": ["odin@example.com"]}
|
||||
},
|
||||
"status": 200,
|
||||
"response": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale host name \"derp1h.tailscale.com\""
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
// nodeattrs-derpmap-node-tailscale-domain
|
||||
//
|
||||
// Policy derpMap custom node host name tailscale.com itself -- rejected?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:09:34Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-domain",
|
||||
"description": "Policy derpMap custom node host name tailscale.com itself -- rejected?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:09:34.307610003Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"error": true,
|
||||
"input": {
|
||||
"api_response_code": 400,
|
||||
"api_response_body": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale hostname or subdomain \"tailscale.com\""
|
||||
},
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node host name tailscale.com itself -- rejected?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-domain\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"tailscale.com\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-domain.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:09:42.014587433Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale hostname or subdomain \"tailscale.com\""
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
hscontrol/policy/v2/testdata/nodeattrs_results/nodeattrs-derpmap-node-tailscale-hostname-case.hujson
Generated
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// nodeattrs-derpmap-node-tailscale-hostname-case
|
||||
//
|
||||
// Policy derpMap custom node with a Tailscale host name in upper case -- case-insensitive check?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:09:46Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-hostname-case",
|
||||
"description": "Policy derpMap custom node with a Tailscale host name in upper case -- case-insensitive check?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:09:46.052823974Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"input": {
|
||||
"api_response_code": 200,
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node with a Tailscale host name in upper case -- case-insensitive check?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-hostname-case\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"DERP1H.Tailscale.COM\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-hostname-case.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "DERP1H.Tailscale.COM", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:09:53.970931393Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "DERP1H.Tailscale.COM", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
// nodeattrs-derpmap-node-tailscale-hostname
|
||||
//
|
||||
// Policy derpMap custom node with a Tailscale DERP host name -- rejected?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:09:58Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-hostname",
|
||||
"description": "Policy derpMap custom node with a Tailscale DERP host name -- rejected?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:09:58.034013739Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"error": true,
|
||||
"input": {
|
||||
"api_response_code": 400,
|
||||
"api_response_body": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale host name \"derp1h.tailscale.com\""
|
||||
},
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node with a Tailscale DERP host name -- rejected?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-hostname\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp1h.tailscale.com\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-hostname.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp1h.tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:10:07.024021764Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp1h.tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale host name \"derp1h.tailscale.com\""
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// nodeattrs-derpmap-node-tailscale-io
|
||||
//
|
||||
// Policy derpMap custom node on tailscale.io -- is tailscale.io reserved too?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:12:18Z
|
||||
// tool version: tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-io",
|
||||
"description": "Policy derpMap custom node on tailscale.io -- is tailscale.io reserved too?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:12:18.198153102Z",
|
||||
"tool_version": "tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8",
|
||||
"tailnet": "odin@example.com",
|
||||
"input": {
|
||||
"api_response_code": 200,
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node on tailscale.io -- is tailscale.io reserved too?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-io\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp.tailscale.io\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-io.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.tailscale.io", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:12:25.751797661Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.tailscale.io", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
// nodeattrs-derpmap-node-tailscale-ip
|
||||
//
|
||||
// Policy derpMap custom node with a Tailscale DERP IPv4 -- checked too?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:10:11Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-ip",
|
||||
"description": "Policy derpMap custom node with a Tailscale DERP IPv4 -- checked too?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:10:11.103231592Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"error": true,
|
||||
"input": {
|
||||
"api_response_code": 400,
|
||||
"api_response_body": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale IP address \"199.38.181.93\""
|
||||
},
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node with a Tailscale DERP IPv4 -- checked too?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-ip\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp900.example.com\", \"IPv4\": \"199.38.181.93\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-ip.hujson",
|
||||
"full_policy": {
|
||||
"derpMap": {"Regions": {"900": {"Nodes": [{
|
||||
"HostName": "derp900.example.com",
|
||||
"IPv4": "199.38.181.93",
|
||||
"Name": "900a",
|
||||
"RegionID": 900
|
||||
}], "RegionCode": "custom", "RegionID": 900}}},
|
||||
"tagOwners": {"tag:server": ["odin@example.com"]}
|
||||
}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:10:19.782998905Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {
|
||||
"derpMap": {"Regions": {"900": {"Nodes": [{
|
||||
"HostName": "derp900.example.com",
|
||||
"IPv4": "199.38.181.93",
|
||||
"Name": "900a",
|
||||
"RegionID": 900
|
||||
}], "RegionCode": "custom", "RegionID": 900}}},
|
||||
"tagOwners": {"tag:server": ["odin@example.com"]}
|
||||
},
|
||||
"status": 200,
|
||||
"response": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale IP address \"199.38.181.93\""
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// nodeattrs-derpmap-node-tailscale-lookalike
|
||||
//
|
||||
// Policy derpMap custom node host name ending in tailscale.com without a dot -- accepted?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:10:23Z
|
||||
// tool version: tscap/a796688a6592161fffcf039f7772775b07f08842
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-lookalike",
|
||||
"description": "Policy derpMap custom node host name ending in tailscale.com without a dot -- accepted?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:10:23.839181078Z",
|
||||
"tool_version": "tscap/a796688a6592161fffcf039f7772775b07f08842",
|
||||
"tailnet": "odin@example.com",
|
||||
"input": {
|
||||
"api_response_code": 200,
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node host name ending in tailscale.com without a dot -- accepted?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-lookalike\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp.nottailscale.com\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-lookalike.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.nottailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:10:32.023228581Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.nottailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
// nodeattrs-derpmap-node-tailscale-subdomain
|
||||
//
|
||||
// Policy derpMap custom node on a tailscale.com subdomain that is no DERP host -- which wording?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:11:52Z
|
||||
// tool version: tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-tailscale-subdomain",
|
||||
"description": "Policy derpMap custom node on a tailscale.com subdomain that is no DERP host -- which wording?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:11:52.296113337Z",
|
||||
"tool_version": "tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8",
|
||||
"tailnet": "odin@example.com",
|
||||
"error": true,
|
||||
"input": {
|
||||
"api_response_code": 400,
|
||||
"api_response_body": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale hostname or subdomain \"foo.tailscale.com\""
|
||||
},
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node on a tailscale.com subdomain that is no DERP host -- which wording?\",\n \"id\": \"nodeattrs-derpmap-node-tailscale-subdomain\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"foo.tailscale.com\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-tailscale-subdomain.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "foo.tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:12:02.286491285Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "foo.tailscale.com", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {
|
||||
"message": "custom DERP Region 900 cannot use Tailscale hostname or subdomain \"foo.tailscale.com\""
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
Generated
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// nodeattrs-derpmap-node-ts-net
|
||||
//
|
||||
// Policy derpMap custom node on ts.net -- is ts.net reserved too?
|
||||
//
|
||||
// Steps: 1
|
||||
// Captured at: 2026-11-04T21:12:06Z
|
||||
// tool version: tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8
|
||||
// schema version: 1
|
||||
{
|
||||
"schema_version": 1,
|
||||
"test_id": "nodeattrs-derpmap-node-ts-net",
|
||||
"description": "Policy derpMap custom node on ts.net -- is ts.net reserved too?",
|
||||
"category": "nodeattrs",
|
||||
"captured_at": "2026-11-04T21:12:06.326246353Z",
|
||||
"tool_version": "tscap/9b5baac1f1e8ab33896273893a21d7312d2d6dc8",
|
||||
"tailnet": "odin@example.com",
|
||||
"input": {
|
||||
"api_response_code": 200,
|
||||
"tailnet": {
|
||||
"dns": {"magic_dns": false, "nameservers": [], "search_paths": [], "split_dns": {}},
|
||||
"settings": {}
|
||||
},
|
||||
"scenario_hujson": " \n{\n \"category\": \"nodeattrs\",\n \"description\": \"Policy derpMap custom node on ts.net -- is ts.net reserved too?\",\n \"id\": \"nodeattrs-derpmap-node-ts-net\",\n \"options\": {\"capture\": \"none\"},\n \"policy\": {\n \"tagOwners\": {\"tag:server\": [\"odin@example.com\"]},\n \"derpMap\": {\"Regions\": {\"900\": {\"RegionID\": 900, \"RegionCode\": \"custom\", \"Nodes\": [{\"Name\": \"900a\", \"RegionID\": 900, \"HostName\": \"derp.ts.net\"}]}}}\n },\n \"tailnet\": {\n \"dns\": {\"magic_dns\": false, \"nameservers\": [], \"search_paths\": [], \"split_dns\": {}},\n \"settings\": {}\n },\n \"topology\": \"../_topologies/dns.hujson\"\n}\n",
|
||||
"scenario_path": "scenarios/nodeattrs/nodeattrs-derpmap-node-ts-net.hujson",
|
||||
"full_policy": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.ts.net", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}}
|
||||
},
|
||||
"topology": {"users": [
|
||||
{"id": 1, "name": "odin", "email": "odin@example.com"},
|
||||
{"id": 2, "name": "thor", "email": "thor@example.org"}
|
||||
], "nodes": {"ivysaur": {
|
||||
"hostname": "ivysaur",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.2",
|
||||
"ipv6": "fd7a:115c:a1e0::2",
|
||||
"user": "thor",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "server": {
|
||||
"hostname": "server",
|
||||
"tags": ["tag:server"],
|
||||
"ipv4": "100.81.7.3",
|
||||
"ipv6": "fd7a:115c:a1e0::3",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}, "user-tid": {
|
||||
"hostname": "user-tid",
|
||||
"tags": [],
|
||||
"ipv4": "100.81.7.1",
|
||||
"ipv6": "fd7a:115c:a1e0::1",
|
||||
"user": "odin",
|
||||
"routable_ips": [],
|
||||
"approved_routes": []
|
||||
}}},
|
||||
"captures": {},
|
||||
"steps": [{
|
||||
"name": "validate",
|
||||
"at": "2026-11-04T21:12:14.158947157Z",
|
||||
"result": "observed",
|
||||
"actions": [{
|
||||
"kind": "api",
|
||||
"principal": "admin",
|
||||
"method": "POST",
|
||||
"path": "/tailnet/-/acl/validate",
|
||||
"header": {"Content-Type": "application/hujson"},
|
||||
"body": {"derpMap": {"Regions": {"900": {
|
||||
"Nodes": [{"HostName": "derp.ts.net", "Name": "900a", "RegionID": 900}],
|
||||
"RegionCode": "custom",
|
||||
"RegionID": 900
|
||||
}}}, "tagOwners": {"tag:server": ["odin@example.com"]}},
|
||||
"status": 200,
|
||||
"response": {}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
@@ -200,6 +200,7 @@ var (
|
||||
ErrDERPRegionNoNodes = errors.New("must specify at least one node in DERP Region")
|
||||
ErrDERPRegionNullNode = errors.New("null node in DERP Region")
|
||||
ErrDERPNodeRegionID = errors.New("doesn't match its region")
|
||||
ErrDERPTailscaleName = errors.New("cannot use Tailscale hostname or subdomain")
|
||||
ErrDERPOmitDefaultsNoRegions = errors.New("OmitDefaultRegions specified but no custom DERP regions specified")
|
||||
ErrProtocolNoSpecificPorts = errors.New("protocol does not support specific ports")
|
||||
ErrTestEmptyAssertions = errors.New("test entry must have at least one of \"accept\" or \"deny\"")
|
||||
@@ -3492,9 +3493,10 @@ func validateProtocolPortCompatibility(protocol Protocol, destinations []AliasWi
|
||||
}
|
||||
|
||||
// validateDERPMap checks a policy derpMap the way Tailscale SaaS does, with
|
||||
// its wording: an added region uses an ID in 900-999, has a node, and every
|
||||
// ID in it matches the key it sits under. A null region only removes one, so
|
||||
// it is not checked. HomeParams are decoded but never sent, as on SaaS.
|
||||
// its wording: an added region uses an ID in 900-999, has a node, every ID in
|
||||
// it matches the key it sits under, and no node is on tailscale.com. A null
|
||||
// region only removes one, so it is not checked. HomeParams are decoded but
|
||||
// never sent, as on SaaS.
|
||||
func validateDERPMap(dm *tailcfg.DERPMap) []error {
|
||||
if dm == nil {
|
||||
return nil
|
||||
@@ -3529,14 +3531,27 @@ func validateDERPMap(dm *tailcfg.DERPMap) []error {
|
||||
}
|
||||
|
||||
for _, node := range region.Nodes {
|
||||
switch {
|
||||
case node == nil:
|
||||
if node == nil {
|
||||
errs = append(errs, fmt.Errorf("%w %d", ErrDERPRegionNullNode, id))
|
||||
case node.RegionID != id:
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if node.RegionID != id {
|
||||
errs = append(errs, fmt.Errorf(
|
||||
"custom DERP Region %d has node %q with RegionID %d that %w",
|
||||
id, node.Name, node.RegionID, ErrDERPNodeRegionID))
|
||||
}
|
||||
|
||||
// SaaS keeps custom regions off Tailscale's own servers. It also
|
||||
// rejects their IPs, which takes a live list of them.
|
||||
for _, name := range []string{node.HostName, node.CertName} {
|
||||
if name == "tailscale.com" || strings.HasSuffix(name, ".tailscale.com") {
|
||||
errs = append(errs, fmt.Errorf("custom DERP Region %d %w %q", id, ErrDERPTailscaleName, name))
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,11 +319,14 @@ var rejectedPolicySkipReasons = map[string]string{
|
||||
|
||||
"routes-exit-family-ipv4/refused": aclDefaultRouteAccepted,
|
||||
"routes-exit-family-ipv6/refused": aclDefaultRouteAccepted,
|
||||
|
||||
"nodeattrs-derpmap-node-tailscale-ip/refused": tailscaleDERPIPs,
|
||||
}
|
||||
|
||||
const (
|
||||
noTailnetDomains = "NO_TAILNET_DOMAINS: headscale does not check user:*@domain or localpart:*@domain against the tailnet's domains"
|
||||
aclDefaultRouteAccepted = "ACL_DEFAULT_ROUTE_ACCEPTED: headscale accepts literal 0.0.0.0/0 and ::/0 ACL destinations; SaaS rejects them and requires * or autogroup:internet"
|
||||
tailscaleDERPIPs = "TAILSCALE_DERP_IPS: SaaS refuses a policy derpMap node on a Tailscale DERP server's IP; that takes its live server list"
|
||||
)
|
||||
|
||||
// TestRejectedPolicyLeavesLivePolicyCompat posts every policy SaaS refused to
|
||||
|
||||
Reference in new issue
Block a user