This commit is contained in:
neil 2016-08-23 22:53:43 +08:00
parent 6d4e903b08
commit 5fbc47eb3a
1 changed files with 19 additions and 18 deletions

37
acme.sh
View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh #!/usr/bin/env sh
VER=2.4.1 VER=2.4.2
PROJECT_NAME="acme.sh" PROJECT_NAME="acme.sh"
@ -376,7 +376,7 @@ _isEccKey() {
[ "$_length" != "1024" ] \ [ "$_length" != "1024" ] \
&& [ "$_length" != "2048" ] \ && [ "$_length" != "2048" ] \
&& [ "$_length" != "3172" ] \ && [ "$_length" != "3072" ] \
&& [ "$_length" != "4096" ] \ && [ "$_length" != "4096" ] \
&& [ "$_length" != "8192" ] && [ "$_length" != "8192" ]
} }
@ -518,28 +518,26 @@ toPkcs() {
} }
#domain [2048] #[2048]
createAccountKey() { createAccountKey() {
_info "Creating account key" _info "Creating account key"
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
_usage "Usage: $PROJECT_ENTRY --createAccountKey -d domain.com [--accountkeylength 2048]" _usage "Usage: $PROJECT_ENTRY --createAccountKey --accountkeylength 2048"
return return
fi fi
account=$1 length=$1
length=$2
_debug account "$account"
_debug length "$length"
if _startswith "$length" "ec-" ; then if _startswith "$length" "ec-" ; then
length=2048 length=2048
fi fi
if [ -z "$2" ] || [ "$2" = "no" ] ; then if [ -z "$length" ] || [ "$length" = "no" ] ; then
_info "Use default length 2048" _info "Use default length 2048"
length=2048 length=2048
fi fi
_debug length "$length"
_initpath _initpath
if [ -f "$ACCOUNT_KEY_PATH" ] ; then if [ -f "$ACCOUNT_KEY_PATH" ] ; then
_info "Account key exists, skip" _info "Account key exists, skip"
return return
@ -1214,12 +1212,11 @@ _initpath() {
CERT_HOME="$_DEFAULT_CERT_HOME" CERT_HOME="$_DEFAULT_CERT_HOME"
fi fi
domain="$1" if [ -z "$1" ] ; then
length="$2"
if [ -z "$domain" ] ; then
return 0 return 0
fi fi
domain="$1"
_ilength="$2"
if [ -z "$DOMAIN_PATH" ] ; then if [ -z "$DOMAIN_PATH" ] ; then
domainhome="$CERT_HOME/$domain" domainhome="$CERT_HOME/$domain"
@ -1227,7 +1224,7 @@ _initpath() {
DOMAIN_PATH="$domainhome" DOMAIN_PATH="$domainhome"
if _isEccKey "$length" ; then if _isEccKey "$_ilength" ; then
DOMAIN_PATH="$domainhomeecc" DOMAIN_PATH="$domainhomeecc"
else else
if [ ! -d "$domainhome" ] && [ -d "$domainhomeecc" ] ; then if [ ! -d "$domainhome" ] && [ -d "$domainhomeecc" ] ; then
@ -1565,7 +1562,11 @@ issue() {
fi fi
if [ ! -f "$ACCOUNT_KEY_PATH" ] ; then if [ ! -f "$ACCOUNT_KEY_PATH" ] ; then
if ! createAccountKey $Le_Domain $Le_Keylength ; then _acck="no"
if [ "$Le_Keylength" ] ; then
_acck="$Le_Keylength"
fi
if ! createAccountKey "$_acck" ; then
_err "Create account key error." _err "Create account key error."
if [ "$usingApache" ] ; then if [ "$usingApache" ] ; then
_restoreApache _restoreApache
@ -1799,7 +1800,7 @@ issue() {
_savedomainconf "Le_DNSSleep" "$Le_DNSSleep" _savedomainconf "Le_DNSSleep" "$Le_DNSSleep"
fi fi
_info "Sleep $Le_DNSSleep seconds for the txt records to take effect" _info "Sleep $(__green $Le_DNSSleep) seconds for the txt records to take effect"
sleep $Le_DNSSleep sleep $Le_DNSSleep
fi fi
@ -3134,7 +3135,7 @@ _process() {
toPkcs "$_domain" "$_password" "$_ecc" toPkcs "$_domain" "$_password" "$_ecc"
;; ;;
createAccountKey) createAccountKey)
createAccountKey "$_domain" "$_accountkeylength" createAccountKey "$_accountkeylength"
;; ;;
createDomainKey) createDomainKey)
createDomainKey "$_domain" "$_keylength" createDomainKey "$_domain" "$_keylength"