Package: golang-github-rsc-letsencrypt / 0.0~git20160929.0.76104d2-4

challengecertdomain.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Index: golang-rsc-letsencrypt/lets.go
===================================================================
--- golang-rsc-letsencrypt.orig/lets.go
+++ golang-rsc-letsencrypt/lets.go
@@ -175,8 +175,10 @@ import (
 	"crypto/ecdsa"
 	"crypto/elliptic"
 	"crypto/rand"
+	"crypto/sha256"
 	"crypto/tls"
 	"crypto/x509"
+	"encoding/hex"
 	"encoding/json"
 	"encoding/pem"
 	"fmt"
@@ -728,11 +730,15 @@ type tlsProvider struct {
 }
 
 func (p tlsProvider) Present(domain, token, keyAuth string) error {
-	cert, dom, err := acme.TLSSNI01ChallengeCertDomain(keyAuth)
+	cert, err := acme.TLSSNI01ChallengeCert(keyAuth)
 	if err != nil {
 		return err
 	}
 
+	zBytes := sha256.Sum256([]byte(keyAuth))
+	z := hex.EncodeToString(zBytes[:sha256.Size])
+	dom := fmt.Sprintf("%s.%s.acme.invalid", z[:32], z[32:])
+
 	p.m.mu.Lock()
 	p.m.certTokens[dom] = &cert
 	p.m.mu.Unlock()
@@ -741,10 +747,9 @@ func (p tlsProvider) Present(domain, tok
 }
 
 func (p tlsProvider) CleanUp(domain, token, keyAuth string) error {
-	_, dom, err := acme.TLSSNI01ChallengeCertDomain(keyAuth)
-	if err != nil {
-		return err
-	}
+	zBytes := sha256.Sum256([]byte(keyAuth))
+	z := hex.EncodeToString(zBytes[:sha256.Size])
+	dom := fmt.Sprintf("%s.%s.acme.invalid", z[:32], z[32:])
 
 	p.m.mu.Lock()
 	delete(p.m.certTokens, dom)