Skip to contentSkip to conversation

package/nginx: Add naxsi module option.

PATCH New Adam Duskett 2 participants 2 messages Jul 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/nginx: Add naxsi module option.

Naxsi is a third party nginx module reads a small subset of simple rules containing a list of known patterns involved in website vulnerabilities. This module behaves like a DROP-by-default firewall for nginx.

The reason for the changes to the make file was because naxsi is listed on github, and even though there is a option to specify a url for a 3rd party module, this option only seems to work for a local file url.

As such a new comment was added to the menu for external modules, and a new package that downloads and extracts the module was added under package/nginx-naxsi. This is then used with a pre-configure hook to create a soft symbolic link to the source inside of the nginx-source tree.

---
Changes:

v2 - v3:
- package/nginx-naxsi/Config.in:
- Added url to the help section.
- package/nginx-naxsi/nginx-naxsi.mk:
- Added Title comment
- Added licensing
- package/nginx/nginx.mk:
- Removed uneeded pre_configure hook.
- Nginx now links the module directly from the extractes source

v1 - v2:
- Moved naxsi module into a seperate package.

 package/nginx-naxsi/Config.in        |  5 +++++
 package/nginx-naxsi/nginx-naxsi.hash |  1 +
 package/nginx-naxsi/nginx-naxsi.mk   | 13 +++++++++++++
 package/nginx/Config.in              |  3 +++
 package/nginx/nginx.mk               |  5 +++++
 5 files changed, 27 insertions(+)
 create mode 100644 package/nginx-naxsi/Config.in
 create mode 100644 package/nginx-naxsi/nginx-naxsi.hash
 create mode 100644 package/nginx-naxsi/nginx-naxsi.mk
package/nginx-naxsi/Config.in new file +5 -0
new file mode 100644
index 0000000..bdcd16d
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_NGINX_NAXSI
+	bool "ngx_http_naxsi_module"
+	help
+	  Enable ngx_http_naxsi_module
+	  https://github.com/nbs-system/naxsi
package/nginx-naxsi/nginx-naxsi.hash new file +1 -0
new file mode 100644
index 0000000..dd7f5cd
@@ -0,0 +1 @@
+sha256	9cc2c09405bc71f78ef26a8b6d70afcea3fccbe8125df70cb0cfc480133daba5	0.54.tar.gz
package/nginx-naxsi/nginx-naxsi.mk new file +13 -0
new file mode 100644
index 0000000..6949f30
@@ -0,0 +1,13 @@
+################################################################################
+#
+# nginx-naxsi
+#
+################################################################################
+
+NGINX_NAXSI_VERSION = 0.54
+NGINX_NAXSI_SOURCE = $(NGINX_NAXSI_VERSION).tar.gz
+NGINX_NAXSI_SITE = $(call github,nbs-system,naxsi,$(NGINX_NAXSI_SOURCE))
+NGINX_NAXSI_LICENSE = GPLv3
+NGINX_NAXSI_LICENSE_FILES = LICENSE
+
+$(eval $(generic-package))
package/nginx/Config.in +3 -0
index e6f2d96..c1a3394 100644
@@ -380,4 +380,7 @@ config BR2_PACKAGE_NGINX_ADD_MODULES
 	help
 	  Space separated list of urls of the additional modules
 
+comment "external modules"
+	source "package/nginx-naxsi/Config.in"
+
 endif
package/nginx/nginx.mk +5 -0
index 5eb5488..70ed58e 100644
@@ -156,6 +156,11 @@ else
 NGINX_CONF_OPTS += --without-http_gzip_module
 endif
 
+ifeq ($(BR2_PACKAGE_NGINX_NAXSI),y)
+NGINX_DEPENDENCIES += nginx-naxsi
+NGINX_CONF_OPTS += --add-module=$(NGINX_NAXSI_DIR)/naxsi_src
+endif
+
 ifeq ($(BR2_PACKAGE_NGINX_HTTP_REWRITE_MODULE),y)
 NGINX_DEPENDENCIES += pcre
 else
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 package/nginx: Add naxsi module option.

