Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cryptocoryne
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
Cryptocoryne
Commits
db619244
Commit
db619244
authored
7 months ago
by
Hannes Feldt
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_renewal' into 'main'
L2SS-2098
: Fix various issues happening during renewal Closes
L2SS-2098
See merge request
!4
parents
1f95f89a
ab21a757
Branches
Branches containing commit
Tags
v0.1.0
Tags containing commit
1 merge request
!4
L2SS-2098: Fix various issues happening during renewal
Pipeline
#104099
passed with warnings
7 months ago
Stage: prepare
Stage: lint
Stage: test
Stage: package
Stage: images
Stage: integration
Stage: publish
Stage: deploy
Pipeline: Cryptocoryne
#104100
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lofar_cryptocoryne/cli.py
+7
-3
7 additions, 3 deletions
lofar_cryptocoryne/cli.py
lofar_cryptocoryne/client.py
+12
-6
12 additions, 6 deletions
lofar_cryptocoryne/client.py
tests/test_client.py
+2
-2
2 additions, 2 deletions
tests/test_client.py
with
21 additions
and
11 deletions
lofar_cryptocoryne/cli.py
+
7
−
3
View file @
db619244
...
...
@@ -3,6 +3,7 @@
"""
Cryptocoryne certbot cli entrypoint
"""
import
acme.errors
import
hvac
import
lofar_cryptocoryne.dns_client
as
desec
...
...
@@ -37,14 +38,17 @@ def main():
print
(
"
Waiting for DNS to propagate...
"
)
if
client
.
check_dns_propagation
(
timeout
=
1200
):
print
(
"
Succeed. Request certificate
"
)
client
.
request_certificate
()
certificate
.
fullchain
=
client
.
certificate
.
decode
()
client
.
request_certificate
(
wait
=
10
)
certificate
.
fullchain
=
client
.
certificate
certificate
.
key
=
client
.
private_key
vault_store
.
put_certificate
(
certificate
)
print
(
"
Done
"
)
else
:
print
(
"
Failed to issue certificate for
"
+
str
(
client
.
domains
))
except
acme
.
errors
.
ValidationError
as
ve
:
print
(
f
"
ValidationError:
{
ve
.
failed_authzrs
}
"
)
except
Exception
as
e
:
# pylint: disable=broad-exception-caught
print
(
e
)
print
(
f
"
{
type
(
e
)
}
:
{
e
}
"
)
finally
:
dns_client
.
cleanup
()
This diff is collapsed.
Click to expand it.
lofar_cryptocoryne/client.py
+
12
−
6
View file @
db619244
...
...
@@ -3,12 +3,15 @@
"""
Various clients
"""
import
socket
from
urllib.parse
import
urlparse
import
consul
import
josepy
as
jose
import
simple_acme_dns
from
acme
import
client
as
acme_client
from
acme
import
messages
import
simple_acme_dns
import
josepy
as
jose
import
consul
import
lofar_cryptocoryne.dns_client
as
desec
...
...
@@ -27,7 +30,10 @@ def get_service_certificates() -> [(str, [str])]:
class
DnsClient
:
"""
DNS client
"""
DNS_SERVERS
=
[
"
ns1.desec.io
"
,
"
ns2.desec.org
"
]
DNS_SERVERS
=
[
socket
.
gethostbyname
(
"
ns1.desec.io
"
),
socket
.
gethostbyname
(
"
ns2.desec.org
"
),
]
"""
Client to access the dns providers API
"""
def
__init__
(
self
,
desec_client
:
desec
.
APIClient
):
...
...
@@ -38,8 +44,8 @@ class DnsClient:
"""
Setup DNS TXT records to verify given domain with given tokens
"""
zone
=
self
.
desec_client
.
get_authoritative_domain
(
verify_domain
)
subname
=
verify_domain
.
rsplit
(
zone
[
"
name
"
],
1
)[
0
].
rstrip
(
"
.
"
)
self
.
desec_client
.
change
_record
(
zone
[
"
name
"
],
"
TXT
"
,
subname
,
[
f
'"
{
tokens
[
0
]
}
"'
]
self
.
desec_client
.
add
_record
(
zone
[
"
name
"
],
"
TXT
"
,
subname
,
[
f
'"
{
tokens
[
0
]
}
"'
]
,
3600
)
self
.
cleanups
.
append
(
lambda
d
=
zone
[
"
name
"
],
sn
=
subname
:
self
.
desec_client
.
delete_record
(
...
...
This diff is collapsed.
Click to expand it.
tests/test_client.py
+
2
−
2
View file @
db619244
...
...
@@ -39,8 +39,8 @@ class TestDnsClient(TestCase):
desec_client_mock
.
get_authoritative_domain
.
assert_called_once_with
(
"
verify.lofar.net
"
)
desec_client_mock
.
change
_record
.
assert_called_once_with
(
"
lofar.net
"
,
"
TXT
"
,
"
verify
"
,
[
'"
token
"'
]
desec_client_mock
.
add
_record
.
assert_called_once_with
(
"
lofar.net
"
,
"
TXT
"
,
"
verify
"
,
[
'"
token
"'
]
,
3600
)
assert
len
(
dns_client
.
cleanups
)
==
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment