Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Last active June 30, 2017 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaevseev/7503533 to your computer and use it in GitHub Desktop.
Save ilyaevseev/7503533 to your computer and use it in GitHub Desktop.
Support Anti-DDOS modules for nginx under FreeBSD.
diff -urN nginx/Makefile nginx-antiddos/Makefile
--- nginx/Makefile 2013-11-04 17:20:45.000000000 +0400
+++ nginx-antiddos/Makefile 2013-11-16 22:00:49.000000000 +0400
@@ -3,7 +3,7 @@
PORTNAME= nginx
PORTVERSION= 1.4.3
-PORTEPOCH= 1
+PORTEPOCH= 2
CATEGORIES= www
MASTER_SITES= http://nginx.org/download/
MASTER_SITES+= ${MASTER_SITE_LOCAL}
@@ -53,6 +53,7 @@
HEADERS_MORE \
HTTP_ACCEPT_LANGUAGE \
HTTP_ACCESSKEY \
+ HTTP_ANDDOS \
HTTP_AUTH_DIGEST \
HTTP_AUTH_LDAP \
HTTP_AUTH_PAM \
@@ -67,6 +68,7 @@
HTTP_REDIS \
HTTP_RESPONSE \
HTTP_SUBS_FILTER \
+ HTTP_TESTCOOKIE \
HTTP_UPLOAD \
HTTP_UPLOAD_PROGRESS \
HTTP_UPSTREAM_FAIR \
@@ -141,6 +143,7 @@
HEADERS_MORE_DESC= 3rd party headers_more module
HTTP_ACCEPT_LANGUAGE_DESC= 3rd party accept_language module
HTTP_ACCESSKEY_DESC= 3rd party http_accesskey module
+HTTP_ANDDOS_DESC= 3rd party anddos module
HTTP_AUTH_DIGEST_DESC= 3rd party http_authdigest module
HTTP_AUTH_LDAP_DESC= 3rd party http_auth_ldap module
HTTP_AUTH_PAM_DESC= 3rd party http_auth_pam module
@@ -156,6 +159,7 @@
HTTP_REDIS_DESC= 3rd party http_redis module
HTTP_RESPONSE_DESC= 3rd party http_response module
HTTP_SUBS_FILTER_DESC= 3rd party subs filter module
+HTTP_TESTCOOKIE_DESC= 3rd party testcookie module
HTTP_UPLOAD_DESC= 3rd party upload module
HTTP_UPLOAD_PROGRESS_DESC= 3rd party uploadprogress module
HTTP_UPSTREAM_FAIR_DESC= 3rd party upstream fair module
@@ -351,6 +355,14 @@
CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-headers-more-nginx-module-${GIT_HEADERS_MORE_VERSION:S/^0-g//}
.endif
+.if ${PORT_OPTIONS:MHTTP_ANDDOS}
+ANDDOS_GIT_COMMIT=8f7cc64eaf73828480e95d7b73d451ec29926e1e
+MASTER_SITES+= https://codeload.github.com/aufi/anddos/zip/:anddos
+DISTFILES+= ${ANDDOS_GIT_COMMIT}:anddos
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/anddos-${ANDDOS_GIT_COMMIT}/anddos
+EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_anddos_module.c
+.endif
+
.if ${PORT_OPTIONS:MHTTP_DAV} || defined(USE_HTTP_DAV)
CONFIGURE_ARGS+=--with-http_dav_module
.endif
@@ -499,6 +511,13 @@
CONFIGURE_ARGS+=--with-http_sub_module
.endif
+.if ${PORT_OPTIONS:MHTTP_TESTCOOKIE}
+TESTCOOKIE_GIT_COMMIT=8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58
+MASTER_SITES+= https://codeload.github.com/kyprizel/testcookie-nginx-module/zip/:testcookie
+DISTFILES+= ${TESTCOOKIE_GIT_COMMIT}:testcookie
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/testcookie-nginx-module-${TESTCOOKIE_GIT_COMMIT}
+.endif
+
.if ${PORT_OPTIONS:MHTTP_UPLOAD}
NGINX_UPLOAD_VERSION= 2.2.0
MASTER_SITES+= http://www.grid.net.ru/nginx/download/:upload
diff -urN nginx/distinfo nginx-antiddos/distinfo
--- nginx/distinfo 2013-11-02 15:56:16.000000000 +0400
+++ nginx-antiddos/distinfo 2013-11-11 21:05:47.000000000 +0400
@@ -110,3 +110,7 @@
SIZE (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = 10580
SHA256 (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = e90a406a14d5f419bd500e19082da81390e8ba6040926857926f1a899a53379d
SIZE (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = 12510
+SHA256 (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 585ccf048bd485c84ebde240c2ec22d6112e092e4edc4ad78957c418f6d7150a
+SIZE (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 25792
+SHA256 (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 444cdf820cffb789501ecd7be5f3083a0033657434b543539f3e5a792f1873b3
+SIZE (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 11448
diff -urN nginx/files/extra-patch-ngx_http_anddos_module.c nginx-antiddos/files/extra-patch-ngx_http_anddos_module.c
--- nginx/files/extra-patch-ngx_http_anddos_module.c 1970-01-01 03:00:00.000000000 +0300
+++ nginx-antiddos/files/extra-patch-ngx_http_anddos_module.c 2013-11-16 21:58:25.000000000 +0400
@@ -0,0 +1,12 @@
+--- ../anddos-8f7cc64eaf73828480e95d7b73d451ec29926e1e/anddos/ngx_http_anddos_module.c.orig 2013-09-26 23:23:25.000000000 +0400
++++ ../anddos-8f7cc64eaf73828480e95d7b73d451ec29926e1e/anddos/ngx_http_anddos_module.c 2013-11-16 21:55:28.000000000 +0400
+@@ -364,9 +364,6 @@
+ u_char mime_type[32];
+ memset(mime_type, 0, 32);
+ ngx_snprintf(mime_type, r->headers_out.content_type.len, "%s", r->headers_out.content_type.data);
+-
+- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "ANDDOS mime: %s", mime_type);
+-
+
+
+ if (ngx_strstr(mime_type, "html") != NULL) {
diff -urN nginx-devel-antiddos/Makefile nginx-devel/Makefile
--- nginx-devel-antiddos/Makefile 2013-11-16 22:05:45.000000000 +0400
+++ nginx-devel/Makefile 2013-11-17 17:35:51.000000000 +0400
@@ -3,7 +3,7 @@
PORTNAME= nginx
PORTVERSION= 1.5.6
-PORTEPOCH= 1
+PORTEPOCH= 2
CATEGORIES= www
MASTER_SITES= http://nginx.org/download/
MASTER_SITES+= ${MASTER_SITE_LOCAL}
@@ -62,6 +62,7 @@
HTTP_DAV_EXT \
HTTP_EVAL \
HTTP_FANCYINDEX \
+ HTTP_LOWER_UPPER_CASE \
HTTP_MOGILEFS \
HTTP_NOTICE \
HTTP_PUSH \
@@ -152,6 +153,7 @@
HTTP_DAV_EXT_DESC= 3rd party webdav_ext module
HTTP_EVAL_DESC= 3rd party eval module
HTTP_FANCYINDEX_DESC= 3rd party http_fancyindex module
+HTTP_LOWER_UPPER_CASE_DESC= 3rd party http_lower_upper_case module
HTTP_MOGILEFS_DESC= 3rd party mogilefs module
HTTP_MP4_H264_DESC= 3rd party mp4/h264 module
HTTP_NOTICE_DESC= 3rd party notice module
@@ -415,6 +417,13 @@
CONFIGURE_ARGS+=--with-http_image_filter_module
.endif
+.if ${PORT_OPTIONS:MHTTP_LOWER_UPPER_CASE}
+LOWER_UPPER_CASE_GIT_COMMIT=44958e0a96a5328ee6d136fa1403d872fca673ea
+MASTER_SITES+= https://codeload.github.com/replay/ngx_http_lower_upper_case/zip/:lower_upper_case
+DISTFILES+= ${LOWER_UPPER_CASE_GIT_COMMIT}:lower_upper_case
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_lower_upper_case-${LOWER_UPPER_CASE_GIT_COMMIT}
+.endif
+
.if ${PORT_OPTIONS:MHTTP_MP4}
CONFIGURE_ARGS+=--with-http_mp4_module
.endif
diff -urN nginx-devel-antiddos/distinfo nginx-devel/distinfo
--- nginx-devel-antiddos/distinfo 2013-11-16 22:03:26.000000000 +0400
+++ nginx-devel/distinfo 2013-11-17 17:34:34.000000000 +0400
@@ -112,3 +112,5 @@
SIZE (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 25792
SHA256 (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 444cdf820cffb789501ecd7be5f3083a0033657434b543539f3e5a792f1873b3
SIZE (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 11448
+SHA256 (44958e0a96a5328ee6d136fa1403d872fca673ea) = ade5f580d49b2c4ce8dc2fc50922642f8f44d25c8dbe3df73e788da891f8ce50
+SIZE (44958e0a96a5328ee6d136fa1403d872fca673ea) = 2761
diff -urN nginx-devel/Makefile nginx-devel-antiddos/Makefile
--- nginx-devel/Makefile 2013-11-04 17:20:45.000000000 +0400
+++ nginx-devel-antiddos/Makefile 2013-11-16 22:05:45.000000000 +0400
@@ -3,6 +3,7 @@
PORTNAME= nginx
PORTVERSION= 1.5.6
+PORTEPOCH= 1
CATEGORIES= www
MASTER_SITES= http://nginx.org/download/
MASTER_SITES+= ${MASTER_SITE_LOCAL}
@@ -54,6 +55,7 @@
HEADERS_MORE \
HTTP_ACCEPT_LANGUAGE \
HTTP_ACCESSKEY \
+ HTTP_ANDDOS \
HTTP_AUTH_DIGEST \
HTTP_AUTH_LDAP \
HTTP_AUTH_PAM \
@@ -67,6 +69,7 @@
HTTP_REDIS \
HTTP_RESPONSE \
HTTP_SUBS_FILTER \
+ HTTP_TESTCOOKIE \
HTTP_UPLOAD \
HTTP_UPLOAD_PROGRESS \
HTTP_UPSTREAM_FAIR \
@@ -142,6 +145,7 @@
HEADERS_MORE_DESC= 3rd party headers_more module
HTTP_ACCEPT_LANGUAGE_DESC= 3rd party accept_language module
HTTP_ACCESSKEY_DESC= 3rd party http_accesskey module
+HTTP_ANDDOS_DESC= 3rd party anddos module
HTTP_AUTH_DIGEST_DESC= 3rd party http_authdigest module
HTTP_AUTH_LDAP_DESC= 3rd party http_auth_ldap module
HTTP_AUTH_PAM_DESC= 3rd party http_auth_pam module
@@ -156,6 +160,7 @@
HTTP_REDIS_DESC= 3rd party http_redis module
HTTP_RESPONSE_DESC= 3rd party http_response module
HTTP_SUBS_FILTER_DESC= 3rd party subs filter module
+HTTP_TESTCOOKIE_DESC= 3rd party testcookie module
HTTP_UPLOAD_DESC= 3rd party upload module
HTTP_UPLOAD_PROGRESS_DESC= 3rd party uploadprogress module
HTTP_UPSTREAM_FAIR_DESC= 3rd party upstream fair module
@@ -348,6 +353,14 @@
CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-headers-more-nginx-module-${GIT_HEADERS_MORE_VERSION:S/^0-g//}
.endif
+.if ${PORT_OPTIONS:MHTTP_ANDDOS}
+ANDDOS_GIT_COMMIT=8f7cc64eaf73828480e95d7b73d451ec29926e1e
+MASTER_SITES+= https://codeload.github.com/aufi/anddos/zip/:anddos
+DISTFILES+= ${ANDDOS_GIT_COMMIT}:anddos
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/anddos-${ANDDOS_GIT_COMMIT}/anddos
+EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_anddos_module.c
+.endif
+
.if ${PORT_OPTIONS:MHTTP_DAV} || defined(USE_HTTP_DAV)
CONFIGURE_ARGS+=--with-http_dav_module
.endif
@@ -496,6 +509,13 @@
CONFIGURE_ARGS+=--with-http_sub_module
.endif
+.if ${PORT_OPTIONS:MHTTP_TESTCOOKIE}
+TESTCOOKIE_GIT_COMMIT=8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58
+MASTER_SITES+= https://codeload.github.com/kyprizel/testcookie-nginx-module/zip/:testcookie
+DISTFILES+= ${TESTCOOKIE_GIT_COMMIT}:testcookie
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/testcookie-nginx-module-${TESTCOOKIE_GIT_COMMIT}
+.endif
+
.if ${PORT_OPTIONS:MHTTP_UPLOAD}
NGINX_UPLOAD_VERSION= 2.2.0
MASTER_SITES+= http://www.grid.net.ru/nginx/download/:upload
diff -urN nginx-devel/distinfo nginx-devel-antiddos/distinfo
--- nginx-devel/distinfo 2013-11-02 15:56:16.000000000 +0400
+++ nginx-devel-antiddos/distinfo 2013-11-16 22:03:26.000000000 +0400
@@ -108,3 +108,7 @@
SIZE (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = 10580
SHA256 (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = e90a406a14d5f419bd500e19082da81390e8ba6040926857926f1a899a53379d
SIZE (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = 12510
+SHA256 (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 585ccf048bd485c84ebde240c2ec22d6112e092e4edc4ad78957c418f6d7150a
+SIZE (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 25792
+SHA256 (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 444cdf820cffb789501ecd7be5f3083a0033657434b543539f3e5a792f1873b3
+SIZE (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 11448
diff -urN nginx-devel/files/extra-patch-ngx_http_anddos_module.c nginx-devel-antiddos/files/extra-patch-ngx_http_anddos_module.c
--- nginx-devel/files/extra-patch-ngx_http_anddos_module.c 1970-01-01 03:00:00.000000000 +0300
+++ nginx-devel-antiddos/files/extra-patch-ngx_http_anddos_module.c 2013-11-16 21:58:25.000000000 +0400
@@ -0,0 +1,12 @@
+--- ../anddos-8f7cc64eaf73828480e95d7b73d451ec29926e1e/anddos/ngx_http_anddos_module.c.orig 2013-09-26 23:23:25.000000000 +0400
++++ ../anddos-8f7cc64eaf73828480e95d7b73d451ec29926e1e/anddos/ngx_http_anddos_module.c 2013-11-16 21:55:28.000000000 +0400
+@@ -364,9 +364,6 @@
+ u_char mime_type[32];
+ memset(mime_type, 0, 32);
+ ngx_snprintf(mime_type, r->headers_out.content_type.len, "%s", r->headers_out.content_type.data);
+-
+- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "ANDDOS mime: %s", mime_type);
+-
+
+
+ if (ngx_strstr(mime_type, "html") != NULL) {
diff -urN nginx-antiddos/Makefile nginx/Makefile
--- nginx-antiddos/Makefile 2013-11-16 22:00:49.000000000 +0400
+++ nginx/Makefile 2013-11-17 17:36:07.000000000 +0400
@@ -3,7 +3,7 @@
PORTNAME= nginx
PORTVERSION= 1.4.3
-PORTEPOCH= 2
+PORTEPOCH= 3
CATEGORIES= www
MASTER_SITES= http://nginx.org/download/
MASTER_SITES+= ${MASTER_SITE_LOCAL}
@@ -61,6 +61,7 @@
HTTP_DAV_EXT \
HTTP_EVAL \
HTTP_FANCYINDEX \
+ HTTP_LOWER_UPPER_CASE \
HTTP_MOGILEFS \
HTTP_NOTICE \
HTTP_PUSH \
@@ -151,6 +152,7 @@
HTTP_DAV_EXT_DESC= 3rd party webdav_ext module
HTTP_EVAL_DESC= 3rd party eval module
HTTP_FANCYINDEX_DESC= 3rd party http_fancyindex module
+HTTP_LOWER_UPPER_CASE_DESC= 3rd party http_lower_upper_case module
HTTP_MOGILEFS_DESC= 3rd party mogilefs module
HTTP_MP4_H264_DESC= 3rd party mp4/h264 module
HTTP_NOTICE_DESC= 3rd party notice module
@@ -417,6 +419,13 @@
CONFIGURE_ARGS+=--with-http_image_filter_module
.endif
+.if ${PORT_OPTIONS:MHTTP_LOWER_UPPER_CASE}
+LOWER_UPPER_CASE_GIT_COMMIT=44958e0a96a5328ee6d136fa1403d872fca673ea
+MASTER_SITES+= https://codeload.github.com/replay/ngx_http_lower_upper_case/zip/:lower_upper_case
+DISTFILES+= ${LOWER_UPPER_CASE_GIT_COMMIT}:lower_upper_case
+CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_lower_upper_case-${LOWER_UPPER_CASE_GIT_COMMIT}
+.endif
+
.if ${PORT_OPTIONS:MHTTP_MP4}
CONFIGURE_ARGS+=--with-http_mp4_module
.endif
diff -urN nginx-antiddos/distinfo nginx/distinfo
--- nginx-antiddos/distinfo 2013-11-11 21:05:47.000000000 +0400
+++ nginx/distinfo 2013-11-17 17:31:18.000000000 +0400
@@ -114,3 +114,5 @@
SIZE (8da7c62612c8fe2f7fdcd926f5c2d9b659cacc58) = 25792
SHA256 (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 444cdf820cffb789501ecd7be5f3083a0033657434b543539f3e5a792f1873b3
SIZE (8f7cc64eaf73828480e95d7b73d451ec29926e1e) = 11448
+SHA256 (44958e0a96a5328ee6d136fa1403d872fca673ea) = ade5f580d49b2c4ce8dc2fc50922642f8f44d25c8dbe3df73e788da891f8ce50
+SIZE (44958e0a96a5328ee6d136fa1403d872fca673ea) = 2761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment