Skip to content

Commit

Permalink
set minimum hostname length of 2
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Jan 31, 2025
1 parent 5a8db83 commit 89323b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
[#2391](https://github.com/juanfont/headscale/pull/2391)
- Do not allow renaming of users from OIDC
[#2393](https://github.com/juanfont/headscale/pull/2393)
- Change minimum hostname length to 2
[#2393](https://github.com/juanfont/headscale/pull/2393)

## 0.24.2 (2025-01-30)

Expand Down
5 changes: 5 additions & 0 deletions hscontrol/util/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func ValidateUsername(username string) error {
}

func CheckForFQDNRules(name string) error {
// Ensure the username meets the minimum length requirement
if len(name) < 2 {
return errors.New("name must be at least 2 characters long")
}

if len(name) > LabelHostnameLength {
return fmt.Errorf(
"DNS segment must not be over 63 chars. %v doesn't comply with this rule: %w",
Expand Down

0 comments on commit 89323b5

Please sign in to comment.