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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package main
import (
"log"
"dim13.org/acme"
)
func startSolvers() (acme.Solvers, error) {
httpSol, err := acme.NewHTTPSolver(*listen)
if err != nil {
return nil, err
}
tlsSol, err := acme.NewTLSSolver(*listenTLS)
if err != nil {
return nil, err
}
return acme.NewSolvers(httpSol, tlsSol), nil
}
func main() {
log.Println("Scan files")
crt, err := scanFiles(*baseDir)
if err != nil {
log.Fatal(err)
}
sol, err := startSolvers()
if err != nil {
log.Fatal(err)
}
_ = sol
log.Println("Dial", *provider)
prov, err := acme.DialProvider(*provider)
if err != nil {
log.Fatal(err)
}
for _, c := range crt {
if c.IsValid(*graceTime) && !*force {
log.Println("Skip", c)
continue
}
csr, err := acme.NewCSR(c.PrivateKey, c.Leaf.DNSNames, c.Leaf.EmailAddresses)
if err != nil {
log.Println(err)
continue
}
_ = csr
}
if len(*emails) > 0 && len(*domains) > 0 {
key, err := acme.NewKey(*keySize)
if err != nil {
log.Fatal(err)
}
sig, err := acme.NewSigner(key)
if err != nil {
log.Fatal(err)
}
var con acme.Contacts
for _, email := range *emails {
m, err := acme.NewMail(email)
if err != nil {
log.Fatal(err)
}
con = append(con, m)
}
log.Println("Register", con)
err = prov.Register(sig, con, agree)
if err != nil {
log.Fatal(err)
}
log.Println(*emails)
log.Println(*domains)
}
}
func agree(tos string) bool {
log.Println("Agree to", tos)
return true
}
|