feat: Replace HTTP01 by DNS01
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-01-06 18:11:54 +01:00
parent 308a72e1b5
commit f4d8b151ec
6 changed files with 995 additions and 37 deletions

View File

@@ -44,21 +44,21 @@ func unlockDomain(domain string) {
func buildDomainList(domain, pagesDomain string) []string {
// TODO: For wildcards, we MUST use DNS01
/*if domain == pagesDomain || strings.HasSuffix(domain, pagesDomain) {
if domain == pagesDomain || strings.HasSuffix(domain, pagesDomain) {
return []string{
pagesDomain,
"*." + pagesDomain,
}
}*/
}
return []string{domain}
}
func getDomainKey(domain, pagesDomain string) string {
// TODO: For wildcards, we MUST use DNS01
/*if domain == pagesDomain || strings.HasSuffix(domain, pagesDomain) {
if domain == pagesDomain || strings.HasSuffix(domain, pagesDomain) {
return "*." + pagesDomain
}*/
}
return domain
}

View File

@@ -1,5 +1,7 @@
package server
import "testing"
const (
pagesDomain = "pages.local"
pagesDomainWildcard = "*.pages.local"
@@ -19,8 +21,7 @@ func equals(a, b []string) bool {
return true
}
// TODO: We can only do this once we can do DNS01 for wildcard certificates.
/*func TestDomainListBare(t *testing.T) {
func TestDomainListBare(t *testing.T) {
expect := []string{pagesDomain, pagesDomainWildcard}
res := buildDomainList(pagesDomain, pagesDomain)
if !equals(res, expect) {
@@ -63,4 +64,4 @@ func TestDomainKeyCNAME(t *testing.T) {
if res != "testdomain.example" {
t.Fatalf("%s != %s", res, "testdomain.example")
}
}*/
}