From b622b0fd9a53f51d44e041f9a45abe6c4343707a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szekeres=20Ba=CC=81lint?= Date: Thu, 26 Jul 2018 13:24:00 +0200 Subject: [PATCH] added Drupal --- README.md | 3 +- public/assets/img/brands/drupal.svg | 1 + public/assets/js/app.js | 9 +++++ public/index.html | 38 ++++++++++++++++----- public/templates/conf/_drupal.conf.html | 20 +++++++++++ public/templates/conf/_wordpress.conf.html | 14 ++++---- public/templates/conf/example.com.conf.html | 6 +++- 7 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 public/assets/img/brands/drupal.svg create mode 100644 public/templates/conf/_drupal.conf.html diff --git a/README.md b/README.md index c6045f3..805e999 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Online nginx configuration generator. * redirect subdomains * IPv4, IPv6 * PHP (TCP, 5.x FPM, 7.0 FPM, 7.1 FPM, 7.2 FPM, 7.3 FPM) -* WordPress security essentials (*including [CVE-2018-6389](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6389)*) +* WordPress security essentials +* Drupal security essentials * pass requests to index.php * *[Laravel](https://laravel.com/docs/master/deployment#nginx)* * *[Lumen](https://lumen.laravel.com/docs/5.1/installation#configuration)* diff --git a/public/assets/img/brands/drupal.svg b/public/assets/img/brands/drupal.svg new file mode 100644 index 0000000..7a40bea --- /dev/null +++ b/public/assets/img/brands/drupal.svg @@ -0,0 +1 @@ +Drupal icon \ No newline at end of file diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 094fe74..e4c1585 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -61,6 +61,7 @@ php: '7.2', wordpress: false, + drupal: false, file_structure: 'unified', @@ -278,6 +279,7 @@ $scope.setPreset = function(preset) { $scope.data.php = $scope.defaultData.php; $scope.data.wordpress = $scope.defaultData.wordpress; + $scope.data.drupal = $scope.defaultData.drupal; $scope.data.index = $scope.defaultData.index; $scope.data.fallback_html = $scope.defaultData.fallback_html; @@ -294,6 +296,9 @@ case 'wordpress': $scope.data.wordpress = true; break; + case 'drupal': + $scope.data.drupal = true; + break; } gtag('event', preset, { @@ -394,6 +399,10 @@ return $scope.isPHP() && $scope.data.wordpress; }; + $scope.isDrupal= function() { + return $scope.isPHP() && $scope.data.drupal; + }; + $scope.isCSP = function() { return !!$scope.data.content_security_policy; }; diff --git a/public/index.html b/public/index.html index 27783c3..49dffd9 100644 --- a/public/index.html +++ b/public/index.html @@ -8,9 +8,9 @@ nginxconfig.io - + - + @@ -25,7 +25,8 @@ - + +
@@ -252,7 +253,15 @@
+
+
+
+
+ +
@@ -267,7 +276,7 @@
-
+
@@ -280,13 +289,16 @@
-
+
-
+
- +
@@ -492,6 +504,16 @@
+
+ /etc/nginx/_drupal.conf + + Copied! +
+
+
+
diff --git a/public/templates/conf/_drupal.conf.html b/public/templates/conf/_drupal.conf.html new file mode 100644 index 0000000..938bbfc --- /dev/null +++ b/public/templates/conf/_drupal.conf.html @@ -0,0 +1,20 @@ +# Drupal: deny private files +location ~ ^/sites/.*/private/ { + deny all; +} + +# Drupal: deny php in files +location ~ ^/sites/[^/]+/files/.*\.php$ { + deny all; +} + +# Drupal: deny php in vendor +location ~ /vendor/.*\.php$ { + deny all; +} + +# Drupal: throttle user functions +location ~ ^/user/(?:login|register|password) { + limit_req zone=login burst=2 nodelay; + try_files $uri /index.php?$query_string; +} diff --git a/public/templates/conf/_wordpress.conf.html b/public/templates/conf/_wordpress.conf.html index dc00feb..60fc54b 100644 --- a/public/templates/conf/_wordpress.conf.html +++ b/public/templates/conf/_wordpress.conf.html @@ -1,34 +1,34 @@ -# allow tinymce +# WordPress: allow TinyMCE location = /wp-includes/js/tinymce/wp-tinymce.php { include _php_fastcgi.conf; } -# wp-content, wp-includes php files +# WordPress: deny wp-content, wp-includes php files location ~* ^/(?:wp-content|wp-includes)/.*\.php$ { deny all; } -# wp-content/uploads nasty stuff +# WordPress: deny wp-content/uploads nasty stuff location ~* ^/wp-content/uploads/.*\.(?:s?html?|php|js|swf)$ { deny all; } -# wp-content/plugins nasty stuff +# WordPress: deny wp-content/plugins nasty stuff location ~* ^/wp-content/plugins/.*\.(?!{{ extensions.assets }}|{{ extensions.fonts }}|{{ extensions.svg }}|{{ extensions.images }}|{{ extensions.audio }}|{{ extensions.video }}|{{ extensions.docs }}) { deny all; } -# disable scripts and styles concat +# WordPress: deny scripts and styles concat location ~* \/wp-admin\/load-(?:scripts|styles)\.php { deny all; } -# WordPress stuff +# WordPress: deny general stuff location ~* ^/(?:xmlrpc\.php|wp-links-opml\.php|wp-config\.php|wp-config-sample\.php|wp-comments-post\.php|readme\.html|license\.txt)$ { deny all; } -# wp-login.php throttle +# WordPress: throttle wp-login.php location = /wp-login.php { limit_req zone=login burst=2 nodelay; include _php_fastcgi.conf; diff --git a/public/templates/conf/example.com.conf.html b/public/templates/conf/example.com.conf.html index 5e33c1f..a20a501 100644 --- a/public/templates/conf/example.com.conf.html +++ b/public/templates/conf/example.com.conf.html @@ -80,7 +80,11 @@ server { - + + + }