-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dnsapi for Vultr #2370
Add dnsapi for Vultr #2370
Conversation
This completed |
check this guide first: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide |
Opened #2374 |
dnsapi/dns_vultr.sh
Outdated
_debug 'Getting txt records' | ||
_vultr_rest GET "dns/records?domain=$_domain" | ||
|
||
if printf "%s\n" "$response" | grep "{\"type\":\"TXT\",\"name\":\"$fulldomain\"" >/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you please not include {
char ?
use other solutions
dnsapi/dns_vultr.sh
Outdated
return 1 | ||
fi | ||
|
||
_record="$(echo "$response" | _egrep_o "{[^}]*\"type\"\\s*:\\s*\"TXT\"[^}]*}")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not use complext regex expression here.
think about other solutions.
I will rework it |
@Neilpang Please review it |
dnsapi/dns_vultr.sh
Outdated
return 1 | ||
fi | ||
|
||
_record="$(echo "$response" | _egrep_o "\"type\":\"TXT\",\"name\":\"_acme-challenge\",\"data\":\\W*$txtvalue\\W*\",\"priority\":0,\"RECORDID\":\\d*")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t know how to replace \\W*
in _egrep_o
Substring from response
{"type":"TXT","name":"_acme-challenge","data":"\"IikqiCI3suY0u-71M-apJt5Ix-0Ai6qDmmOaN4pkhzs\"","priority":0,"RECORDID":16806343,"ttl":300}
This doesn’t work
_record="$(echo "$response" | _egrep_o "\"type\":\"TXT\",\"name\":\"_acme-challenge\",\"data\":\"\\\"$txtvalue\\\"\",\"priority\":0,\"RECORDID\":\\d*")"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try this one:
_record_id="$( echo "$response" | tr '{}' '\n' | grep '"TXT"'| grep "$txtvalue" | tr ',' '\n' | grep -i 'RECORDID' | cut -d : -f 2)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine
fix the CI errors first: https://travis-ci.org/Neilpang/acme.sh/jobs/560483218 |
Do I need fix |
which one ? |
fixed, it's my fault. |
fi | ||
|
||
_record_id="$(echo "$response" | tr '{}' '\n' | grep '"TXT"' | grep "$txtvalue" | tr ',' '\n' | grep -i 'RECORDID' | cut -d : -f 2)" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add check for _record_id
here.
It can be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not empty, works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_record_id="$(echo "$response" | tr '{}' '\n' | grep '"TXT"' | grep "$txtvalue" | tr ',' '\n' | grep -i 'RECORDID' | cut -d : -f 2)"
echo "$_record_id"
Removing DNS records.
Removing txt: QDPkHsxNfZJo7L3hQILAP-oNmq0WmQcNWMGtfEh5u4I for domain: _acme-challenge.sharevari.com
16857956
Removed: Success
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
txt records added and then removed from my vultr account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew it works for you now.
but it never hurts if you check the value.
just check it as what I did for namesilo.
It makes your program more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* support jdcloud.com * fix format * ttl 3000 * Escape slashes (#2375) * Change 1.1.1.1 to 1.0.0.1 to probe compatibility (#2330) As we can see, 1.1.1.1 is not routed or routed to an Intranet devices due to historical reason. Change 1.1.1.1 to 1.0.0.1 will have a better compatibility. I found this problem on my Tencent Cloud server. * check empty id * fix error * Add dnsapi for Vultr (#2370) * Add Vultr dns api * PushOver notifications (#2325) * PushOver notifications, using AppToken, UserKey, and optional sounds * fix errors * added dns api support for hexonet (#1776) * update * minor * support new Cloudflare Token format fix #2398 * fix wildcard domain name * add more info * fix #2377 * fix format * fix format
Fully rewritten using dns_cf api as example