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
Cédric Le Ninivin
slapos.core
Commits
5f4e470a
Commit
5f4e470a
authored
Jun 24, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slap,cli/register: verify server certificate
parent
2b481142
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
slapos/cli/register.py
slapos/cli/register.py
+3
-4
slapos/slap/hateoas.py
slapos/slap/hateoas.py
+0
-3
No files found.
slapos/cli/register.py
View file @
5f4e470a
...
@@ -140,7 +140,7 @@ class RegisterCommand(Command):
...
@@ -140,7 +140,7 @@ class RegisterCommand(Command):
def
check_credentials
(
url
,
login
,
password
):
def
check_credentials
(
url
,
login
,
password
):
"""Check if login and password are correct"""
"""Check if login and password are correct"""
req
=
requests
.
get
(
url
,
auth
=
(
login
,
password
)
,
verify
=
False
)
req
=
requests
.
get
(
url
,
auth
=
(
login
,
password
))
return
'Logout'
in
req
.
text
return
'Logout'
in
req
.
text
...
@@ -150,11 +150,10 @@ def get_certificate_key_pair(logger, master_url_web, node_name, token=None, logi
...
@@ -150,11 +150,10 @@ def get_certificate_key_pair(logger, master_url_web, node_name, token=None, logi
if
token
:
if
token
:
req
=
requests
.
post
(
'/'
.
join
([
master_url_web
,
'Person_requestComputer'
]),
req
=
requests
.
post
(
'/'
.
join
([
master_url_web
,
'Person_requestComputer'
]),
data
=
{
'title'
:
node_name
},
data
=
{
'title'
:
node_name
},
headers
=
{
'X-Access-Token'
:
token
},
headers
=
{
'X-Access-Token'
:
token
})
verify
=
False
)
else
:
else
:
register_server_url
=
'/'
.
join
([
master_url_web
,
(
"Person_requestComputer?title={}"
.
format
(
node_name
))])
register_server_url
=
'/'
.
join
([
master_url_web
,
(
"Person_requestComputer?title={}"
.
format
(
node_name
))])
req
=
requests
.
get
(
register_server_url
,
auth
=
(
login
,
password
)
,
verify
=
False
)
req
=
requests
.
get
(
register_server_url
,
auth
=
(
login
,
password
))
if
not
req
.
ok
and
'Certificate still active.'
in
req
.
text
:
if
not
req
.
ok
and
'Certificate still active.'
in
req
.
text
:
# raise a readable exception if the computer name is already used,
# raise a readable exception if the computer name is already used,
...
...
slapos/slap/hateoas.py
View file @
5f4e470a
...
@@ -101,8 +101,6 @@ class ConnectionHelper:
...
@@ -101,8 +101,6 @@ class ConnectionHelper:
else
:
else
:
cert
=
None
cert
=
None
# XXX TODO: handle host cert verify
# Old behavior was to pass empty parameters as "None" value.
# Old behavior was to pass empty parameters as "None" value.
# Behavior kept for compatibility with old slapproxies (< v1.3.3).
# Behavior kept for compatibility with old slapproxies (< v1.3.3).
# Can be removed when old slapproxies are no longer in use.
# Can be removed when old slapproxies are no longer in use.
...
@@ -114,7 +112,6 @@ class ConnectionHelper:
...
@@ -114,7 +112,6 @@ class ConnectionHelper:
req
=
method
(
url
=
url
,
req
=
method
(
url
=
url
,
params
=
params
,
params
=
params
,
cert
=
cert
,
cert
=
cert
,
verify
=
False
,
data
=
data
,
data
=
data
,
headers
=
headers
,
headers
=
headers
,
timeout
=
self
.
timeout
)
timeout
=
self
.
timeout
)
...
...
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