router: refuse to generate certificates for unknown hosts (#68)

This commit is contained in:
David Dollar 2020-01-13 09:04:23 -05:00 committed by GitHub
parent e9f72c5ada
commit 2e7b2de757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,6 +238,14 @@ func (r *Router) generateCertificateAutocert(m *autocert.Manager) func(*tls.Clie
return common.CertificateSelfSigned("convox")
}
ts, err := r.storage.TargetList(hello.ServerName)
if err != nil {
return nil, err
}
if len(ts) == 0 {
return nil, fmt.Errorf("unknown host")
}
c, err := m.GetCertificate(hello)
if err != nil {
fmt.Printf("err: %+v\n", err)