Skip to content

Commit

Permalink
Merge pull request #2442 from openziti/allow.any.domain
Browse files Browse the repository at this point in the history
support using "*" in host.v1/host.v2 allowedAddresses
  • Loading branch information
scareything authored Sep 27, 2024
2 parents 684ca25 + 3ee5f5a commit 89f6cde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tunnel/entities/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ type domainAddress struct {
func (self *domainAddress) Allows(addr interface{}) bool {
host, ok := addr.(string)
host = strings.ToLower(host)
return ok && (strings.HasSuffix(host, self.domain[1:]) || host == self.domain[2:])
return ok && (self.domain == "*" || (strings.HasSuffix(host, self.domain[1:]) || host == self.domain[2:]))
}

func makeAllowedAddress(addr string) (allowedAddress, error) {
if addr[0] == '*' {
if len(addr) < 3 || addr[1] != '.' {
if len(addr) != 1 && (len(addr) < 3 || addr[1] != '.') {
return nil, errors.Errorf("invalid domain[%s]", addr)
}
return &domainAddress{domain: strings.ToLower(addr)}, nil
Expand Down

0 comments on commit 89f6cde

Please sign in to comment.