Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Added new options certbot-cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
fenying committed Feb 6, 2018
1 parent 4b668a4 commit 5233788
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change logs

## v0.2.2

- 配置文件添加 `certbot-root` 配置项以允许使用自定义的 Certbot 的命令名称。

## v0.2.1

- 修复 LE-AliDNS 脚本路径,
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ find '.' -name '*.sh' -exec chmod 0700 {} \; # 设置 Shell 脚本执行权限
1. 运行脚本 initialize-env.sh 安装 Python 2.7, PIP, Aliyun-CLI,
Aliyun-SDK-AliDNS 等组件,并配置 Access-Key 和 Secret-Key。
> Access-Key 需要 AliyunDNSFullAccess 权限。
> Access-Key 需要 AliyunDNSFullAccess 权限。参考:
[配置命令行工具和 SDK](https://help.aliyun.com/document_detail/43039.html?spm=a2c4g.11186623.6.550.ap6b0e)

> 注意阿里云命令行工具输出方式必须是 table。
2. 复制 default.conf 配置文件为 /etc/le-alidns.conf,并根据需要配置。

Expand Down Expand Up @@ -85,7 +88,7 @@ trusted-host=pypi.tuna.tsinghua.edu.cn
## 作者

Angus.Fenying <[i.am.x.fenying@gmail](mailto:i.am.x.fenying@gmail)>
Angus.Fenying <[i.am.x.fenying@gmail.com](mailto:i.am.x.fenying@gmail.com)>

## License

Expand Down
8 changes: 7 additions & 1 deletion actions/load-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ echo "Configuration file ${CONFIG_FILE} not found."
exit -1
fi

export CFG_FIELDS="domains email log-file certbot-root rsa-key-size"
export CFG_FIELDS="domains email log-file certbot-root certbot-cmd rsa-key-size"
export CFG_FIELDS="${CFG_FIELDS} after-cert before-cert after-new-cert"
export CFG_FIELDS="${CFG_FIELDS} no-auto-upgrade"
export CFG_RSA_KEY_SIZE=2048
export CFG_LOG_FILE=./le-alidns.log
export CFG_CERTBOT_ROOT=/usr/local/certbot
export CFG_CERTBOT_CMD=certbot-auto
export CFG_NO_AUTO_UPGRADE=on

for line in `cat ${CONFIG_FILE} | tr -d '[ \t]'`
Expand Down Expand Up @@ -70,6 +71,11 @@ do
export CFG_CERTBOT_ROOT=$FIELD_VALUE
fi;
if [ "$FIELD_NAME" == "certbot-cmd" ]
then
export CFG_CERTBOT_CMD=$FIELD_VALUE
fi;
if [ "$FIELD_NAME" == "log-file" ]
then
export CFG_LOG_FILE=$FIELD_VALUE
Expand Down
4 changes: 4 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ email = admin@sample.com
# 默认值:/usr/local/certbot
# certbot-root = /usr/local/certbot

# Certbot 的命令名称
# 默认值:certbot-auto
# certbot-cmd = certbot-auto

# 工作日志存放路径
# 默认值:./le-alidns.log
# log-file = ./le-alidns.log
Expand Down
25 changes: 14 additions & 11 deletions renew-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,20 @@ if [[ "$LEALIDNS_FORCE" == "1" ]]; then
ARG_FORCE="--force-renew"
fi

CERTBOT_RESULT=$($CFG_CERTBOT_ROOT/certbot-auto renew \
--manual \
--manual-public-ip-logging-ok \
--preferred-challenges dns \
$ARG_FORCE \
--agree-tos \
--email $CFG_EMAIL \
--rsa-key-size $CFG_RSA_KEY_SIZE \
$CFG_ON_NEW_CERT \
$ARG_NO_AUTO_UPGRADE \
--manual-auth-hook ${LEALIDNS_ROOT}actions/create-dns-record.sh)
if [[ "$LEALIDNS_DRY_RUN" != "1" ]]
then
CERTBOT_RESULT=$($CFG_CERTBOT_ROOT/$CFG_CERTBOT_CMD renew \
--manual \
--manual-public-ip-logging-ok \
--preferred-challenges dns \
$ARG_FORCE \
--agree-tos \
--email $CFG_EMAIL \
--rsa-key-size $CFG_RSA_KEY_SIZE \
$CFG_ON_NEW_CERT \
$ARG_NO_AUTO_UPGRADE \
--manual-auth-hook ${LEALIDNS_ROOT}actions/create-dns-record.sh)
fi;

write_log "Details: $CERTBOT_RESULT";

Expand Down
2 changes: 1 addition & 1 deletion sign-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ do

if [[ "$LEALIDNS_DRY_RUN" != "1" ]]
then
CERTBOT_RESULT=$($CFG_CERTBOT_ROOT/certbot-auto certonly \
CERTBOT_RESULT=$($CFG_CERTBOT_ROOT/$CFG_CERTBOT_CMD certonly \
--manual \
--manual-public-ip-logging-ok \
--preferred-challenges dns \
Expand Down

0 comments on commit 5233788

Please sign in to comment.