yes sir

On 06/11/19 12:00 +0000, Stuart Henderson wrote:
> This adds the geoip2 module to nginx, I tested it by adding logging of
> the country code with this in the main section:
> 
> load_module /var/www/modules/ngx_http_geoip2_module.so;
> 
> and this in the http block:
> 
> geoip2 /var/db/GeoIP/GeoLite2-Country.mmdb {
>         $geoip2_data_country_code default=US country iso_code;
> }
> 
> log_format main '$remote_addr:$remote_port $http_host $remote_user 
> [$time_local] "$request" $status $body_bytes_sent "$http_referer" 
> "$http_user_agent" "$http_x_forwarded_for" [$geoip2_data_country_code]';
> 
> Also cleans up multi-distfiles a bit.
> 
> OK?
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/nginx/Makefile,v
> retrieving revision 1.138
> diff -u -p -r1.138 Makefile
> --- Makefile  26 Aug 2019 06:58:08 -0000      1.138
> +++ Makefile  6 Nov 2019 11:53:10 -0000
> @@ -5,6 +5,7 @@ BROKEN-hppa=  src/core/ngx_rwlock.c:116:2
>  COMMENT-main=                robust and small HTTP server and mail proxy 
> server
>  COMMENT-image_filter=        nginx image filter module
>  COMMENT-geoip=               nginx GeoIP module
> +COMMENT-geoip2=              nginx GeoIP2 module
>  COMMENT-xslt=                nginx XSLT filter module
>  COMMENT-mailproxy=   nginx mail proxy module
>  COMMENT-stream=              nginx TCP/UDP proxy module
> @@ -20,12 +21,13 @@ VERSION=  1.16.1
>  DISTNAME=    nginx-${VERSION}
>  CATEGORIES=  www
>  
> -REVISION-main=       0
> -VERSION-rtmp=1.2.1
> +REVISION=    1
> +VERSION-rtmp=        1.2.1
>  
>  PKGNAME-main=                ${DISTNAME}
>  PKGNAME-image_filter=        nginx-image_filter-${VERSION}
>  PKGNAME-geoip=               nginx-geoip-${VERSION}
> +PKGNAME-geoip2=              nginx-geoip2-${VERSION}
>  PKGNAME-xslt=                nginx-xslt-${VERSION}
>  PKGNAME-mailproxy=   nginx-mailproxy-${VERSION}
>  PKGNAME-stream=              nginx-stream-${VERSION}
> @@ -37,32 +39,33 @@ PKGNAME-perl=             nginx-perl-${VERSION}
>  PKGNAME-passenger=   nginx-passenger-${VERSION}
>  PKGNAME-rtmp=                nginx-rtmp-${VERSION}
>  
> -
>  MASTER_SITES=        https://nginx.org/download/
> -MASTER_SITES0=       https://github.com/simpl/ngx_devel_kit/archive/
> -MASTER_SITES1=       https://github.com/nbs-system/naxsi/archive/
> -MASTER_SITES2=       https://github.com/openresty/lua-nginx-module/archive/
> -MASTER_SITES3=       
> https://raw.githubusercontent.com/rnagy/nginx_chroot_patch/master/
> -MASTER_SITES4=       
> https://github.com/openresty/headers-more-nginx-module/archive/
> -MASTER_SITES5=       https://github.com/kvspb/nginx-auth-ldap/archive/
> -MASTER_SITES6=       https://github.com/arut/nginx-rtmp-module/archive/
> -
> -DISTFILES=   ${DISTNAME}${EXTRACT_SUFX} \
> -             ngx_devel_kit-{}v0.3.0.tar.gz:0 \
> -             naxsi-{}0.55.3.tar.gz:1 \
> -             lua-nginx-module-{}v0.10.11.tar.gz:2 \
> -             headers-more-nginx-module-{}v0.33.tar.gz:4 \
> -             
> nginx-auth-ldap-0.20170725{42d195d7a7575ebab1c369ad3fc5d78dc2c2669c}.tar.gz:5 
> \
> -             nginx-rtmp-module-{}v${VERSION-rtmp}.tar.gz:6
> +MASTER_SITES0=       https://github.com/
> +MASTER_SITES1=       
> https://raw.githubusercontent.com/rnagy/nginx_chroot_patch/master/
> +
> +DISTFILES=   ${DISTNAME}${EXTRACT_SUFX}
> +
> +_GH_MODS=    \
> +     openresty       headers-more-nginx-module       v0.33 \
> +     openresty       lua-nginx-module                v0.10.11 \
> +     nbs-system      naxsi                           0.55.3 \
> +     kvspb           nginx-auth-ldap                 
> 42d195d7a7575ebab1c369ad3fc5d78dc2c2669c \
> +     arut            nginx-rtmp-module               v${VERSION-rtmp} \
> +     simpl           ngx_devel_kit                   v0.3.0 \
> +     leev            ngx_http_geoip2_module          3.3
> +
> +.for _a _p _c in ${_GH_MODS}
> +DISTFILES+=  ${_p}-{${_a}/${_p}/archive/}${_c}.tar.gz:0
> +.endfor
>  
> -HOMEPAGE=    http://nginx.org/
> +HOMEPAGE=    https://nginx.org/
>  
>  MAINTAINER=  Robert Nagy <[email protected]>
>  
>  # BSD-like
>  PERMIT_PACKAGE=      Yes
>  
> -MULTI_PACKAGES =     -main -image_filter -geoip -xslt -mailproxy -stream \
> +MULTI_PACKAGES =     -main -image_filter -geoip -geoip2 -xslt -mailproxy 
> -stream \
>                       -naxsi -perl -passenger -headers_more -ldap_auth -lua 
> -rtmp
>  
>  FLAVOR ?=
> @@ -77,6 +80,7 @@ WANTLIB-mailproxy=
>  WANTLIB-stream=
>  WANTLIB-image_filter=        gd
>  WANTLIB-geoip=               GeoIP
> +WANTLIB-geoip2=              maxminddb
>  WANTLIB-xslt=                exslt xml2 xslt
>  WANTLIB-naxsi=
>  WANTLIB-ldap_auth=   ldap
> @@ -90,6 +94,7 @@ LIB_DEPENDS-xslt=   textproc/libxml \
>                       textproc/libxslt
>  LIB_DEPENDS-image_filter=graphics/gd
>  LIB_DEPENDS-geoip=   net/GeoIP
> +LIB_DEPENDS-geoip2=  net/libmaxminddb
>  LIB_DEPENDS-ldap_auth=       databases/openldap
>  LIB_DEPENDS-lua=     ${MODLUA_LIB_DEPENDS}
>  LIB_DEPENDS-rtmp=    textproc/libxml \
> @@ -111,19 +116,21 @@ PREFIX-mailproxy=       ${NGINX_MODULES_DIR}
>  PREFIX-stream=               ${NGINX_MODULES_DIR}
>  PREFIX-image_filter= ${NGINX_MODULES_DIR}
>  PREFIX-geoip=                ${NGINX_MODULES_DIR}
> +PREFIX-geoip2=               ${NGINX_MODULES_DIR}
>  PREFIX-xslt=         ${NGINX_MODULES_DIR}
>  PREFIX-ldap_auth=    ${NGINX_MODULES_DIR}
>  PREFIX-lua=          ${NGINX_MODULES_DIR}
>  PREFIX-headers_more= ${NGINX_MODULES_DIR}
>  PREFIX-passenger=    ${NGINX_MODULES_DIR}
> -PREFIX-rtmp= ${NGINX_MODULES_DIR}
> +PREFIX-rtmp=         ${NGINX_MODULES_DIR}
>  
>  CFLAGS+=     -Wall -Wpointer-arith \
>               -I "${LOCALBASE}/include/libxml2" \
> -             -I "${LOCALBASE}/include" \
> -             -L "${X11BASE}/lib"
> +             -I "${LOCALBASE}/include"
> +LDFLAGS+=    -L ${LOCALBASE}/lib -L ${X11BASE}/lib
> +CONFIGURE_ENV+=      LDFLAGS="${LDFLAGS}"
>  
> -PATCHFILES+=         nginx-1.16.1-chroot.patch:3
> +PATCHFILES+=         nginx-1.16.1-chroot.patch:1
>  PATCH_DIST_STRIP=    -p1
>  
>  CONFIGURE_STYLE=     simple
> @@ -181,23 +188,19 @@ CONFIGURE_ARGS+=        --prefix=${NGINX_DIR} \
>                       --add-dynamic-module=${WRKSRC}/naxsi/naxsi_src/ \
>                       --add-dynamic-module=${WRKSRC}/ngx_devel_kit \
>                       
> --add-dynamic-module=${WRKSRC}/headers-more-nginx-module \
> -                     --add-dynamic-module=${WRKSRC}/nginx-auth-ldap
> +                     --add-dynamic-module=${WRKSRC}/nginx-auth-ldap \
> +                     --add-dynamic-module=${WRKSRC}/ngx_http_geoip2_module
>  
> -SUBSTFILES=          conf/nginx.conf \
> -                     lua-nginx-module/config \
> -                     nginx-auth-ldap/config
> +SUBSTFILES=          conf/nginx.conf */config
>  
>  NO_TEST=             Yes
>  ALL_TARGET=
>  
>  pre-patch:
> -     cd ${WRKSRC} && \
> -         mv ../naxsi-* naxsi
> -     cd ${WRKSRC} && \
> -         mv ../ngx_devel_kit-* ngx_devel_kit && \
> -         mv ../lua-nginx-module-* lua-nginx-module && \
> -         mv ../headers-more-nginx-module-* headers-more-nginx-module && \
> -         mv ../nginx-auth-ldap-* nginx-auth-ldap
> +.for i in headers-more-nginx-module lua-nginx-module naxsi \
> +     nginx-auth-ldap ngx_devel_kit ngx_http_geoip2_module
> +     cd ${WRKSRC} && mv ../$i-* $i
> +.endfor
>  
>  pre-configure:
>       @cd ${WRKSRC} && ${SUBST_CMD} ${SUBSTFILES}
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/www/nginx/distinfo,v
> retrieving revision 1.72
> diff -u -p -r1.72 distinfo
> --- distinfo  26 Aug 2019 06:58:08 -0000      1.72
> +++ distinfo  6 Nov 2019 11:53:10 -0000
> @@ -3,14 +3,16 @@ SHA256 (lua-nginx-module-v0.10.11.tar.gz
>  SHA256 (naxsi-0.55.3.tar.gz) = CzyV0lB3Lcia2LSeR8HgJMWuLHbAz/pEXp/gXE3RNJU=
>  SHA256 (nginx-1.16.1-chroot.patch) = 
> ohNkspocgL7QnBX7q8Kgv2lgrN0ndgLKd0v5nSCLQRU=
>  SHA256 (nginx-1.16.1.tar.gz) = 8RwqbdHTUVc28DJIV5V9st6YvoYkYbWlQqOsYYjb4ys=
> -SHA256 (nginx-auth-ldap-0.20170725.tar.gz) = 
> gNbM6amHfVHewvhaEc580l7b0tYFwovChofsxWlSKe4=
> +SHA256 (nginx-auth-ldap-42d195d7a7575ebab1c369ad3fc5d78dc2c2669c.tar.gz) = 
> gNbM6amHfVHewvhaEc580l7b0tYFwovChofsxWlSKe4=
>  SHA256 (nginx-rtmp-module-v1.2.1.tar.gz) = 
> h6pZdACwtaBSdO4tI9jLgiThJoYiegq+MdeDs6ZF6jc=
>  SHA256 (ngx_devel_kit-v0.3.0.tar.gz) = 
> iOBamainQZBm9a51lm+x78QJutRSLRSYbaB0VUrmFhk=
> +SHA256 (ngx_http_geoip2_module-3.3.tar.gz) = 
> QTeEOMgz4xOhiGnQxKcnBLSDXDCsr3/WgBOrZzL/eKc=
>  SIZE (headers-more-nginx-module-v0.33.tar.gz) = 28130
>  SIZE (lua-nginx-module-v0.10.11.tar.gz) = 616653
>  SIZE (naxsi-0.55.3.tar.gz) = 187416
>  SIZE (nginx-1.16.1-chroot.patch) = 8220
>  SIZE (nginx-1.16.1.tar.gz) = 1032630
> -SIZE (nginx-auth-ldap-0.20170725.tar.gz) = 18457
> +SIZE (nginx-auth-ldap-42d195d7a7575ebab1c369ad3fc5d78dc2c2669c.tar.gz) = 
> 18457
>  SIZE (nginx-rtmp-module-v1.2.1.tar.gz) = 519919
>  SIZE (ngx_devel_kit-v0.3.0.tar.gz) = 66455
> +SIZE (ngx_http_geoip2_module-3.3.tar.gz) = 8509
> Index: patches/patch-ngx_http_geoip2_module_config
> ===================================================================
> RCS file: patches/patch-ngx_http_geoip2_module_config
> diff -N patches/patch-ngx_http_geoip2_module_config
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-ngx_http_geoip2_module_config       6 Nov 2019 11:53:10 
> -0000
> @@ -0,0 +1,14 @@
> +$OpenBSD$
> +
> +Index: ngx_http_geoip2_module/config
> +--- ngx_http_geoip2_module/config.orig
> ++++ ngx_http_geoip2_module/config
> +@@ -2,7 +2,7 @@ ngx_feature="MaxmindDB library"
> + ngx_feature_name=
> + ngx_feature_run=no
> + ngx_feature_incs="#include <maxminddb.h>"
> +-ngx_feature_libs=-lmaxminddb
> ++ngx_feature_libs="-L${LOCALBASE}/lib -lmaxminddb"
> + ngx_feature_test="MMDB_s mmdb"
> + . auto/feature
> + 
> Index: pkg/DESCR-geoip2
> ===================================================================
> RCS file: pkg/DESCR-geoip2
> diff -N pkg/DESCR-geoip2
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/DESCR-geoip2  6 Nov 2019 11:53:10 -0000
> @@ -0,0 +1,6 @@
> +ngx_http_geoip2_module - creates variables with values from the maxmind
> +geoip2 databases based on the client IP (default) or from a specific
> +variable (supports both IPv4 and IPv6).
> +
> +The module now supports nginx streams and can be used in the same way
> +the http module can be used.
> Index: pkg/PLIST-geoip2
> ===================================================================
> RCS file: pkg/PLIST-geoip2
> diff -N pkg/PLIST-geoip2
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/PLIST-geoip2  6 Nov 2019 11:53:10 -0000
> @@ -0,0 +1,3 @@
> +@comment $OpenBSD: PLIST-geoip2,v$
> +ngx_http_geoip2_module.so
> +ngx_stream_geoip2_module.so

-- 
Regards,
Robert Nagy

Reply via email to