mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 22:23:48 +03:00
CSRs can only be pkcs10
This commit is contained in:
parent
a9933aace1
commit
eba47a3de4
1 changed files with 1 additions and 7 deletions
|
@ -219,12 +219,6 @@ func (a *adminAPI) handleCSRGeneration(w http.ResponseWriter, r *http.Request) e
|
||||||
Err: fmt.Errorf("failed to generate CSR: %v", err),
|
Err: fmt.Errorf("failed to generate CSR: %v", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if r.Header.Get("Accept") != "application/pkcs10" {
|
|
||||||
return caddy.APIError{
|
|
||||||
HTTPStatus: http.StatusNotAcceptable,
|
|
||||||
Err: fmt.Errorf("only accept application/pkcs10"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bs, err := pemEncode("CERTIFICATE REQUEST", csr.Raw)
|
bs, err := pemEncode("CERTIFICATE REQUEST", csr.Raw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return caddy.APIError{
|
return caddy.APIError{
|
||||||
|
@ -233,7 +227,7 @@ func (a *adminAPI) handleCSRGeneration(w http.ResponseWriter, r *http.Request) e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/pkcs10")
|
w.Header().Set("Content-Type", "application/pkcs10")
|
||||||
w.Header().Set("content-disposition", fmt.Sprintf(`attachment; filename="%s"`, csrReq.ID))
|
w.Header().Set("content-disposition", fmt.Sprintf(`attachment; filename="%s.csr"`, csrReq.ID))
|
||||||
|
|
||||||
if _, err := w.Write(bs); err != nil {
|
if _, err := w.Write(bs); err != nil {
|
||||||
return caddy.APIError{
|
return caddy.APIError{
|
||||||
|
|
Loading…
Reference in a new issue