Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
03ba3c5c
authored
Jan 30, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store-server: force SSL option
parent
7f43535f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
miscellaneous/store-server/CloudStore.py
+24
-2
No files found.
miscellaneous/store-server/CloudStore.py
View file @
03ba3c5c
...
@@ -23,19 +23,38 @@ SITE_HOST = config.get('store', 'site_host')
...
@@ -23,19 +23,38 @@ SITE_HOST = config.get('store', 'site_host')
SITE_PORT
=
config
.
get
(
'store'
,
'site_port'
)
SITE_PORT
=
config
.
get
(
'store'
,
'site_port'
)
# Temporary dir for tar.gz
# Temporary dir for tar.gz
TEMP_DIR
=
config
.
get
(
'store'
,
'temp_dir'
)
TEMP_DIR
=
config
.
get
(
'store'
,
'temp_dir'
)
#ForceSSL
try
:
FORCE_SSL
=
config
.
get
(
'store'
,
'force_ssl'
)
==
"True"
except
:
FORCE_SSL
=
False
def
force_ssl
(
original_function
):
def
new_function
(
*
args
,
**
kwargs
):
ssl
=
request
.
environ
.
get
(
'SSL_CLIENT_VERIFY'
,
'NONE'
)
if
ssl
!=
"SUCCESS"
:
abort
(
403
,
"Forbidden requests. This site need SSL verification! SSL status: "
+
ssl
)
else
:
return
original_function
(
*
args
,
**
kwargs
)
if
FORCE_SSL
:
return
new_function
else
:
return
original_function
(
*
args
,
**
kwargs
)
@route
(
'/'
)
@route
(
'/'
)
@force_ssl
def
index
():
def
index
():
response
=
"NONE"
response
=
"NONE"
try
:
try
:
response
=
request
.
environ
i
.
get
(
'SSL_CLIENT_VERIFY'
,
'NONE'
)
response
=
request
.
environ
.
get
(
'SSL_CLIENT_VERIFY'
,
'NONE'
)
except
:
except
:
pass
pass
return
"It works! SSL: "
+
response
return
"It works! SSL: "
+
response
# @route('/<neptun:re:[a-zA-Z0-9]{6}>', method='GET')
# @route('/<neptun:re:[a-zA-Z0-9]{6}>', method='GET')
@route
(
'/<neptun>'
,
method
=
'GET'
)
@route
(
'/<neptun>'
,
method
=
'GET'
)
@force_ssl
def
neptun_GET
(
neptun
):
def
neptun_GET
(
neptun
):
home_path
=
'/home/'
+
neptun
+
'/home'
home_path
=
'/home/'
+
neptun
+
'/home'
if
os
.
path
.
exists
(
home_path
)
!=
True
:
if
os
.
path
.
exists
(
home_path
)
!=
True
:
...
@@ -47,6 +66,7 @@ def neptun_GET(neptun):
...
@@ -47,6 +66,7 @@ def neptun_GET(neptun):
COMMANDS
=
{}
COMMANDS
=
{}
@route
(
'/<neptun>'
,
method
=
'POST'
)
@route
(
'/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
neptun_POST
(
neptun
):
def
neptun_POST
(
neptun
):
# Check if user avaiable (home folder ready)
# Check if user avaiable (home folder ready)
home_path
=
'/home/'
+
neptun
+
'/home'
home_path
=
'/home/'
+
neptun
+
'/home'
...
@@ -180,6 +200,7 @@ def cmd_toplist(request, neptun, home_path):
...
@@ -180,6 +200,7 @@ def cmd_toplist(request, neptun, home_path):
COMMANDS
[
'TOPLIST'
]
=
cmd_toplist
COMMANDS
[
'TOPLIST'
]
=
cmd_toplist
@route
(
'/set/<neptun>'
,
method
=
'POST'
)
@route
(
'/set/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
set_keys
(
neptun
):
def
set_keys
(
neptun
):
key_list
=
[]
key_list
=
[]
smb_password
=
''
smb_password
=
''
...
@@ -198,6 +219,7 @@ def set_keys(neptun):
...
@@ -198,6 +219,7 @@ def set_keys(neptun):
@route
(
'/new/<neptun>'
,
method
=
'POST'
)
@route
(
'/new/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
new_user
(
neptun
):
def
new_user
(
neptun
):
key_list
=
[]
key_list
=
[]
smbpasswd
=
''
smbpasswd
=
''
...
...
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