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
Ophélie Gagnard
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
...
@@ -17,6 +17,7 @@ import argparse
import
os
import
os
import
subprocess
import
subprocess
import
sys
import
sys
import
ConfigParser
def
generateCertificate
(
certificate_file
,
key_file
,
common_name
):
def
generateCertificate
(
certificate_file
,
key_file
,
common_name
):
...
@@ -27,6 +28,8 @@ 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."
%
raise
ValueError
(
"Key %r exists, will not overwrite."
%
key_file
)
key_file
)
print
'Generating certificate for %r (key: %r, certficate: %r)'
%
(
common_name
,
key_file
,
certificate_file
)
subj
=
'/CN=%s'
%
common_name
subj
=
'/CN=%s'
%
common_name
subprocess
.
check_call
([
"openssl"
,
"req"
,
"-x509"
,
"-nodes"
,
"-days"
,
"365"
,
subprocess
.
check_call
([
"openssl"
,
"req"
,
"-x509"
,
"-nodes"
,
"-days"
,
"365"
,
"-subj"
,
subj
,
"-newkey"
,
"rsa:1024"
,
"-keyout"
,
key_file
,
"-out"
,
"-subj"
,
subj
,
"-newkey"
,
"rsa:1024"
,
"-keyout"
,
key_file
,
"-out"
,
...
@@ -35,13 +38,12 @@ def generateCertificate(certificate_file, key_file, common_name):
...
@@ -35,13 +38,12 @@ def generateCertificate(certificate_file, key_file, common_name):
def
run
(
*
args
):
def
run
(
*
args
):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'certificate_file'
,
type
=
str
,
parser
.
add_argument
(
'slapos_config'
,
type
=
argparse
.
FileType
(
'r'
),
help
=
'Certificate file to generate.'
)
help
=
'SlapOS configuration file.'
)
parser
.
add_argument
(
'key_file'
,
type
=
str
,
help
=
'Key file to generate.'
)
parser
.
add_argument
(
'common_name'
,
type
=
str
,
help
=
"Common Name"
)
config
=
ConfigParser
.
SafeConfigParser
()
option
=
parser
.
parse_args
(
list
(
args
)
or
sys
.
argv
[
1
:])
option
=
parser
.
parse_args
(
list
(
args
)
or
sys
.
argv
[
1
:])
generateCertificate
(
option
.
certificate_file
,
config
.
readfp
(
option
.
slapos_config
)
option
.
key_file
,
option
.
common_name
)
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