Skip to content

Commit

Permalink
Hostname validation: document invalid hostnames (#49655)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoandredinis authored Dec 4, 2024
1 parent 5259d31 commit c46c145
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/pages/admin-guides/management/guides/ec2-tags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ this way will have the `aws/` prefix. When the Teleport process starts, it fetch
the instance metadata service and adds them as labels. The process will update the tags every hour,
so newly created or deleted tags will be reflected in the labels.

If the tag `TeleportHostname` (case-sensitive) is present, its value will override the node's hostname.
If the tag `TeleportHostname` is present, its value (must be lower case) will override the node's hostname.

```code
$ tsh ls
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/admin-guides/management/guides/gcp-tags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ When the Teleport process starts, it fetches all tags and labels from
the GCP API and adds them as labels. The process will update the tags every hour,
so newly created or deleted tags will be reflected in the labels.

If the GCP label `TeleportHostname` (case-sensitive) is present, its value will override the node's hostname. This
If the GCP label `TeleportHostname` is present, its value (must be lower case) will override the node's hostname. This
does not apply to GCP tags.

```code
Expand Down
10 changes: 10 additions & 0 deletions lib/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ func TestIsValidHostname(t *testing.T) {
hostname: "some-host-1.example.com",
assert: require.True,
},
{
name: "only lower case works",
hostname: "only-lower-case-works",
assert: require.True,
},
{
name: "mixed upper case fails",
hostname: "mixed-UPPER-CASE-fails",
assert: require.False,
},
{
name: "one component",
hostname: "example",
Expand Down

0 comments on commit c46c145

Please sign in to comment.