Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acme-dns-tiny
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
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!
...
@@ -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
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.
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.
audited by anyone who wants to run it.
If you want to add features for your own setup to make things easier for you,
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):
...
@@ -51,7 +51,8 @@ def get_crt(config, log=LOGGER):
protected
[
"nonce"
]
=
nonce
or
requests
.
get
(
acme_config
[
"newNonce"
]).
headers
[
'Replay-Nonce'
]
protected
[
"nonce"
]
=
nonce
or
requests
.
get
(
acme_config
[
"newNonce"
]).
headers
[
'Replay-Nonce'
]
protected
[
"url"
]
=
url
protected
[
"url"
]
=
url
if
url
==
acme_config
[
"newAccount"
]:
if
url
==
acme_config
[
"newAccount"
]:
del
protected
[
"kid"
]
if
"kid"
in
protected
:
del
protected
[
"kid"
]
else
:
else
:
del
protected
[
"jwk"
]
del
protected
[
"jwk"
]
protected64
=
_base64
(
json
.
dumps
(
protected
).
encode
(
"utf8"
))
protected64
=
_base64
(
json
.
dumps
(
protected
).
encode
(
"utf8"
))
...
@@ -60,7 +61,8 @@ def get_crt(config, log=LOGGER):
...
@@ -60,7 +61,8 @@ def get_crt(config, log=LOGGER):
jose
=
{
jose
=
{
"protected"
:
protected64
,
"payload"
:
payload64
,
"signature"
:
_base64
(
signature
)
"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
{})
joseheaders
.
update
(
extra_headers
or
{})
try
:
try
:
response
=
requests
.
post
(
url
,
json
=
jose
,
headers
=
joseheaders
)
response
=
requests
.
post
(
url
,
json
=
jose
,
headers
=
joseheaders
)
...
@@ -68,9 +70,10 @@ def get_crt(config, log=LOGGER):
...
@@ -68,9 +70,10 @@ def get_crt(config, log=LOGGER):
response
=
error
.
response
response
=
error
.
response
finally
:
finally
:
nonce
=
response
.
headers
[
'Replay-Nonce'
]
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
,
json
.
dumps
({})
return
response
,
response
.
json
()
# main code
# main code
adtheaders
=
{
'User-Agent'
:
'acme-dns-tiny/2.1'
,
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):
...
@@ -23,12 +23,15 @@ class TestACMEAccountRollover(unittest.TestCase):
#pylint: disable=bare-except
#pylint: disable=bare-except
@
classmethod
@
classmethod
def
tearDownClass
(
cls
):
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
# Remove temporary files
parser
=
configparser
.
ConfigParser
()
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
cls
.
configs
[
'config'
])
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
:
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
except
:
except
:
...
...
tests/staging_test_acme_dns_tiny.py
View file @
88a97708
...
@@ -44,17 +44,17 @@ class TestACMEDNSTiny(unittest.TestCase):
...
@@ -44,17 +44,17 @@ class TestACMEDNSTiny(unittest.TestCase):
parser
=
configparser
.
ConfigParser
()
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
cls
.
configs
[
conffile
])
parser
.
read
(
cls
.
configs
[
conffile
])
try
:
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
:
except
:
pass
pass
try
:
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"
CSR
File"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"
AccountKey
File"
])
except
:
except
:
pass
pass
try
:
try
:
# for each configuration, deactivate the account key
os
.
remove
(
parser
[
"acmednstiny"
][
"CSRFile"
])
if
conffile
!=
"cname_csr"
:
account_deactivate
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
],
ACME_DIRECTORY
)
except
:
except
:
pass
pass
try
:
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