全局证书管理
创建全局证书
URI
POST /admin-api/global/1/certs
请求参数
label
type: string
required: no
description: 证书的标签 / 备注
server_cert
type: string
required: no (当使用手动上传证书时,该字段为必选)
description: PEM 格式的证书文件内容
priv_key
type: string
required: no (当使用手动上传证书时,该字段为必选)
description: PEM 格式的证书私钥文件内容
cert_chain:
type: string
required: no
description: 证书链。通常不需上传
client_verify
type: boolean
required: no
description: 是否使用客户端证书验证
ca_cert
type: string
required: no (当开启客户端证书校验后,该字段为必选)
description: 被校验的客户端证书使用该 CA 签发
acme_host
type: string
required: no (当使用 ACME 签发证书时,该字段为必选)
description: 使用 ACME 服务提供商签发证书。注意,全局证书只支持泛域名的证书签发, 如果要签发非泛域名的证书,还请使用应用级别证书
acme_providers
type: integer
required: no
description: 指定在全局配置中 ACME 服务提供商的 id,如果未指定,则默认使用 Let’s Encrypt 进行证书签发
acme_csr_type
type: string
required: no
description: 指定 acme 签发证书的加密算法,目前支持
rsa
和ec
两种算法,默认值为rsa
acme_use_uploaded_key
type: boolean
required: no
description: 是否在 ACME 签发过程中使用用户手动上传的私钥
acme_takeover
type: boolean
required: no
description: 该选项指定手动上传的证书,是否由指定的 ACME 服务更新,默认值为
false
请求示例
Shell
curl -X POST \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/certs \
-d '{"acme_host":"*.example.com"}'
响应示例
Status: 200 OK
{
"data": {"id": 1},
"status": 0
}
获取全局证书列表
URI
GET /admin-api/global/1/certs
请求示例
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/certs
响应示例
Status: 200 OK
{
"data": [
{
"client_verify": false,
"id": 1,
"server_cert": "-----BEGIN CERTIFICATE----- xxxx",
"acme_host": "*.example.com",
"expdate": 123456789
}
],
"status": 0
}
修改全局证书
URI
PUT /admin-api/global/1/certs/{cert_id}
请求示例
Shell
curl -X PUT \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/certs/1 \
-d '{"acme_host": "*.test.com"}'
响应示例
Status: 200 OK
{"status":0}
删除全局证书
URI
DELETE /admin-api/global/1/certs/{cert_id}
请求示例
Shell
curl -X DELETE \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/certs/1 \
响应示例
Status: 200 OK
{ "status": 0 }
创建 ACME 提供商
URI
POST /admin-api/global/1/acme_providers
请求参数
name
type: string
required: yes
description: ACME 提供商的名称
endpoint
type: string
required: yes
description: ACME 提供商的端点(URI)
eab_kid
type: string
required: yes
description: EAB_KEY_ID field of ACME Provider
eab_hmac_key
type: string
required: yes
description: EAB_HMAC_KEY field of ACME Provider
email
type: string
required: no
description: email address
请求示例
Shell
curl -X POST \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/acme_providers \
-d '{"name":"ZeroSSL","endpoint": "https://acme.zerossl.com/v2/DV90","eab_kid":"EAB_KEY_ID","eab_hmac_key":"EAB_HMAC_KEY"}'
响应示例
Status: 200 OK
{
"data": {"id": 1},
"status": 0
}
获取 ACME 提供商列表
URI
GET /admin-api/global/1/acme_providers
请求示例
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/acme_providers
响应示例
Status: 200 OK
{
"data": [
{
"id": 1,
"name": "ZeroSSL",
"endpoint": "https://acme.zerossl.com/v2/DV90",
"eab_kid": "EAB_KEY_ID",
"eab_hmac_key": "EAB_HMAC_KEY"
}
],
"status": 0
}
更新 ACME 服务提供商
URI
PUT /admin-api/global/1/acme_providers/{provider_id}
请求示例
Shell
curl -X PUT \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/acme_providers/1 \
-d '{"eab_kid":"EAB_KEY_ID_2"}'
响应示例
Status: 200 OK
{"status":0}
删除 ACME 服务提供商
URI
DELETE /admin-api/global/1/acme_providers/{provider_id}
请求示例
Shell
curl -X DELETE \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
http://{admin-site}/admin-api/global/1/acme_providers/1 \
响应示例
Status: 200 OK
{"status": 0}