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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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')
SITE_PORT
=
config
.
get
(
'store'
,
'site_port'
)
# Temporary dir for tar.gz
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
(
'/'
)
@force_ssl
def
index
():
response
=
"NONE"
try
:
response
=
request
.
environ
i
.
get
(
'SSL_CLIENT_VERIFY'
,
'NONE'
)
response
=
request
.
environ
.
get
(
'SSL_CLIENT_VERIFY'
,
'NONE'
)
except
:
pass
return
"It works! SSL: "
+
response
# @route('/<neptun:re:[a-zA-Z0-9]{6}>', method='GET')
@route
(
'/<neptun>'
,
method
=
'GET'
)
@force_ssl
def
neptun_GET
(
neptun
):
home_path
=
'/home/'
+
neptun
+
'/home'
if
os
.
path
.
exists
(
home_path
)
!=
True
:
...
...
@@ -47,6 +66,7 @@ def neptun_GET(neptun):
COMMANDS
=
{}
@route
(
'/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
neptun_POST
(
neptun
):
# Check if user avaiable (home folder ready)
home_path
=
'/home/'
+
neptun
+
'/home'
...
...
@@ -180,6 +200,7 @@ def cmd_toplist(request, neptun, home_path):
COMMANDS
[
'TOPLIST'
]
=
cmd_toplist
@route
(
'/set/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
set_keys
(
neptun
):
key_list
=
[]
smb_password
=
''
...
...
@@ -198,6 +219,7 @@ def set_keys(neptun):
@route
(
'/new/<neptun>'
,
method
=
'POST'
)
@force_ssl
def
new_user
(
neptun
):
key_list
=
[]
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