Merge branch 'dev' into Add-AWS_API-slowrate

This commit is contained in:
Stephane Moser
2019-11-22 10:20:25 +00:00
71 changed files with 6484 additions and 414 deletions

View File

@ -6,6 +6,8 @@
#AWS_SECRET_ACCESS_KEY="xxxxxxx"
#This is the Amazon Route53 api wrapper for acme.sh
#All `_sleep` commands are included to avoid Route53 throttling, see
#https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html#limits-api-requests
AWS_HOST="route53.amazonaws.com"
AWS_URL="https://$AWS_HOST"
@ -44,14 +46,16 @@ dns_aws_add() {
_debug "First detect the root zone"
if ! _get_root "$fulldomain"; then
_err "invalid domain"
_sleep 1
return 1
fi
_debug _domain_id "$_domain_id"
_debug _sub_domain "$_sub_domain"
_debug _domain "$_domain"
_info "Geting existing records for $fulldomain"
_info "Getting existing records for $fulldomain"
if ! aws_rest GET "2013-04-01$_domain_id/rrset" "name=$fulldomain&type=TXT"; then
_sleep 1
return 1
fi
@ -64,6 +68,7 @@ dns_aws_add() {
if [ "$_resource_record" ] && _contains "$response" "$txtvalue"; then
_info "The TXT record already exists. Skipping."
_sleep 1
return 0
fi
@ -75,11 +80,14 @@ dns_aws_add() {
_info "TXT record updated successfully."
if [ -n "$slowrateslepp" ]; then
_info "Slow rate activated: sleeping for $slowrateslepp seconds"
sleep "$slowrateslepp"
_sleep "$slowrateslepp"
else
_sleep 1
fi
return 0
fi
_sleep 1
return 1
}
@ -99,6 +107,7 @@ dns_aws_rm() {
_debug "First detect the root zone"
if ! _get_root "$fulldomain"; then
_err "invalid domain"
_sleep 1
return 1
fi
_debug _domain_id "$_domain_id"
@ -107,6 +116,7 @@ dns_aws_rm() {
_info "Getting existing records for $fulldomain"
if ! aws_rest GET "2013-04-01$_domain_id/rrset" "name=$fulldomain&type=TXT"; then
_sleep 1
return 1
fi
@ -115,6 +125,7 @@ dns_aws_rm() {
_debug "_resource_record" "$_resource_record"
else
_debug "no records exist, skip"
_sleep 1
return 0
fi
@ -124,11 +135,14 @@ dns_aws_rm() {
_info "TXT record deleted successfully."
if [ -n "$slowrateslepp" ]; then
_info "Slow rate activated: sleeping for $slowrateslepp seconds"
sleep "$slowrateslepp"
_sleep "$slowrateslepp"
else
_sleep 1
fi
return 0
fi
_sleep 1
return 1
}