From owner-svn-ports-all@freebsd.org Tue Feb 18 15:11:25 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB29223CC27; Tue, 18 Feb 2020 15:11:25 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48MPSs4zMNz4VBW; Tue, 18 Feb 2020 15:11:25 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42B5521F8A; Tue, 18 Feb 2020 15:11:25 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01IFBPf0047146; Tue, 18 Feb 2020 15:11:25 GMT (envelope-from netchild@FreeBSD.org) Received: (from netchild@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01IFBNMQ047139; Tue, 18 Feb 2020 15:11:23 GMT (envelope-from netchild@FreeBSD.org) Message-Id: <202002181511.01IFBNMQ047139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: netchild set sender to netchild@FreeBSD.org using -f From: Alexander Leidinger Date: Tue, 18 Feb 2020 15:11:23 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r526458 - in head/www: . nginx-ultimate-bad-bot-blocker nginx-ultimate-bad-bot-blocker/files X-SVN-Group: ports-head X-SVN-Commit-Author: netchild X-SVN-Commit-Paths: in head/www: . nginx-ultimate-bad-bot-blocker nginx-ultimate-bad-bot-blocker/files X-SVN-Commit-Revision: 526458 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Feb 2020 15:11:26 -0000 Author: netchild Date: Tue Feb 18 15:11:23 2020 New Revision: 526458 URL: https://svnweb.freebsd.org/changeset/ports/526458 Log: The "Ultimate Nginx Bad Bot" blocker, handles also user-agent, spam referrer, adware, malware, ransomware, clickjacking, click directing, SEO companies bad IPs, Wordpress theme detectors and fake Googlebots. It includes an anti DDoS system and nginx rate limiting. WWW: https://github.com/mitchellkrogza/nginx-ultimate-bad-blocker/ Added: head/www/nginx-ultimate-bad-bot-blocker/ head/www/nginx-ultimate-bad-bot-blocker/Makefile (contents, props changed) head/www/nginx-ultimate-bad-bot-blocker/distinfo (contents, props changed) head/www/nginx-ultimate-bad-bot-blocker/files/ head/www/nginx-ultimate-bad-bot-blocker/files/patch-install-ngxblocker (contents, props changed) head/www/nginx-ultimate-bad-bot-blocker/files/patch-update-ngxblocker (contents, props changed) head/www/nginx-ultimate-bad-bot-blocker/files/pkg-message.in (contents, props changed) head/www/nginx-ultimate-bad-bot-blocker/pkg-descr (contents, props changed) Modified: head/www/Makefile Modified: head/www/Makefile ============================================================================== --- head/www/Makefile Tue Feb 18 13:33:13 2020 (r526457) +++ head/www/Makefile Tue Feb 18 15:11:23 2020 (r526458) @@ -447,6 +447,7 @@ SUBDIR += nginx-lite SUBDIR += nginx-naxsi SUBDIR += nginx-prometheus-exporter + SUBDIR += nginx-ultimate-bad-bot-blocker SUBDIR += nginx-vts-exporter SUBDIR += nibbleblog SUBDIR += nift Added: head/www/nginx-ultimate-bad-bot-blocker/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/nginx-ultimate-bad-bot-blocker/Makefile Tue Feb 18 15:11:23 2020 (r526458) @@ -0,0 +1,41 @@ +# $FreeBSD$ + +PORTNAME= nginx-ultimate-bad-bot-blocker +DISTVERSION= 4.2020.02.1988 +DISTFILES= V${PORTVERSION}${EXTRACT_SUFX} +PORTREVISION= 0 +CATEGORIES= www security +MASTER_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/archive/ + +MAINTAINER= netchild@FreeBSD.org +COMMENT= Nginx bad bot and other things blocker + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE.md + +RUN_DEPENDS= gsed:textproc/gsed + +USE_GITHUB= nodefault + +GH_ACCOUNT= mitchellkrogza +GH_PROJECT= ${PORTNAME} + +NO_ARCH= yes +NO_BUILD= yes + +SUB_FILES= pkg-message +PLIST_FILES= sbin/install-ngxblocker \ + sbin/setup-ngxblocker \ + sbin/update-ngxblocker + +post-patch: + ${REINPLACE_CMD} -e 's:/usr/local:${PREFIX}:g' \ + -e 's:/etc/nginx:${LOCALBASE}/etc/nginx:g' \ + -e 's:nginx/sites-available:nginx/sites:g' \ + -e 's:/var/www:${LOCALBASE}/www:g' \ + -e 's:VHOST_EXT="vhost":VHOST_EXT="conf":' ${WRKSRC}/*-ngxblocker + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/*-ngxblocker ${STAGEDIR}${PREFIX}/sbin/ + +.include Added: head/www/nginx-ultimate-bad-bot-blocker/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/nginx-ultimate-bad-bot-blocker/distinfo Tue Feb 18 15:11:23 2020 (r526458) @@ -0,0 +1,3 @@ +TIMESTAMP = 1582031978 +SHA256 (V4.2020.02.1988.tar.gz) = 9bf264f6192bf8a0d9f78f1c54bc2e3b9314ea1bf80bbb33b460514b0173b47b +SIZE (V4.2020.02.1988.tar.gz) = 3785603 Added: head/www/nginx-ultimate-bad-bot-blocker/files/patch-install-ngxblocker ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/nginx-ultimate-bad-bot-blocker/files/patch-install-ngxblocker Tue Feb 18 15:11:23 2020 (r526458) @@ -0,0 +1,30 @@ +--- install-ngxblocker ++++ install-ngxblocker +@@ -36,6 +36,7 @@ CONF_DIR=/etc/nginx/conf.d + BOTS_DIR=/etc/nginx/bots.d + SCRIPT_DIR=/usr/local/sbin + REPO=https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master ++SKIP_SCRIPTS=true + + ####### end user configuration ########################## + OS=$(uname -s) +@@ -341,11 +342,15 @@ main() { + check_config $CONF_DIR $BOTS_DIR $SCRIPT_DIR + download_files conf.d $CONF_DIR $CONF_FILES + download_files bots.d $BOTS_DIR $BOT_FILES +- download_files / $SCRIPT_DIR $SCRIPT_FILES ++ if [ "$SKIP_SCRIPTS" = "false" ]; then ++ download_files / $SCRIPT_DIR $SCRIPT_FILES + +- # ensures scripts are executable +- if [ "$DRY_RUN" = "N" ]; then +- set_mode 700 $SCRIPT_DIR $SCRIPT_FILES ++ # ensures scripts are executable ++ if [ "$DRY_RUN" = "N" ]; then ++ set_mode 700 $SCRIPT_DIR $SCRIPT_FILES ++ fi ++ else ++ printf "\n** FreeBSD specific ** | not updating scripts, please use the package management for this.\n\n" + fi + } + Added: head/www/nginx-ultimate-bad-bot-blocker/files/patch-update-ngxblocker ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/nginx-ultimate-bad-bot-blocker/files/patch-update-ngxblocker Tue Feb 18 15:11:23 2020 (r526458) @@ -0,0 +1,79 @@ +--- update-ngxblocker ++++ update-ngxblocker +@@ -148,6 +148,8 @@ update_paths() { + # updates hard coded bots.d path in globalblacklist.conf + local blacklist=$1 include_paths= dir= x= + ++ case ${OS} in ++ Linux) + if ! grep "$BOTS_DIR" $blacklist 1>/dev/null; then + if [ -d $BOTS_DIR ]; then + printf "${BOLDGREEN}Updating bots.d path${RESET}: ${BOLDWHITE}$BOTS_DIR => $blacklist${RESET}\n" +@@ -163,6 +165,12 @@ update_paths() { + update_paths $blacklist + fi + fi ++ ;; ++ *BSD) ++ printf "${BOLDGREEN}Updating bots.d path${RESET}\n" ++ /usr/bin/sed -i -e 's:include .*nginx/:include :g' ${BOTS_DIR}/* ${CONF_DIR}/* ++ ;; ++ esac + } + + sanitize_path() { +@@ -319,11 +327,39 @@ get_options() { + INSTALL_INC="$INSTALLER -b $BOTS_DIR -c $CONF_DIR -x" + } + ++nginx_check_status() { ++ local pidof_path=$(find_binary pidof) ++ ++ case ${OS} in ++ Linux) ++ $pidof_path nginx 1>/dev/null ++ return $? ++ ;; ++ FreeBSD) ++ /usr/sbin/service nginx status | /usr/bin/grep -q running ++ return $? ++ ;; ++ esac ++} ++ ++nginx_reload() { ++ local nginx_path=$(find_binary nginx) ++ ++ case ${OS} in ++ Linux) ++ $nginx_path -s reload 2>&1 >/dev/null ++ return $? ++ ;; ++ FreeBSD) ++ /usr/sbin/service nginx reload >/dev/null 2>&1 ++ return $? ++ ;; ++ esac ++} ++ + main() { + local REPO=https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master + local file=globalblacklist.conf remote_dir=conf.d url= output= update= status= tmp= retval= +- local nginx_path=$(find_binary nginx) +- local pidof_path=$(find_binary pidof) + + # require root + if [ "$(id -u)" != "0" ]; then +@@ -370,9 +406,10 @@ main() { + if [ $retval = 0 ]; then + + # use full paths to workaround crontabs without $PATH configured +- if $pidof_path nginx 1>/dev/null; then ++ nginx_check_status ++ if [ $? -eq 0 ]; then + +- $nginx_path -s reload 2>&1 >/dev/null ++ nginx_reload + + if [ $? = 0 ]; then + status="${BOLDGREEN}[OK]${RESET}" Added: head/www/nginx-ultimate-bad-bot-blocker/files/pkg-message.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/nginx-ultimate-bad-bot-blocker/files/pkg-message.in Tue Feb 18 15:11:23 2020 (r526458) @@ -0,0 +1,38 @@ +[ +{ + message: <