Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
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
Łukasz Nowak
slapos.libnetworkcache
Commits
08b53cb3
Commit
08b53cb3
authored
Sep 02, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use slapos.cfg file instead of other arguments.
parent
bc328ce0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
slapos/signature.py
slapos/signature.py
+10
-8
No files found.
slapos/signature.py
View file @
08b53cb3
...
...
@@ -17,6 +17,7 @@ import argparse
import
os
import
subprocess
import
sys
import
ConfigParser
def
generateCertificate
(
certificate_file
,
key_file
,
common_name
):
...
...
@@ -27,6 +28,8 @@ def generateCertificate(certificate_file, key_file, common_name):
raise
ValueError
(
"Key %r exists, will not overwrite."
%
key_file
)
print
'Generating certificate for %r (key: %r, certficate: %r)'
%
(
common_name
,
key_file
,
certificate_file
)
subj
=
'/CN=%s'
%
common_name
subprocess
.
check_call
([
"openssl"
,
"req"
,
"-x509"
,
"-nodes"
,
"-days"
,
"365"
,
"-subj"
,
subj
,
"-newkey"
,
"rsa:1024"
,
"-keyout"
,
key_file
,
"-out"
,
...
...
@@ -35,13 +38,12 @@ def generateCertificate(certificate_file, key_file, common_name):
def
run
(
*
args
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'certificate_file'
,
type
=
str
,
help
=
'Certificate file to generate.'
)
parser
.
add_argument
(
'key_file'
,
type
=
str
,
help
=
'Key file to generate.'
)
parser
.
add_argument
(
'common_name'
,
type
=
str
,
help
=
"Common Name"
)
parser
.
add_argument
(
'slapos_config'
,
type
=
argparse
.
FileType
(
'r'
),
help
=
'SlapOS configuration file.'
)
config
=
ConfigParser
.
SafeConfigParser
()
option
=
parser
.
parse_args
(
list
(
args
)
or
sys
.
argv
[
1
:])
generateCertificate
(
option
.
certificate_file
,
option
.
key_file
,
option
.
common_name
)
config
.
readfp
(
option
.
slapos_config
)
generateCertificate
(
config
.
get
(
'networkcache'
,
'signature_certificate_file'
),
config
.
get
(
'networkcache'
,
'signature_private_key_file'
),
config
.
get
(
'slapos'
,
'computer_id'
))
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