DiscussionSLA

[⭐️推荐⭐️]使用雷池API来实现自动SSL证书更新

Published a year ago

# Github Discussion
# Show and tell

Published a year ago

profile_photo

FishBossTca

Updated a year ago

0

#!/bin/sh

crt=$(sed ":tag;N;s/\n/\\\n/;b tag" crt证书路径)
key=$(sed ":tag;N;s/\n/\\\n/;b tag" key密钥路径)

curl --location --request POST "https://你的域名.com/api/open/cert" \
--header "X-SLCE-API-TOKEN: 雷池API Token" \
--header "Content-Type: application/json" \
--data "{
    \"manual\": {
        \"crt\": \"$crt\",
        \"key\": \"$key\"
    },
    \"type\": 2,
    \"id\": 1
}"

id可以从填正整数,填写0为自增长(不推荐,需要将网站重新选择证书)
示例:

#!/bin/sh

crt=$(sed ":tag;N;s/\n/\\\n/;b tag" /root/crt/a.666.com.crt)
key=$(sed ":tag;N;s/\n/\\\n/;b tag" /root/crt/a.666.com.key)

curl --location --request POST "https://waf.666.com/api/open/cert" \
--header "X-SLCE-API-TOKEN: 63J966666x9pzfDUo0666zVIz2x1SeFjS96666UJ7" \
--header "Content-Type: application/json" \
--data "{
    \"manual\": {
        \"crt\": \"$crt\",
        \"key\": \"$key\"
    },
    \"type\": 2,
    \"id\": 1
}"

image

image

profile_photo

TTVincent

Updated a year ago

0

非常感谢,很好用。

[⭐️推荐⭐️]使用雷池API来实现自动SSL证书更新 | SafePoint