Commit c4689859 authored by Matthew Holt's avatar Matthew Holt

Merge branch 'letsencrypt' into le-graceful

Conflicts:
	caddy/letsencrypt/letsencrypt.go
	caddy/letsencrypt/renew.go
parents 362ead27 f9f1aafe
......@@ -238,6 +238,9 @@ func saveCertsAndKeys(certificates []acme.CertificateResource) error {
// autoConfigure enables TLS on cfg and appends, if necessary, a new config
// to allConfigs that redirects plaintext HTTP to its new HTTPS counterpart.
func autoConfigure(cfg *server.Config, allConfigs []server.Config) []server.Config {
bundleBytes, _ := ioutil.ReadFile(storage.SiteCertFile(cfg.Host))
ocsp, _ := acme.GetOCSPForCert(bundleBytes)
cfg.TLS.OCSPStaple = ocsp
cfg.TLS.Certificate = storage.SiteCertFile(cfg.Host)
cfg.TLS.Key = storage.SiteKeyFile(cfg.Host)
cfg.TLS.Enabled = true
......
......@@ -92,6 +92,7 @@ func processCertificateRenewal(configs []server.Config) (int, []error) {
// Renew certificate.
// TODO: revokeOld should be an option in the caddyfile
// TODO: bundle should be an option in the caddyfile as well :)
newCertMeta, err := client.RenewCertificate(certMeta, true, true)
if err != nil {
time.Sleep(10 * time.Second)
......
......@@ -56,6 +56,7 @@ type TLSConfig struct {
Certificate string
Key string
LetsEncryptEmail string
OCSPStaple []byte
Ciphers []uint16
ProtocolMinVersion uint16
ProtocolMaxVersion uint16
......
......@@ -179,6 +179,7 @@ func serveTLSWithSNI(s *Server, ln net.Listener, tlsConfigs []TLSConfig) error {
config.Certificates = make([]tls.Certificate, len(tlsConfigs))
for i, tlsConfig := range tlsConfigs {
config.Certificates[i], err = tls.LoadX509KeyPair(tlsConfig.Certificate, tlsConfig.Key)
config.Certificates[i].OCSPStaple = tlsConfig.OCSPStaple
if err != nil {
return err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment