forked from minio/concert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renew.go
34 lines (27 loc) · 784 Bytes
/
renew.go
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
package main
import (
"log"
"github.com/minio/cli"
)
func renewMain(c *cli.Context) {
if !c.Args().Present() || c.Args().First() == "help" {
cli.ShowCommandHelpAndExit(c, "renew", 1) // last argument is exit code
}
// Renew keys from this dir.
certsDir := c.String("dir")
// Get email and domain.
email := c.Args().Get(0)
// Renew a certificate.
newCertificates, err := renewCerts(certsDir, email)
if err != nil {
log.Fatalln(err)
}
// New certificate comes back with the cert bytes, the bytes of
// the client's private key, and a certificate URL. This is where
// you should save them to files!
err = saveCerts(certsDir, newCertificates)
if err != nil {
log.Fatalln(err)
}
log.Printf("Renewed certificates for user %s under %s\n", email, certsDir)
}