Skip to content
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

Merged
merged 10 commits into from
Jul 20, 2019
Merged

Add dnsapi for Vultr #2370

merged 10 commits into from
Jul 20, 2019

Conversation

Fudoshiki
Copy link
Contributor

@Fudoshiki Fudoshiki commented Jul 1, 2019

Fully rewritten using dns_cf api as example

@Fudoshiki
Copy link
Contributor Author

This completed

@Neilpang
Copy link
Member

Neilpang commented Jul 2, 2019

check this guide first: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide

@Fudoshiki
Copy link
Contributor Author

Opened #2374
Documentation updated

_debug 'Getting txt records'
_vultr_rest GET "dns/records?domain=$_domain"

if printf "%s\n" "$response" | grep "{\"type\":\"TXT\",\"name\":\"$fulldomain\"" >/dev/null; then
Copy link
Member

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

return 1
fi

_record="$(echo "$response" | _egrep_o "{[^}]*\"type\"\\s*:\\s*\"TXT\"[^}]*}")"
Copy link
Member

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.

@Fudoshiki
Copy link
Contributor Author

I will rework it

@Fudoshiki
Copy link
Contributor Author

@Neilpang Please review it

return 1
fi

_record="$(echo "$response" | _egrep_o "\"type\":\"TXT\",\"name\":\"_acme-challenge\",\"data\":\\W*$txtvalue\\W*\",\"priority\":0,\"RECORDID\":\\d*")"
Copy link
Contributor Author

@Fudoshiki Fudoshiki Jul 16, 2019

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*")"

Copy link
Member

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)"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine

@Neilpang
Copy link
Member

fix the CI errors first: https://travis-ci.org/Neilpang/acme.sh/jobs/560483218

@Fudoshiki
Copy link
Contributor Author

Do I need fix dnsapi/dns_namesilo.sh file too?

@Neilpang
Copy link
Member

which one ?

@Fudoshiki
Copy link
Contributor Author

@Neilpang
Copy link
Member

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)"

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not empty, works fine

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Neilpang Neilpang merged commit 8d393ff into acmesh-official:dev Jul 20, 2019
Neilpang added a commit that referenced this pull request Jul 27, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants