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
Xavier Thompson
slapos.core
Commits
5077a602
Commit
5077a602
authored
Jun 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
node register: token auth by default
parent
0d8decd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
slapos/cli/register.py
slapos/cli/register.py
+7
-4
slapos/register/register.py
slapos/register/register.py
+13
-12
No files found.
slapos/cli/register.py
View file @
5077a602
...
@@ -51,9 +51,13 @@ class RegisterCommand(Command):
...
@@ -51,9 +51,13 @@ class RegisterCommand(Command):
ap
.
add_argument
(
'--ipv6-interface'
,
ap
.
add_argument
(
'--ipv6-interface'
,
help
=
'Interface name to get ipv6'
)
help
=
'Interface name to get ipv6'
)
ap
.
add_argument
(
'--login-auth'
,
action
=
'store_true'
,
help
=
'Force login and password authentication'
)
ap
.
add_argument
(
'--login'
,
ap
.
add_argument
(
'--login'
,
help
=
"Your SlapOS Master login. If not provided, "
help
=
'Your SlapOS Master login. '
"asks it interactively, then password."
)
'Asks it interactively, then password.'
)
ap
.
add_argument
(
'--password'
,
ap
.
add_argument
(
'--password'
,
help
=
'Your SlapOS Master password. If not provided, '
help
=
'Your SlapOS Master password. If not provided, '
...
@@ -61,8 +65,7 @@ class RegisterCommand(Command):
...
@@ -61,8 +65,7 @@ class RegisterCommand(Command):
'should be avoided for security reasons.'
)
'should be avoided for security reasons.'
)
ap
.
add_argument
(
'--token'
,
ap
.
add_argument
(
'--token'
,
help
=
"SlapOS 'computer security' authentication token "
help
=
"SlapOS 'computer security' authentication token"
)
"(use '--token ask' for interactive prompt)"
)
ap
.
add_argument
(
'-t'
,
'--create-tap'
,
ap
.
add_argument
(
'-t'
,
'--create-tap'
,
action
=
'store_true'
,
action
=
'store_true'
,
...
...
slapos/register/register.py
View file @
5077a602
...
@@ -79,6 +79,10 @@ def get_certificate_key_pair(logger, master_url_web, node_name, token=None, logi
...
@@ -79,6 +79,10 @@ def get_certificate_key_pair(logger, master_url_web, node_name, token=None, logi
msg
=
'Please check username and password.'
msg
=
'Please check username and password.'
logger
.
critical
(
'Access denied to the SlapOS Master. %s'
,
msg
)
logger
.
critical
(
'Access denied to the SlapOS Master. %s'
,
msg
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
elif
not
req
.
ok
and
'NotImplementedError'
in
req
.
text
and
not
token
:
logger
.
critical
(
'This SlapOS server does not support login/password '
'authentication. Please use the token.'
)
sys
.
exit
(
1
)
else
:
else
:
req
.
raise_for_status
()
req
.
raise_for_status
()
...
@@ -251,18 +255,7 @@ def gen_auth(conf):
...
@@ -251,18 +255,7 @@ def gen_auth(conf):
def
do_register
(
conf
):
def
do_register
(
conf
):
"""Register new computer on SlapOS Master and generate slapos.cfg"""
"""Register new computer on SlapOS Master and generate slapos.cfg"""
if
conf
.
token
==
'ask'
:
if
conf
.
login
or
conf
.
login_auth
:
while
True
:
conf
.
token
=
raw_input
(
'Computer security token: '
).
strip
()
if
conf
.
token
:
break
if
conf
.
token
:
certificate
,
key
=
get_certificate_key_pair
(
conf
.
logger
,
conf
.
master_url_web
,
conf
.
node_name
,
token
=
conf
.
token
)
else
:
for
login
,
password
in
gen_auth
(
conf
):
for
login
,
password
in
gen_auth
(
conf
):
if
check_credentials
(
conf
.
master_url_web
,
login
,
password
):
if
check_credentials
(
conf
.
master_url_web
,
login
,
password
):
break
break
...
@@ -275,6 +268,14 @@ def do_register(conf):
...
@@ -275,6 +268,14 @@ def do_register(conf):
conf
.
node_name
,
conf
.
node_name
,
login
=
login
,
login
=
login
,
password
=
password
)
password
=
password
)
else
:
while
not
conf
.
token
:
conf
.
token
=
raw_input
(
'Computer security token: '
).
strip
()
certificate
,
key
=
get_certificate_key_pair
(
conf
.
logger
,
conf
.
master_url_web
,
conf
.
node_name
,
token
=
conf
.
token
)
# get computer id
# get computer id
COMP
=
get_computer_name
(
certificate
)
COMP
=
get_computer_name
(
certificate
)
...
...
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