mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 22:40:31 -05:00
Support for OCSP Stapling. Fixes #280
This commit is contained in:
parent
f8ad050dda
commit
91465d8e6f
3 changed files with 5 additions and 0 deletions
|
@ -232,6 +232,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
|
||||
|
|
|
@ -56,6 +56,7 @@ type TLSConfig struct {
|
|||
Certificate string
|
||||
Key string
|
||||
LetsEncryptEmail string
|
||||
OCSPStaple []byte
|
||||
Ciphers []uint16
|
||||
ProtocolMinVersion uint16
|
||||
ProtocolMaxVersion uint16
|
||||
|
|
|
@ -162,6 +162,7 @@ func ListenAndServeTLSWithSNI(srv *http.Server, 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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue