Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
1905830b
Unverified
Commit
1905830b
authored
Jan 14, 2024
by
neil
Committed by
GitHub
Jan 14, 2024
Browse files
Merge pull request #4948 from rparenton/gandi-livedns-new-api
Fix #4836 (Switch to new Gandi LiveDNS API)
parents
85e3ecfe
bfb41ce1
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_gandi_livedns.sh
View file @
1905830b
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#
#
######## Public functions #####################
######## Public functions #####################
GANDI_LIVEDNS_API
=
"https://
dns.
api.gandi.net/
api/v5
"
GANDI_LIVEDNS_API
=
"https://api.gandi.net/
v5/livedns
"
#Usage: dns_gandi_livedns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
#Usage: dns_gandi_livedns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_gandi_livedns_add
()
{
dns_gandi_livedns_add
()
{
...
@@ -78,7 +78,7 @@ dns_gandi_livedns_rm() {
...
@@ -78,7 +78,7 @@ dns_gandi_livedns_rm() {
_gandi_livedns_rest PUT
\
_gandi_livedns_rest PUT
\
"domains/
$_domain
/records/
$_sub_domain
/TXT"
\
"domains/
$_domain
/records/
$_sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
&&
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
&&
_contains
"
$response
"
'{"message":
"DNS Record Created"}'
&&
_contains
"
$response
"
'{"message":"DNS Record Created"}'
&&
_info
"Removing record
$(
__green
"success"
)
"
_info
"Removing record
$(
__green
"success"
)
"
}
}
...
@@ -134,7 +134,7 @@ _dns_gandi_append_record() {
...
@@ -134,7 +134,7 @@ _dns_gandi_append_record() {
_debug new_rrset_values
"
$_rrset_values
"
_debug new_rrset_values
"
$_rrset_values
"
_gandi_livedns_rest PUT
"domains/
$_domain
/records/
$sub_domain
/TXT"
\
_gandi_livedns_rest PUT
"domains/
$_domain
/records/
$sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
&&
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
&&
_contains
"
$response
"
'{"message":
"DNS Record Created"}'
&&
_contains
"
$response
"
'{"message":"DNS Record Created"}'
&&
_info
"Adding record
$(
__green
"success"
)
"
_info
"Adding record
$(
__green
"success"
)
"
}
}
...
@@ -144,11 +144,11 @@ _dns_gandi_existing_rrset_values() {
...
@@ -144,11 +144,11 @@ _dns_gandi_existing_rrset_values() {
if
!
_gandi_livedns_rest GET
"domains/
$domain
/records/
$sub_domain
"
;
then
if
!
_gandi_livedns_rest GET
"domains/
$domain
/records/
$sub_domain
"
;
then
return
1
return
1
fi
fi
if
!
_contains
"
$response
"
'"rrset_type":
"TXT"'
;
then
if
!
_contains
"
$response
"
'"rrset_type":"TXT"'
;
then
_debug
"Does not have a _acme-challenge TXT record yet."
_debug
"Does not have a _acme-challenge TXT record yet."
return
1
return
1
fi
fi
if
_contains
"
$response
"
'"rrset_values":
\[\]'
;
then
if
_contains
"
$response
"
'"rrset_values":\[\]'
;
then
_debug
"Empty rrset_values for TXT record, no previous TXT record."
_debug
"Empty rrset_values for TXT record, no previous TXT record."
return
1
return
1
fi
fi
...
@@ -169,7 +169,7 @@ _gandi_livedns_rest() {
...
@@ -169,7 +169,7 @@ _gandi_livedns_rest() {
if
[
-n
"
$GANDI_LIVEDNS_TOKEN
"
]
;
then
if
[
-n
"
$GANDI_LIVEDNS_TOKEN
"
]
;
then
export
_H2
=
"Authorization: Bearer
$GANDI_LIVEDNS_TOKEN
"
export
_H2
=
"Authorization: Bearer
$GANDI_LIVEDNS_TOKEN
"
else
else
export
_H2
=
"
X-
Api
-K
ey
:
$GANDI_LIVEDNS_KEY
"
export
_H2
=
"
Authorization:
Api
k
ey
$GANDI_LIVEDNS_KEY
"
fi
fi
if
[
"
$m
"
=
"GET"
]
;
then
if
[
"
$m
"
=
"GET"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment