Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
slapos
Commits
68b4503e
Commit
68b4503e
authored
Mar 31, 2022
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cookbook: fix serial certification generation for re6st registry
parent
667d73b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
+3
-14
slapos/recipe/re6stnet/__init__.py
slapos/recipe/re6stnet/__init__.py
+3
-14
No files found.
slapos/recipe/re6stnet/__init__.py
View file @
68b4503e
...
...
@@ -34,6 +34,7 @@ import string, random
import
json
import
traceback
from
slapos
import
slap
from
slapos.util
import
binFromIpv6
class
Recipe
(
GenericBaseRecipe
):
...
...
@@ -54,20 +55,8 @@ class Recipe(GenericBaseRecipe):
return
GenericBaseRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
getSerialFromIpv6
(
self
,
ipv6
):
prefix
=
ipv6
.
split
(
'/'
)[
0
].
lower
()
hi
,
lo
=
struct
.
unpack
(
'!QQ'
,
socket
.
inet_pton
(
socket
.
AF_INET6
,
prefix
))
ipv6_int
=
(
hi
<<
64
)
|
lo
serial
=
'0x1%x'
%
ipv6_int
# delete non significant part
for
part
in
prefix
.
split
(
':'
)[::
-
1
]:
if
part
:
for
i
in
[
'0'
]
*
(
4
-
len
(
part
)):
part
=
i
+
part
serial
=
serial
.
split
(
part
)[
0
]
+
part
break
return
serial
prefix
,
prefix_length
=
ipv6
.
split
(
'/'
)
return
"0x%x"
%
int
(
'1%s'
%
binFromIpv6
(
prefix
)[:
int
(
prefix_length
)],
2
)
def
generateCertificate
(
self
):
key_file
=
self
.
options
[
'key-file'
].
strip
()
...
...
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