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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.libnetworkcache
Commits
08b53cb3
Commit
08b53cb3
authored
Sep 02, 2011
by
Łukasz Nowak
2
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'
))
Julien Muchembled
@jm
mentioned in commit
765d4737
·
Mar 30, 2022
mentioned in commit
765d4737
mentioned in commit 765d47374e6c48a0e812775fad51fec25a4e04fc
Toggle commit list
Thomas Gambier
🚴🏼
@tomo
mentioned in commit
364fd8e9
·
Mar 30, 2022
mentioned in commit
364fd8e9
mentioned in commit 364fd8e9eaad3ce58de7ac0355e3f1d9bb835ab0
Toggle commit 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