Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Léo-Paul Géneau
slapos.core
Commits
73562467
Commit
73562467
authored
Jul 04, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configure client: login is not needed
parent
ffaf4491
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
slapos/cli/configure_client.py
slapos/cli/configure_client.py
+6
-22
No files found.
slapos/cli/configure_client.py
View file @
73562467
...
...
@@ -33,13 +33,12 @@ import sys
import
uuid
import
requests
from
caucase.cli_flask
import
CertificateAuthorityRequest
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.util
import
mkdir_p
from
slapos.certificate
import
(
parse_certificate_from_html
,
generateCertificateRequest
,
generatePkey
)
generateP
rivate
key
)
class
ConfigureClientCommand
(
ClientConfigCommand
):
...
...
@@ -67,16 +66,11 @@ class ConfigureClientCommand(ClientConfigCommand):
return
ap
def
take_action
(
self
,
args
):
if
not
args
.
login
:
parser
.
error
(
'Please enter your username on SlapOS Master Web. Use --login LOGIN'
)
parser
.
print_help
()
return
do_configure_client
(
logger
=
self
.
app
.
log
,
master_url_web
=
args
.
master_url_web
,
token
=
args
.
token
,
config_path
=
self
.
config_path
(
args
),
master_url
=
args
.
master_url
,
login
=
args
.
login
)
master_url
=
args
.
master_url
)
def
sign_certificate
(
logger
,
master_url_web
,
csr
,
token
):
...
...
@@ -120,26 +114,17 @@ def do_configure_client(logger, master_url_web, token, config_path, master_url):
mkdir_p
(
basedir
,
mode
=
0o700
)
cert_path
=
os
.
path
.
join
(
basedir
,
'client.crt'
)
if
os
.
path
.
exists
(
cert_path
):
logger
.
critical
(
'There is a certificate in %s. '
'Please remove it before creating a new certificate.'
,
cert_path
)
sys
.
exit
(
1
)
key_path
=
os
.
path
.
join
(
basedir
,
'client.key'
)
if
os
.
path
.
exists
(
key_path
):
if
os
.
path
.
exists
(
cert_path
):
if
os
.
path
.
exists
(
cert_path
):
logger
.
critical
(
'There is a certificate in %s. '
'Please remove it before creating a new certificate.'
,
cert_path
)
logger
.
critical
(
'There is a key in %s. '
'Please remove it before creating a new key.'
,
key_path
)
sys
.
exit
(
1
)
ca_cert_path
=
os
.
path
.
join
(
basedir
,
'ca.crt'
)
# create certificate authority client
ca_client
=
CertificateAuthorityRequest
(
key_path
,
cert_path
,
ca_cert_path
,
ca_url
=
''
)
logger
.
debug
(
'Generating key to %s'
,
key_path
)
key_string
=
generatePrivatekey
(
key_path
,
size
=
2048
)
csr_string
=
generateCertificateRequest
(
...
...
@@ -147,7 +132,6 @@ def do_configure_client(logger, master_url_web, token, config_path, master_url):
cn
=
str
(
uuid
.
uuid4
()))
# retrieve a template for the configuration file
cfg
=
fetch_configuration_template
()
cfg
=
re
.
sub
(
'master_url = .*'
,
'master_url = %s'
%
master_url
,
cfg
)
...
...
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