Skip to content

Commit

Permalink
external service is fetched correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
randomlogin committed Mar 29, 2024
1 parent b86b31c commit 48205fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion prove/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"strings"

"github.com/miekg/dns"
"github.com/randomlogin/sane/debuglog"
Expand Down Expand Up @@ -95,9 +96,14 @@ func VerifyCertificateExtensions(roots []sync.BlockInfo, cert x509.Certificate,
if len(cert.DNSNames) == 0 {
return fmt.Errorf("certificate has empty dns names")
}
labels := dns.SplitDomainName(tlsa.Header().Name)
if len(labels) < 3 {
return fmt.Errorf("tlsa record has less than 3 labels")
}
tlsaDomain := strings.Join(labels[2:], ".")

for _, domain := range cert.DNSNames {
err := verifyDomain(domain, cert, roots, tlsa, externalServices)
err := verifyDomain(tlsaDomain, cert, roots, tlsa, externalServices)
if err == nil {
debuglog.Logger.Debug("successfully verified certificate extensions for the domain " + domain)
return nil
Expand Down
2 changes: 1 addition & 1 deletion tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

var (
Version = "0.0.9"
Version = "0.0.12"
)

const (
Expand Down

0 comments on commit 48205fa

Please sign in to comment.