mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-03-09 20:29:14 +07:00
validation: allow up to 200 chars of txt content
This commit is contained in:
parent
b7a0a8a7bc
commit
2702bfbd89
2
util.go
2
util.go
@ -59,7 +59,7 @@ func prepareConfig(conf DNSConfig) (DNSConfig, error) {
|
||||
|
||||
func sanitizeString(s string) string {
|
||||
// URL safe base64 alphabet without padding as defined in ACME
|
||||
re, _ := regexp.Compile(`[^A-Za-z\-\_0-9]+`)
|
||||
re, _ := regexp.Compile(`[^A-Za-z\-\_\.0-9]+`)
|
||||
return re.ReplaceAllString(s, "")
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,9 @@ func validSubdomain(s string) bool {
|
||||
|
||||
func validTXT(s string) bool {
|
||||
sn := sanitizeString(s)
|
||||
if utf8.RuneCountInString(s) == 43 && utf8.RuneCountInString(sn) == 43 {
|
||||
cnt := utf8.RuneCountInString(s)
|
||||
cnt_sn := utf8.RuneCountInString(sn)
|
||||
if (43 <= cnt && cnt <= 200 && cnt_sn == cnt) {
|
||||
// 43 chars is the current LE auth key size, but not limited / defined by ACME
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user