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
88a97708
Commit
88a97708
authored
Jun 03, 2020
by
Adrien Dorsaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acme_dns_tiny/tests: fixes issues introduced by updates made for pylint
parent
6b454a54
Pipeline
#267
failed with stages
in 21 minutes and 38 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
13 deletions
+19
-13
README.md
README.md
+1
-1
acme_dns_tiny.py
acme_dns_tiny.py
+7
-4
tests/staging_test_acme_account_rollover.py
tests/staging_test_acme_account_rollover.py
+6
-3
tests/staging_test_acme_dns_tiny.py
tests/staging_test_acme_dns_tiny.py
+5
-5
No files found.
README.md
View file @
88a97708
...
...
@@ -67,7 +67,7 @@ above files. This user should *NOT* have access to your domain key!
This project has a very, very limited scope and codebase. The project is happy
to receive bug reports and pull requests, but please don't add any new features.
This script must stay under ~
25
0 lines of code to ensure it can be easily
This script must stay under ~
40
0 lines of code to ensure it can be easily
audited by anyone who wants to run it.
If you want to add features for your own setup to make things easier for you,
...
...
acme_dns_tiny.py
View file @
88a97708
...
...
@@ -51,7 +51,8 @@ def get_crt(config, 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
=
_base64
(
json
.
dumps
(
protected
).
encode
(
"utf8"
))
...
...
@@ -60,7 +61,8 @@ def get_crt(config, log=LOGGER):
jose
=
{
"protected"
:
protected64
,
"payload"
:
payload64
,
"signature"
:
_base64
(
signature
)
}
joseheaders
=
{
'Content-Type'
:
'application/jose+json'
}.
update
(
adtheaders
)
joseheaders
=
{
'Content-Type'
:
'application/jose+json'
}
joseheaders
.
update
(
adtheaders
)
joseheaders
.
update
(
extra_headers
or
{})
try
:
response
=
requests
.
post
(
url
,
json
=
jose
,
headers
=
joseheaders
)
...
...
@@ -68,9 +70,10 @@ def get_crt(config, 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'
,
...
...
tests/staging_test_acme_account_rollover.py
View file @
88a97708
...
...
@@ -23,12 +23,15 @@ class TestACMEAccountRollover(unittest.TestCase):
#pylint: disable=bare-except
@
classmethod
def
tearDownClass
(
cls
):
# deactivate account key registration at end of tests
# (we assume the key has been roll oved)
account_deactivate
(
cls
.
configs
[
"newaccountkey"
],
ACME_DIRECTORY
)
# Remove temporary files
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
cls
.
configs
[
'config'
])
try
:
# deactivate account key registration at end of tests
# (we assume the key has been rolled over)
account_deactivate
(
cls
.
configs
[
"new_account_key"
],
ACME_DIRECTORY
)
except
:
pass
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
except
:
...
...
tests/staging_test_acme_dns_tiny.py
View file @
88a97708
...
...
@@ -44,17 +44,17 @@ class TestACMEDNSTiny(unittest.TestCase):
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
cls
.
configs
[
conffile
])
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
# for each configuration, deactivate the account key
if
conffile
!=
"cname_csr"
:
account_deactivate
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
],
ACME_DIRECTORY
)
except
:
pass
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"
CSR
File"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"
AccountKey
File"
])
except
:
pass
try
:
# for each configuration, deactivate the account key
if
conffile
!=
"cname_csr"
:
account_deactivate
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
],
ACME_DIRECTORY
)
os
.
remove
(
parser
[
"acmednstiny"
][
"CSRFile"
])
except
:
pass
try
:
...
...
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