From b113dcc1813d6a196cf9647d542b8ce726cd35e0 Mon Sep 17 00:00:00 2001 From: Yujian Zhu Date: Sat, 1 Dec 2018 17:09:38 +0800 Subject: [PATCH 01/10] Let web server not run on debug mode. --- web/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/web.py b/web/web.py index ceab7f4..88082ab 100755 --- a/web/web.py +++ b/web/web.py @@ -732,4 +732,4 @@ if __name__ == '__main__': elif opt in ("-p", "--port"): webport = int(arg) -app.run(host = webip, port = webport, debug = True, threaded=True) +app.run(host = webip, port = webport, threaded=True) From f899a04252f4661a9716af20f30547e9e1f597f6 Mon Sep 17 00:00:00 2001 From: zhuyj17 Date: Sun, 9 Dec 2018 23:50:57 +0800 Subject: [PATCH 02/10] update nginx_docklet.conf to forbid double slashes url --- conf/nginx_docklet.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/nginx_docklet.conf b/conf/nginx_docklet.conf index 64cf178..3e75daf 100644 --- a/conf/nginx_docklet.conf +++ b/conf/nginx_docklet.conf @@ -3,6 +3,8 @@ server listen %NGINX_PORT; server_name nginx_docklet.conf; charset UTF-8; + merge_slashes off; + rewrite (.*)//+(.*) $1/$2 permanent; index index.html index.htm; client_max_body_size 20m; location ~ ^/NginxStatus/ { From 11f0fe14d3548c8dcae2e6ffb7872086efae7df6 Mon Sep 17 00:00:00 2001 From: zhuyj17 Date: Mon, 10 Dec 2018 00:00:29 +0800 Subject: [PATCH 03/10] add header into nginx to defend clickjacking --- conf/nginx_docklet.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/nginx_docklet.conf b/conf/nginx_docklet.conf index 3e75daf..aa3d0a1 100644 --- a/conf/nginx_docklet.conf +++ b/conf/nginx_docklet.conf @@ -3,6 +3,7 @@ server listen %NGINX_PORT; server_name nginx_docklet.conf; charset UTF-8; + add_header X-Frame-Options SAMEORIGIN; merge_slashes off; rewrite (.*)//+(.*) $1/$2 permanent; index index.html index.htm; From 186a9003b2a42ec92d17581f24107fa7863dcf3c Mon Sep 17 00:00:00 2001 From: zhuyj17 Date: Mon, 10 Dec 2018 01:14:28 +0800 Subject: [PATCH 04/10] Add CsrfProtect --- prepare.sh | 1 + web/templates/addCluster.html | 4 ++-- web/templates/base_AdminLTE.html | 4 ++++ web/templates/beansapplication.html | 1 + web/templates/cloud.html | 1 + web/templates/config.html | 4 ++++ web/templates/create_notification.html | 1 + web/templates/listcontainer.html | 1 + web/templates/login.html | 1 + web/templates/notification.html | 2 ++ web/templates/register.html | 1 + web/templates/saveconfirm.html | 1 + web/templates/settings.html | 9 +++++++++ web/templates/user/activate.html | 1 + web/templates/user/info.html | 1 + web/templates/user_list.html | 3 +++ web/web.py | 3 ++- 17 files changed, 36 insertions(+), 3 deletions(-) diff --git a/prepare.sh b/prepare.sh index 0025f5b..f7b4208 100755 --- a/prepare.sh +++ b/prepare.sh @@ -23,6 +23,7 @@ apt-get install -y nodejs nodejs-legacy npm apt-get install -y etcd apt-get install -y glusterfs-client attr apt-get install -y nginx +pip3 install Flask-WTF #add ip forward echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf diff --git a/web/templates/addCluster.html b/web/templates/addCluster.html index de6ac2e..950e68d 100644 --- a/web/templates/addCluster.html +++ b/web/templates/addCluster.html @@ -38,7 +38,7 @@
- +
@@ -94,7 +94,7 @@ {{image['name']}} public {{p_user}} - {{image['size_format']}} + {{image['size_format']}} {{image['description']}}
diff --git a/web/templates/base_AdminLTE.html b/web/templates/base_AdminLTE.html index 8e6d747..b1ac314 100644 --- a/web/templates/base_AdminLTE.html +++ b/web/templates/base_AdminLTE.html @@ -117,6 +117,7 @@