Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Adrien Dorsaz
acme-dns-tiny
Commits
e1fe3ad7
Commit
e1fe3ad7
authored
Jun 03, 2020
by
Adrien Dorsaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unify send_request between the different tools, add pragma nocover to tests and pass to version 2.2
parent
1ae4370d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
17 deletions
+20
-17
acme_dns_tiny.py
acme_dns_tiny.py
+4
-3
tests/staging_test_acme_account_deactivate.py
tests/staging_test_acme_account_deactivate.py
+1
-1
tests/staging_test_acme_account_rollover.py
tests/staging_test_acme_account_rollover.py
+1
-1
tests/staging_test_acme_dns_tiny.py
tests/staging_test_acme_dns_tiny.py
+1
-1
tests/unit_test_acme_dns_tiny.py
tests/unit_test_acme_dns_tiny.py
+1
-1
tools/acme_account_deactivate.py
tools/acme_account_deactivate.py
+6
-5
tools/acme_account_rollover.py
tools/acme_account_rollover.py
+6
-5
No files found.
acme_dns_tiny.py
View file @
e1fe3ad7
...
...
@@ -76,7 +76,7 @@ def get_crt(config, log=LOGGER):
return
response
,
json
.
dumps
({})
# main code
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
1
'
,
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
2
'
,
'Accept-Language'
:
config
[
"acmednstiny"
].
get
(
"Language"
,
"en"
)}
nonce
=
None
...
...
@@ -242,8 +242,9 @@ def get_crt(config, log=LOGGER):
challenge_verified
=
(
challenge_verified
or
response
.
to_text
()
==
'"{0}"'
.
format
(
keydigest64
))
except
dns
.
exception
.
DNSException
as
dnsexception
:
log
.
debug
(
" - Will retry as a DNS error occurred while checking challenge:
\
%s : %s"
,
type
(
dnsexception
).
__name__
,
dnsexception
)
log
.
debug
(
" - Will retry as a DNS error occurred while checking challenge: %s : %s"
,
type
(
dnsexception
).
__name__
,
dnsexception
)
finally
:
if
challenge_verified
is
False
:
if
number_check_fail
>=
10
:
...
...
tests/staging_test_acme_account_deactivate.py
View file @
e1fe3ad7
...
...
@@ -53,5 +53,5 @@ class TestACMEAccountDeactivate(unittest.TestCase):
self
.
assertIn
(
"INFO:acme_account_deactivate:The account has been deactivated."
,
accountdeactivatelog
.
output
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# pragma: no cover
unittest
.
main
()
tests/staging_test_acme_account_rollover.py
View file @
e1fe3ad7
...
...
@@ -59,5 +59,5 @@ class TestACMEAccountRollover(unittest.TestCase):
self
.
assertIn
(
"INFO:acme_account_rollover:Keys rolled over."
,
accountrolloverlog
.
output
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# pragma: no cover
unittest
.
main
()
tests/staging_test_acme_dns_tiny.py
View file @
e1fe3ad7
...
...
@@ -212,5 +212,5 @@ host: we will use either resource found if one exists or directly the DNS Host c
"Error updating DNS"
,
acme_dns_tiny
.
main
,
[
self
.
configs
[
'invalid_tsig_name'
],
"--verbose"
])
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# pragma: no cover
unittest
.
main
()
tests/unit_test_acme_dns_tiny.py
View file @
e1fe3ad7
...
...
@@ -37,5 +37,5 @@ class TestACMEDNSTiny(unittest.TestCase):
self
.
assertRaisesRegex
(
ValueError
,
r
"Some required settings are missing."
,
acme_dns_tiny
.
main
,
[
self
.
configs
[
'missing_dns'
],
"--verbose"
])
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# pragma: no cover
unittest
.
main
()
tools/acme_account_deactivate.py
View file @
e1fe3ad7
...
...
@@ -41,7 +41,8 @@ def account_deactivate(accountkeypath, acme_directory, log=LOGGER):
protected
[
"nonce"
]
=
nonce
or
requests
.
get
(
acme_config
[
"newNonce"
]).
headers
[
'Replay-Nonce'
]
protected
[
"url"
]
=
url
if
url
==
acme_config
[
"newAccount"
]:
del
protected
[
"kid"
]
if
"kid"
in
protected
:
del
protected
[
"kid"
]
else
:
del
protected
[
"jwk"
]
protected64
=
_b64
(
json
.
dumps
(
protected
).
encode
(
"utf8"
))
...
...
@@ -60,12 +61,13 @@ def account_deactivate(accountkeypath, acme_directory, log=LOGGER):
response
=
error
.
response
finally
:
nonce
=
response
.
headers
[
'Replay-Nonce'
]
if
not
response
.
text
:
try
:
return
response
,
response
.
json
()
except
ValueError
:
# if body is empty or not JSON formatted
return
response
,
json
.
dumps
({})
return
response
,
response
.
json
()
# main code
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
1
'
}
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
2
'
}
nonce
=
None
log
.
info
(
"Fetch informations from the ACME directory."
)
...
...
@@ -86,7 +88,6 @@ def account_deactivate(accountkeypath, acme_directory, log=LOGGER):
"kty"
:
"RSA"
,
"n"
:
_b64
(
binascii
.
unhexlify
(
re
.
sub
(
r
"(\s|:)"
,
""
,
pub_hex
).
encode
(
"utf-8"
))),
},
"kid"
:
None
,
}
log
.
info
(
"Ask to the ACME server the account identifier to complete the private signature."
)
...
...
tools/acme_account_rollover.py
View file @
e1fe3ad7
...
...
@@ -45,7 +45,6 @@ def account_rollover(old_accountkeypath, new_accountkeypath, acme_directory, log
"kty"
:
"RSA"
,
"n"
:
_b64
(
binascii
.
unhexlify
(
re
.
sub
(
r
"(\s|:)"
,
""
,
pub_hex
).
encode
(
"utf-8"
))),
},
"kid"
:
None
}
def
_sign_request
(
url
,
keypath
,
payload
,
is_inner
=
False
):
...
...
@@ -61,7 +60,8 @@ def account_rollover(old_accountkeypath, new_accountkeypath, acme_directory, log
protected
=
copy
.
deepcopy
(
private_acme_old_signature
)
if
is_inner
or
url
==
acme_config
[
"newAccount"
]:
del
protected
[
"kid"
]
if
"kid"
in
protected
:
del
protected
[
"kid"
]
else
:
del
protected
[
"jwk"
]
...
...
@@ -91,12 +91,13 @@ def account_rollover(old_accountkeypath, new_accountkeypath, acme_directory, log
response
=
error
.
response
finally
:
nonce
=
response
.
headers
[
'Replay-Nonce'
]
if
not
response
.
text
:
try
:
return
response
,
response
.
json
()
except
ValueError
:
# if body is empty or not JSON formatted
return
response
,
json
.
dumps
({})
return
response
,
response
.
json
()
# main code
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
0
'
}
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.
2
'
}
nonce
=
None
log
.
info
(
"Fetch informations from the ACME directory."
)
...
...
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