From d9bcc11ba4df00289d7b900f3379fe449e19d9e9 Mon Sep 17 00:00:00 2001 From: jsbruneau Date: Thu, 7 Mar 2019 21:41:54 -0500 Subject: [PATCH 1/3] Update README.md --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 2f3c371..f8c2d36 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,2 @@ SquidGuard for Entware-ng - -Пакет собирается в корень файловой системы /opt - - - The package is compiled to the root of the file system /opt From adcedb0d52873c9aaf1a1d33de8101ad433fd1f3 Mon Sep 17 00:00:00 2001 From: JS Bruneau Date: Thu, 7 Mar 2019 23:07:42 -0500 Subject: [PATCH 2/3] updated to squidGuard 1.6.0-1 --- Makefile | 16 +++-- files/squidguard.conf | 78 ++++++++++++++++++++--- patches/010-redirect.patch | 126 ------------------------------------- 3 files changed, 80 insertions(+), 140 deletions(-) delete mode 100644 patches/010-redirect.patch diff --git a/Makefile b/Makefile index dea1551..1666b1f 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=squidGuard -PKG_VERSION:=1.5-beta +PKG_VERSION:=1.6.0-1 PKG_RELEASE:=2 PKG_LICENSE:=GNU PKG_MAINTAINER:=Ivan Ivanov -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://www.squidguard.org/Downloads/Devel/ -PKG_MD5SUM:=85216992d14acb29d6f345608f21f268 - +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://salsa.debian.org/joowie-guest/maintain_squidguard.git +PKG_SOURCE_VERSION:=7b373fffa224c6a350553d8f9f4aef9cd7a125bf +PKG_MIRROR_HASH:=97a023caada7506d7dde0a0169215c5b0f81ec89b80ed10b1e8fff445ccaaeec PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -39,10 +39,14 @@ CONFIGURE_ARGS += \ --with-sg-config=/opt/etc/squidguard/squidguard.conf \ --with-squiduser=nobody +define Build/Configure + ( cd $(PKG_BUILD_DIR); ./autogen.sh) + $(call Build/Configure/Default,$CONFIGURE_ARGS) +endef define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(PKG_INSTALL_DIR)" all + DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE) -C $(PKG_BUILD_DIR) \ DESTDIR="$(PKG_INSTALL_DIR)" install endef diff --git a/files/squidguard.conf b/files/squidguard.conf index cd57638..6e07d33 100644 --- a/files/squidguard.conf +++ b/files/squidguard.conf @@ -1,20 +1,82 @@ # # CONFIG FILE FOR SQUIDGUARD # +# Caution: do NOT use comments inside { } +# + +dbhome /var/lib/squidguard/db +logdir /var/log/squidguard + +# +# TIME RULES: +# abbrev for weekdays: +# s = sun, m = mon, t =tue, w = wed, h = thu, f = fri, a = sat + +time workhours { + weekly mtwhf 08:00 - 16:30 + date *-*-01 08:00 - 16:30 +} + +# +# SOURCE ADDRESSES: +# + +src admin { + ip 1.2.3.4 1.2.3.5 + user root foo bar + within workhours +} + +src foo-clients { + ip 172.16.2.32-172.16.2.100 172.16.2.100 172.16.2.200 +} + +src bar-clients { + ip 172.16.4.0/26 +} -dbhome /opt/usr/squidguard/db -logdir /opt/var/log/squidguard +# +# DESTINATION CLASSES: +# +# [see also in file dest-snippet.txt] + +dest good { +} -dest blacklist { - domainlist blacklist/domains - urllist blacklist/urls - log block.log +dest local { } +dest porn { +} + +#dest adult { +# domainlist BL/adult/domains +# urllist BL/adult/urls +# expressionlist BL/adult/expressions +# redirect http://admin.foo.bar.de/cgi-bin/blocked.cgi?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u +#} + +# +# ACL RULES: +# acl { + admin { + pass any + } + + foo-clients within workhours { + pass good !in-addr !porn any + } else { + pass any + } + + bar-clients { + pass local none + } + default { - pass !blacklist all - redirect http://192.168.1.1:81/index.html + pass local none + redirect http://admin.foo.bar.de/cgi-bin/blocked.cgi?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u } } diff --git a/patches/010-redirect.patch b/patches/010-redirect.patch deleted file mode 100644 index be0ba2c..0000000 --- a/patches/010-redirect.patch +++ /dev/null @@ -1,126 +0,0 @@ -diff -ur squidGuard-1.5-beta.orig/src/main.c squidGuard-1.5-beta/src/main.c ---- squidGuard-1.5-beta.orig/src/main.c 2013-12-12 11:47:31.000000000 +1300 -+++ squidGuard-1.5-beta/src/main.c 2013-12-12 11:50:38.000000000 +1300 -@@ -185,7 +185,7 @@ - sgReloadConfig(); - } - if(failsafe_mode) { -- puts(""); -+ puts("ERR message=\"squidGuard failsafe mode\""); - fflush(stdout); - if(sig_hup){ - sgReloadConfig(); -@@ -194,7 +194,7 @@ - } - if(parseLine(buf,&squidInfo) != 1){ - sgLogError("ERROR: Error parsing squid line: %s",buf); -- puts(""); -+ puts("BH message=\"squidGuard error parsing squid line\""); - } - else { - src = Source; -@@ -206,14 +206,14 @@ - acl = sgAclCheckSource(src); - if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){ - if(src == NULL || src->cont_search == 0){ -- puts(""); -+ puts("ERR"); - break; - } else - if(src->next != NULL){ - src = src->next; - continue; - } else { -- puts(""); -+ puts("ERR"); - break; - } - } else { -@@ -228,6 +228,10 @@ - fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, - squidInfo.srcDomain,squidInfo.ident, - squidInfo.method); -+ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') { -+ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]); -+ } else -+ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect); - /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ - break; - } -diff -ur squidGuard-1.5-beta.orig/src/main.c.in squidGuard-1.5-beta/src/main.c.in ---- squidGuard-1.5-beta.orig/src/main.c.in 2013-12-12 11:47:31.000000000 +1300 -+++ squidGuard-1.5-beta/src/main.c.in 2013-12-12 11:53:18.000000000 +1300 -@@ -185,7 +185,7 @@ - sgReloadConfig(); - } - if(failsafe_mode) { -- puts(""); -+ puts("ERR message=\"squidGuard failsafe mode\""); - fflush(stdout); - if(sig_hup){ - sgReloadConfig(); -@@ -194,7 +194,7 @@ - } - if(parseLine(buf,&squidInfo) != 1){ - sgLogError("ERROR: Error parsing squid line: %s",buf); -- puts(""); -+ puts("BH message=\"squidGuard error parsing squid line\""); - } - else { - src = Source; -@@ -206,14 +206,14 @@ - acl = sgAclCheckSource(src); - if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){ - if(src == NULL || src->cont_search == 0){ -- puts(""); -+ puts("ERR"); - break; - } else - if(src->next != NULL){ - src = src->next; - continue; - } else { -- puts(""); -+ puts("ERR"); - break; - } - } else { -@@ -225,9 +225,11 @@ - squidInfo.ident[0] = '-'; - squidInfo.ident[1] = '\0'; - } -- fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, -- squidInfo.srcDomain,squidInfo.ident, -- squidInfo.method); -+ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') { -+ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]); -+ } else -+ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect); -+ - /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ - break; - } -diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c squidGuard-1.5-beta/src/sgDiv.c ---- squidGuard-1.5-beta.orig/src/sgDiv.c 2013-12-12 11:47:31.000000000 +1300 -+++ squidGuard-1.5-beta/src/sgDiv.c 2013-12-12 11:48:36.000000000 +1300 -@@ -782,7 +782,7 @@ - } - sgLogError("ERROR: Going into emergency mode"); - while(fgets(buf, MAX_BUF, stdin) != NULL){ -- puts(""); -+ puts("ERR"); - fflush(stdout); - } - sgLogError("ERROR: Ending emergency mode, stdin empty"); -diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c.in squidGuard-1.5-beta/src/sgDiv.c.in ---- squidGuard-1.5-beta.orig/src/sgDiv.c.in 2013-12-12 11:47:31.000000000 +1300 -+++ squidGuard-1.5-beta/src/sgDiv.c.in 2013-12-12 11:48:36.000000000 +1300 -@@ -782,7 +782,7 @@ - } - sgLogError("ERROR: Going into emergency mode"); - while(fgets(buf, MAX_BUF, stdin) != NULL){ -- puts(""); -+ puts("ERR"); - fflush(stdout); - } - sgLogError("ERROR: Ending emergency mode, stdin empty"); From cf36258d07b153aafd8c00cc3a605093a1e1d454 Mon Sep 17 00:00:00 2001 From: JS Bruneau Date: Sat, 9 Mar 2019 04:03:22 -0500 Subject: [PATCH 3/3] Quick Fix on the log path and renamed the config file to the proper camel case --- Makefile | 2 +- files/{squidguard.conf => squidGuard.conf} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename files/{squidguard.conf => squidGuard.conf} (97%) diff --git a/Makefile b/Makefile index 1666b1f..4a91771 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ define Package/squidGuard/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/squidGuard $(1)/opt/sbin $(INSTALL_DIR) $(1)/opt/etc/squidguard - $(INSTALL_CONF) ./files/squidguard.conf $(1)/opt/etc/squidguard/squidguard.conf + $(INSTALL_CONF) ./files/squidGuard.conf $(1)/opt/etc/squidguard/squidGuard.conf $(INSTALL_DIR) $(1)/opt/usr/squidguard/db/blacklist $(CP) $(PKG_BUILD_DIR)/test/blacklist/* $(1)/opt/usr/squidguard/db/blacklist diff --git a/files/squidguard.conf b/files/squidGuard.conf similarity index 97% rename from files/squidguard.conf rename to files/squidGuard.conf index 6e07d33..d61247e 100644 --- a/files/squidguard.conf +++ b/files/squidGuard.conf @@ -4,7 +4,7 @@ # Caution: do NOT use comments inside { } # -dbhome /var/lib/squidguard/db +dbhome /opt/usr/squidguard/db logdir /var/log/squidguard #