canonical / canonical/microcluster

Missing support for wildcard domain names

Open
#312 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
33
Forks
39
Avg merge
4h 49m
Merged PRs (30d)
6

Description

MicroCluster requires the name of the cluster member to be a FQDN and it also checks that this name is among certificate SAN.
https://github.com/canonical/microcluster/blob/d50fa5075619b0e03e0f6b5e86b10be1a18f1831/internal/rest/resources/control.go#L83

```go
// Subject Alternate Name values. (Note that these values may not be valid
// if invalid values were contained within a parsed certificate. For
// example, an element of DNSNames may not be a valid DNS domain name.)
DNSNames []string
```

However usage of `ValueInSlice` doesn't work for certificates that have wildcard DNS
This certificate won't work for `member1.maas.internal`
```
X509v3 Subject Alternative Name:
DNS:*.maas.internal, DNS:maas, IP Address:127.0.0.1, URI:*
```

```go
// ValueInSlice returns true if key is in list.
func ValueInSlice[T comparable](key T, list []T) bool {
for _, entry := range list {
if entry == key {
return true
}
}

return false
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The validation is in internal/rest/resources/control.go around line 83; start by reading that check and the ValueInSlice call. Trace the existing certificate SAN handling and its tests, then verify that a member such as member1.maas.internal is accepted when the SAN contains *.maas.internal while exact-match cases continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.