Hello,

Quoted 8 lines · Adam Duskett

Naxsi is a third party nginx module reads a small subset of simple rules containing a list of known patterns involved in website vulnerabilities. This module behaves like a DROP-by-default firewall for nginx.

The reason for the changes to the make file was because naxsi is listed on github, and even though there is a option to specify a url for a 3rd party module, this option only seems to work for a local file url.

Quoted 6 lines

As such a new comment was added to the menu for external modules, and a new package that downloads and extracts the module was added under package/nginx-naxsi. This is then used with a pre-configure hook to create a soft symbolic link to the source inside of the nginx-source tree.

I've applied, after doing a number of changes. First of all, your commit log was wrong: you're no longer doing a pre-configure hook and a symbolic link. See below for more issues.

package/nginx-naxsi/Config.in line 2

Quoted 8 lines
package/nginx-naxsi/Config.in new file +2 -0
new file mode 100644
index 0000000..bdcd16d
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_NGINX_NAXSI
+	bool "ngx_http_naxsi_module"

Changed to:

bool "nginx-naxsi"

package/nginx-naxsi/Config.in line 4

Quoted 2 lines
package/nginx-naxsi/Config.in new file +2 -0
+	help
+	  Enable ngx_http_naxsi_module

This is really short, I've replaced with some more details copy/pasted from the Github description.

Also, there should have been one empty line between the description and the upstream URL below.

Quoted 7 lines
package/nginx-naxsi/Config.in new file +1 -0
+	  https://github.com/nbs-system/naxsi
package/nginx-naxsi/nginx-naxsi.mk new file +0 -0
new file mode 100644
index 0000000..6949f30

package/nginx-naxsi/nginx-naxsi.mk line 8

Quoted 8 lines
package/nginx-naxsi/nginx-naxsi.mk new file +8 -0
@@ -0,0 +1,13 @@
+################################################################################
+#
+# nginx-naxsi
+#
+################################################################################
+
+NGINX_NAXSI_VERSION = 0.54
+NGINX_NAXSI_SOURCE = $(NGINX_NAXSI_VERSION).tar.gz

Wrong for packages fetched from Github.

package/nginx-naxsi/nginx-naxsi.mk line 9

Quoted 1 line
package/nginx-naxsi/nginx-naxsi.mk new file +1 -0
+NGINX_NAXSI_SITE = $(call github,nbs-system,naxsi,$(NGINX_NAXSI_SOURCE))

Last argument should have been NGINX_NAXSI_VERSION

package/nginx-naxsi/nginx-naxsi.mk line 10

Quoted 1 line
package/nginx-naxsi/nginx-naxsi.mk new file +1 -0
+NGINX_NAXSI_LICENSE = GPLv3

The license as indicated by the source code is "GPLv2+ with OpenSSL exception". I know there is a LICENSE file in the latest master that indicates GPLv3, but this LICENSE file is not in the 0.54 tag we're currently packaging. It would be good to report upstream a bug to tell the maintainer about the discrepancy between the LICENSE file (GPLv3) and the source code itself (GPLv2+ with OpenSSL exception).

package/nginx-naxsi/nginx-naxsi.mk line 11

Quoted 1 line
package/nginx-naxsi/nginx-naxsi.mk new file +1 -0
+NGINX_NAXSI_LICENSE_FILES = LICENSE

This file does not exist in 0.54. Please test with "make legal-info" when you create a new package, to make sure the legal information files actually exist.

package/nginx-naxsi/nginx-naxsi.mk line 13

Quoted 2 lines
package/nginx-naxsi/nginx-naxsi.mk new file +2 -0
+comment "external modules"
+	source "package/nginx-naxsi/Config.in"

I've moved this to package/Config.in.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com