Skip to content

Commit

Permalink
fix: use sanitized hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiebens committed Apr 26, 2022
1 parent 9290db5 commit 8686d0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/server/tailscale_attestor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"sync"
"tailscale.com/util/dnsname"

"github.com/hashicorp/hcl"
"github.com/spiffe/go-spiffe/v2/spiffeid"
Expand Down Expand Up @@ -71,7 +72,8 @@ func (p *Plugin) Attest(stream nodeattestorv1.NodeAttestor_AttestServer) error {
return fmt.Errorf("unable to find provided client key")
}

id, err := agentID(c.trustDomain, fmt.Sprintf("/%s/%s", PluginName, node.HostName))
sanitizeHostname := dnsname.SanitizeHostname(node.HostName)
id, err := agentID(c.trustDomain, fmt.Sprintf("/%s/%s", PluginName, sanitizeHostname))
if err != nil {
return err
}
Expand Down

0 comments on commit 8686d0f

Please sign in to comment.