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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
8135944a
Commit
8135944a
authored
Jun 10, 2013
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
certificate-authority: Add ugly hack to ca request to use custom certificates instead
parent
37d067b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
slapos/recipe/certificate_authority/__init__.py
slapos/recipe/certificate_authority/__init__.py
+27
-13
No files found.
slapos/recipe/certificate_authority/__init__.py
View file @
8135944a
...
...
@@ -103,10 +103,21 @@ class Request(Recipe):
key_file
=
self
.
options
[
'key-file'
]
cert_file
=
self
.
options
[
'cert-file'
]
key_content
=
self
.
options
.
get
(
'key-content'
,
None
)
cert_content
=
self
.
options
.
get
(
'cert-content'
,
None
)
request_needed
=
True
name
=
self
.
options
[
'name'
]
hash_
=
hashlib
.
sha512
(
name
).
hexdigest
()
key
=
os
.
path
.
join
(
self
.
ca_private
,
hash_
+
self
.
ca_key_ext
)
certificate
=
os
.
path
.
join
(
self
.
ca_certs
,
hash_
+
self
.
ca_crt_ext
)
# XXX Ugly hack to quickly provide custom certificate/key to everyone using the recipe
if
key_content
and
cert_content
:
open
(
key
,
'w'
).
write
(
key_content
)
open
(
certificate
,
'w'
).
write
(
cert_content
)
request_needed
=
False
else
:
parser
=
ConfigParser
.
RawConfigParser
()
parser
.
add_section
(
'certificate'
)
parser
.
set
(
'certificate'
,
'name'
,
name
)
...
...
@@ -123,11 +134,14 @@ class Request(Recipe):
os
.
symlink
(
key
,
key_file
)
os
.
symlink
(
certificate
,
cert_file
)
path_list
=
[
key_file
,
cert_file
]
if
request_needed
:
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute_wait'
,
[
[
self
.
options
[
'executable'
]],
[
certificate
,
key
]
],
)
path_list
.
append
(
wrapper
)
return
[
key_file
,
cert_file
,
wrapper
]
return
path_list
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