mirror of
https://github.com/juanfont/headscale.git
synced 2025-05-09 01:20:34 +02:00
ensure final dot on node name
This ensures that nodes which have a base domain set, will have a dot appended to their FQDN. Resolves: https://github.com/juanfont/headscale/issues/2501
This commit is contained in:
parent
0d3134720b
commit
0e86c29f49
@ -87,7 +87,11 @@ The new policy can be used by setting the environment variable
|
||||
[#2493](https://github.com/juanfont/headscale/pull/2493)
|
||||
- If a OIDC provider doesn't include the `email_verified` claim in its ID
|
||||
tokens, Headscale will attempt to get it from the UserInfo endpoint.
|
||||
- Improve performance by only querying relevant nodes from the database for node updates [#2509](https://github.com/juanfont/headscale/pull/2509)
|
||||
- Improve performance by only querying relevant nodes from the database for node
|
||||
updates [#2509](https://github.com/juanfont/headscale/pull/2509)
|
||||
- node FQDNs in the netmap will now contain a dot (".") at the end. This aligns
|
||||
with behaviour of tailscale.com
|
||||
[#2503](https://github.com/juanfont/headscale/pull/2503)
|
||||
|
||||
## 0.25.1 (2025-02-25)
|
||||
|
||||
|
@ -169,6 +169,32 @@ func TestTailNode(t *testing.T) {
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "check-dot-suffix-on-node-name",
|
||||
node: &types.Node{
|
||||
GivenName: "minimal",
|
||||
Hostinfo: &tailcfg.Hostinfo{},
|
||||
},
|
||||
dnsConfig: &tailcfg.DNSConfig{},
|
||||
baseDomain: "example.com",
|
||||
want: &tailcfg.Node{
|
||||
// a node name should have a dot appended
|
||||
Name: "minimal.example.com.",
|
||||
StableID: "0",
|
||||
HomeDERP: 0,
|
||||
LegacyDERPString: "127.3.3.40:0",
|
||||
Hostinfo: hiview(tailcfg.Hostinfo{}),
|
||||
Tags: []string{},
|
||||
MachineAuthorized: true,
|
||||
|
||||
CapMap: tailcfg.NodeCapMap{
|
||||
tailcfg.CapabilityFileSharing: []tailcfg.RawMessage{},
|
||||
tailcfg.CapabilityAdmin: []tailcfg.RawMessage{},
|
||||
tailcfg.CapabilitySSH: []tailcfg.RawMessage{},
|
||||
},
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
// TODO: Add tests to check other aspects of the node conversion:
|
||||
// - With tags and policy
|
||||
// - dnsconfig and basedomain
|
||||
|
@ -364,7 +364,7 @@ func (node *Node) GetFQDN(baseDomain string) (string, error) {
|
||||
|
||||
if baseDomain != "" {
|
||||
hostname = fmt.Sprintf(
|
||||
"%s.%s",
|
||||
"%s.%s.",
|
||||
node.GivenName,
|
||||
baseDomain,
|
||||
)
|
||||
|
@ -142,7 +142,7 @@ func TestNodeFQDN(t *testing.T) {
|
||||
},
|
||||
},
|
||||
domain: "example.com",
|
||||
want: "test.example.com",
|
||||
want: "test.example.com.",
|
||||
},
|
||||
{
|
||||
name: "all-set",
|
||||
@ -153,7 +153,7 @@ func TestNodeFQDN(t *testing.T) {
|
||||
},
|
||||
},
|
||||
domain: "example.com",
|
||||
want: "test.example.com",
|
||||
want: "test.example.com.",
|
||||
},
|
||||
{
|
||||
name: "no-given-name",
|
||||
@ -171,7 +171,7 @@ func TestNodeFQDN(t *testing.T) {
|
||||
GivenName: strings.Repeat("a", 256),
|
||||
},
|
||||
domain: "example.com",
|
||||
wantErr: fmt.Sprintf("failed to create valid FQDN (%s.example.com): hostname too long, cannot except 255 ASCII chars", strings.Repeat("a", 256)),
|
||||
wantErr: fmt.Sprintf("failed to create valid FQDN (%s.example.com.): hostname too long, cannot except 255 ASCII chars", strings.Repeat("a", 256)),
|
||||
},
|
||||
{
|
||||
name: "no-dnsconfig",
|
||||
@ -182,7 +182,7 @@ func TestNodeFQDN(t *testing.T) {
|
||||
},
|
||||
},
|
||||
domain: "example.com",
|
||||
want: "test.example.com",
|
||||
want: "test.example.com.",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ func TestResolveMagicDNS(t *testing.T) {
|
||||
// It is safe to ignore this error as we handled it when caching it
|
||||
peerFQDN, _ := peer.FQDN()
|
||||
|
||||
assert.Equal(t, fmt.Sprintf("%s.headscale.net", peer.Hostname()), peerFQDN)
|
||||
assert.Equal(t, fmt.Sprintf("%s.headscale.net.", peer.Hostname()), peerFQDN)
|
||||
|
||||
command := []string{
|
||||
"tailscale",
|
||||
|
Loading…
Reference in New Issue
Block a user