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
a58ef94a
Unverified
Commit
a58ef94a
authored
Dec 17, 2018
by
neil
Committed by
GitHub
Dec 17, 2018
Browse files
Merge pull request #1972 from Neilpang/dev
sync
parents
eb97cdc3
2b9ebd66
Changes
3
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
a58ef94a
...
...
@@ -1134,12 +1134,17 @@ _readSubjectAltNamesFromCSR() {
if
_contains
"
$_dnsAltnames
,"
"DNS:
$_csrsubj
,"
;
then
_debug
"AltNames contains subject"
_dnsAltnames
=
"
$(
printf
"%s"
"
$_dnsAltnames
,"
|
sed
"s/DNS:
$_csrsubj
,//g"
)
"
_excapedAlgnames
=
"
$(
echo
"
$_dnsAltnames
"
|
tr
'*'
'#'
)
"
_debug _excapedAlgnames
"
$_excapedAlgnames
"
_escapedSubject
=
"
$(
echo
"
$_csrsubj
"
|
tr
'*'
'#'
)
"
_debug _escapedSubject
"
$_escapedSubject
"
_dnsAltnames
=
"
$(
echo
"
$_excapedAlgnames
,"
|
sed
"s/DNS:
$_escapedSubject
,//g"
|
tr
'#'
'*'
|
sed
"s/,
\$
//g"
)
"
_debug _dnsAltnames
"
$_dnsAltnames
"
else
_debug
"AltNames doesn't contain subject"
fi
printf
"%s"
"
$_dnsAltnames
"
|
sed
"s/DNS://g"
echo
"
$_dnsAltnames
"
|
sed
"s/DNS://g"
}
#_csrfile
...
...
@@ -1516,7 +1521,8 @@ _calcjwk() {
JWK_HEADERPLACE_PART1
=
'{"nonce": "'
JWK_HEADERPLACE_PART2
=
'", "alg": "ES'
$__ECC_KEY_LEN
'"'
else
_err
"Only RSA or EC key is supported."
_err
"Only RSA or EC key is supported. keyfile=
$keyfile
"
_debug2
"
$(
cat
"
$keyfile
"
)
"
return
1
fi
...
...
dnsapi/README.md
View file @
a58ef94a
...
...
@@ -146,13 +146,17 @@ Finally, make the DNS server and update Key available to `acme.sh`
export NSUPDATE_SERVER="dns.example.com"
export NSUPDATE_KEY="/path/to/your/nsupdate.key"
```
and optionally (depending on DNS server)
```
export NSUPDATE_ZONE="example.com"
```
Ok, let's issue a cert now:
```
acme.sh --issue --dns dns_nsupdate -d example.com -d www.example.com
```
The
`NSUPDATE_SERVER`
and
`NSUPDATE_
KEY
`
settings will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
The
`NSUPDATE_SERVER`
,
`NSUPDATE_KEY`
,
and
`NSUPDATE_
ZONE
`
settings will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
## 8. Use LuaDNS domain API
...
...
dnsapi/dns_nsupdate.sh
View file @
a58ef94a
...
...
@@ -13,12 +13,24 @@ dns_nsupdate_add() {
_saveaccountconf NSUPDATE_SERVER
"
${
NSUPDATE_SERVER
}
"
_saveaccountconf NSUPDATE_SERVER_PORT
"
${
NSUPDATE_SERVER_PORT
}
"
_saveaccountconf NSUPDATE_KEY
"
${
NSUPDATE_KEY
}
"
_saveaccountconf NSUPDATE_ZONE
"
${
NSUPDATE_ZONE
}
"
_info
"adding
${
fulldomain
}
. 60 in txt
\"
${
txtvalue
}
\"
"
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
<<
EOF
[
-n
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"
$DEBUG_LEVEL_1
"
]
&&
nsdebug
=
"-d"
[
-n
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"
$DEBUG_LEVEL_2
"
]
&&
nsdebug
=
"-D"
if
[
-z
"
${
NSUPDATE_ZONE
}
"
]
;
then
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
$nsdebug
<<
EOF
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
update add
${
fulldomain
}
. 60 in txt "
${
txtvalue
}
"
send
EOF
else
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
$nsdebug
<<
EOF
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
zone
${
NSUPDATE_ZONE
}
.
update add
${
fulldomain
}
. 60 in txt "
${
txtvalue
}
"
send
EOF
fi
if
[
$?
-ne
0
]
;
then
_err
"error updating domain"
return
1
...
...
@@ -34,11 +46,22 @@ dns_nsupdate_rm() {
[
-n
"
${
NSUPDATE_SERVER
}
"
]
||
NSUPDATE_SERVER
=
"localhost"
[
-n
"
${
NSUPDATE_SERVER_PORT
}
"
]
||
NSUPDATE_SERVER_PORT
=
53
_info
"removing
${
fulldomain
}
. txt"
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
<<
EOF
[
-n
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"
$DEBUG_LEVEL_1
"
]
&&
nsdebug
=
"-d"
[
-n
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"
$DEBUG_LEVEL_2
"
]
&&
nsdebug
=
"-D"
if
[
-z
"
${
NSUPDATE_ZONE
}
"
]
;
then
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
$nsdebug
<<
EOF
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
update delete
${
fulldomain
}
. txt
send
EOF
else
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
$nsdebug
<<
EOF
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
zone
${
NSUPDATE_ZONE
}
.
update delete
${
fulldomain
}
. txt
send
EOF
fi
if
[
$?
-ne
0
]
;
then
_err
"error updating domain"
return
1
...
...
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