Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
d19bc328
Unverified
Commit
d19bc328
authored
Jul 29, 2018
by
neil
Committed by
GitHub
Jul 29, 2018
Browse files
Merge pull request #1745 from oldium/add-lexicon-rm
Added dns_lexicon_rm command
parents
150029a5
43694028
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_lexicon.sh
View file @
d19bc328
...
@@ -7,20 +7,13 @@ lexicon_cmd="lexicon"
...
@@ -7,20 +7,13 @@ lexicon_cmd="lexicon"
wiki
=
"https://github.com/Neilpang/acme.sh/wiki/How-to-use-lexicon-dns-api"
wiki
=
"https://github.com/Neilpang/acme.sh/wiki/How-to-use-lexicon-dns-api"
######## Public functions #####################
_lexicon_init
()
{
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_lexicon_add
()
{
fulldomain
=
$1
txtvalue
=
$2
domain
=
$(
printf
"%s"
"
$fulldomain
"
|
cut
-d
.
-f
2-999
)
if
!
_exists
"
$lexicon_cmd
"
;
then
if
!
_exists
"
$lexicon_cmd
"
;
then
_err
"Please install
$lexicon_cmd
first:
$wiki
"
_err
"Please install
$lexicon_cmd
first:
$wiki
"
return
1
return
1
fi
fi
PROVIDER
=
"
${
PROVIDER
:-
$(
_readdomainconf PROVIDER
)
}
"
if
[
-z
"
$PROVIDER
"
]
;
then
if
[
-z
"
$PROVIDER
"
]
;
then
PROVIDER
=
""
PROVIDER
=
""
_err
"Please define env PROVIDER first:
$wiki
"
_err
"Please define env PROVIDER first:
$wiki
"
...
@@ -33,46 +26,73 @@ dns_lexicon_add() {
...
@@ -33,46 +26,73 @@ dns_lexicon_add() {
# e.g. busybox-ash does not know [:upper:]
# e.g. busybox-ash does not know [:upper:]
# shellcheck disable=SC2018,SC2019
# shellcheck disable=SC2018,SC2019
Lx_name
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_USERNAME |
tr
'a-z'
'A-Z'
)
Lx_name
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_USERNAME |
tr
'a-z'
'A-Z'
)
eval
"
$Lx_name
=
\$
{
$Lx_name
:-
$(
_readaccountconf_mutable
"
$Lx_name
"
)
}"
Lx_name_v
=
$(
eval echo
\$
"
$Lx_name
"
)
Lx_name_v
=
$(
eval echo
\$
"
$Lx_name
"
)
_secure_debug
"
$Lx_name
"
"
$Lx_name_v
"
_secure_debug
"
$Lx_name
"
"
$Lx_name_v
"
if
[
"
$Lx_name_v
"
]
;
then
if
[
"
$Lx_name_v
"
]
;
then
_saveaccountconf
"
$Lx_name
"
"
$Lx_name_v
"
_saveaccountconf
_mutable
"
$Lx_name
"
"
$Lx_name_v
"
eval export
"
$Lx_name
"
eval export
"
$Lx_name
"
fi
fi
# shellcheck disable=SC2018,SC2019
# shellcheck disable=SC2018,SC2019
Lx_token
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_TOKEN |
tr
'a-z'
'A-Z'
)
Lx_token
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_TOKEN |
tr
'a-z'
'A-Z'
)
eval
"
$Lx_token
=
\$
{
$Lx_token
:-
$(
_readaccountconf_mutable
"
$Lx_token
"
)
}"
Lx_token_v
=
$(
eval echo
\$
"
$Lx_token
"
)
Lx_token_v
=
$(
eval echo
\$
"
$Lx_token
"
)
_secure_debug
"
$Lx_token
"
"
$Lx_token_v
"
_secure_debug
"
$Lx_token
"
"
$Lx_token_v
"
if
[
"
$Lx_token_v
"
]
;
then
if
[
"
$Lx_token_v
"
]
;
then
_saveaccountconf
"
$Lx_token
"
"
$Lx_token_v
"
_saveaccountconf
_mutable
"
$Lx_token
"
"
$Lx_token_v
"
eval export
"
$Lx_token
"
eval export
"
$Lx_token
"
fi
fi
# shellcheck disable=SC2018,SC2019
# shellcheck disable=SC2018,SC2019
Lx_password
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_PASSWORD |
tr
'a-z'
'A-Z'
)
Lx_password
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_PASSWORD |
tr
'a-z'
'A-Z'
)
eval
"
$Lx_password
=
\$
{
$Lx_password
:-
$(
_readaccountconf_mutable
"
$Lx_password
"
)
}"
Lx_password_v
=
$(
eval echo
\$
"
$Lx_password
"
)
Lx_password_v
=
$(
eval echo
\$
"
$Lx_password
"
)
_secure_debug
"
$Lx_password
"
"
$Lx_password_v
"
_secure_debug
"
$Lx_password
"
"
$Lx_password_v
"
if
[
"
$Lx_password_v
"
]
;
then
if
[
"
$Lx_password_v
"
]
;
then
_saveaccountconf
"
$Lx_password
"
"
$Lx_password_v
"
_saveaccountconf
_mutable
"
$Lx_password
"
"
$Lx_password_v
"
eval export
"
$Lx_password
"
eval export
"
$Lx_password
"
fi
fi
# shellcheck disable=SC2018,SC2019
# shellcheck disable=SC2018,SC2019
Lx_domaintoken
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_DOMAINTOKEN |
tr
'a-z'
'A-Z'
)
Lx_domaintoken
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_DOMAINTOKEN |
tr
'a-z'
'A-Z'
)
eval
"
$Lx_domaintoken
=
\$
{
$Lx_domaintoken
:-
$(
_readaccountconf_mutable
"
$Lx_domaintoken
"
)
}"
Lx_domaintoken_v
=
$(
eval echo
\$
"
$Lx_domaintoken
"
)
Lx_domaintoken_v
=
$(
eval echo
\$
"
$Lx_domaintoken
"
)
_secure_debug
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
_secure_debug
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
if
[
"
$Lx_domaintoken_v
"
]
;
then
if
[
"
$Lx_domaintoken_v
"
]
;
then
_saveaccountconf_mutable
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
eval export
"
$Lx_domaintoken
"
eval export
"
$Lx_domaintoken
"
_saveaccountconf
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
fi
fi
}
######## Public functions #####################
#Usage: dns_lexicon_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_lexicon_add
()
{
fulldomain
=
$1
txtvalue
=
$2
if
!
_lexicon_init
;
then
return
1
fi
domain
=
$(
printf
"%s"
"
$fulldomain
"
|
cut
-d
.
-f
2-999
)
$lexicon_cmd
"
$PROVIDER
"
create
"
${
domain
}
"
TXT
--name
=
"_acme-challenge.
${
domain
}
."
--content
=
"
${
txtvalue
}
"
$lexicon_cmd
"
$PROVIDER
"
create
"
${
domain
}
"
TXT
--name
=
"_acme-challenge.
${
domain
}
."
--content
=
"
${
txtvalue
}
"
}
}
#
fulldomain
#
Usage: dns_lexicon_rm _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_lexicon_rm
()
{
dns_lexicon_rm
()
{
fulldomain
=
$1
fulldomain
=
$1
txtvalue
=
$2
if
!
_lexicon_init
;
then
return
1
fi
domain
=
$(
printf
"%s"
"
$fulldomain
"
|
cut
-d
.
-f
2-999
)
$lexicon_cmd
"
$PROVIDER
"
delete
"
${
domain
}
"
TXT
--name
=
"_acme-challenge.
${
domain
}
."
--content
=
"
${
txtvalue
}
"
}
}
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