add net-proxy

This commit is contained in:
Jörg Deckert 2025-01-13 20:08:14 +01:00
parent 145e94f2b7
commit fa7b44b4c9
20 changed files with 1005 additions and 0 deletions

View File

@ -0,0 +1,2 @@
DIST e2guardian-5.5.7r.tar.gz 2152630 BLAKE2B 3e74551256ac4d44f8776296e7958ea7dce9570f894b79f741580099c5b3bd87c3369d80964ee714552639336cd275ac5c2e9ada988735aa952c10e830585d3e SHA512 05cc0eb95afa328bf9442ae399012d70dff64ae0161aebe51cd81b42835e1059c61da563094b3ecb7c484ba51d83051f8e8088b365d1d36e4437fdb193209e75
EBUILD e2guardian-5.5.7r.ebuild 3115 BLAKE2B 1b3c32ee07d4185a4564e161906a0e6e80596699ef57ccb3007cd6eb94b963fc4b753110e5fc9feafd20d00fb86d2e4ba81cba74703ef63814296dc527683b8f SHA512 e2bfb2042d6a8af471f1b5d99cc60fcb6151f3556295ee57b760ba28ec40b81a0d6655ff698d59e8676e30020f467e7198a179fb6a01aef91a85a24dbd34bf53

View File

@ -0,0 +1,124 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="8"
AUTOTOOLS_AUTORECONF="1"
AUTOTOOLS_IN_SOURCE_BUILD="1"
inherit autotools systemd
DESCRIPTION="Web content filtering via proxy"
HOMEPAGE="http://www.${PN}.org"
SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="avast backtrace clamav commandline debug dnsauth email +fancydm icap kaspersky +lfs logrotate ntlm orig-ip +pcre sslmitm static-libs trickledm"
RDEPEND="sys-libs/zlib
clamav? ( app-antivirus/clamav )
logrotate? ( app-admin/logrotate )
ntlm? ( virtual/libiconv )
pcre? ( >=dev-libs/libpcre-8.32 )"
DEPEND="${RDEPEND}
virtual/pkgconfig"
WIKI="http://contentfilter.futuragts.com/wiki/doku.php"
pkg_setup() {
enewgroup ${PN}
enewuser ${PN} -1 -1 /dev/null ${PN}
}
src_prepare() {
eapply_user
eautoreconf
}
src_configure() {
local debug
if use debug ; then
debug="$(use_with debug dgdebug)"
fi
econf \
$(use_enable avast avastd) \
$(use_enable backtrace segv-backtrace) \
$(use_enable clamav clamd) \
$(use_enable commandline) \
${debug} \
$(use_enable dnsauth) \
$(use_enable email) \
$(use_enable fancydm) \
$(use_enable icap) \
$(use_enable kaspersky kavd) \
$(use_enable lfs) \
--with-logdir=/var/log/${PN} \
$(use_enable ntlm) \
$(use_enable orig-ip) \
$(use_enable pcre) \
--with-piddir=/var/run \
--with-proxygroup=${PN} \
--with-proxyuser=${PN} \
$(use_enable sslmitm) \
$(use_enable static-libs static-zlib) \
$(use_enable trickledm)
}
src_install() {
default
# Edit config files for virus scanners chosen based on USE flags.
if use avast; then
sed -r -i -e 's/^#( *contentscanner *=.*avastdscan[.]conf.*)/\1/' "${D}/etc/${PN}/${PN}.conf"
fi
if use clamav; then
sed -r -i -e 's/[ \t]+use dns/& clamd/' "${D}/etc/init.d/${PN}"
sed -r -i -e 's/^#( *contentscanner *=.*clamdscan[.]conf.*)/\1/' "${D}/etc/${PN}/${PN}.conf"
fi
if use commandline; then
sed -r -i -e 's/^#( *contentscanner *=.*commandlinescan[.]conf.*)/\1/' "${D}/etc/${PN}/${PN}.conf"
fi
if use icap; then
sed -r -i -e 's/^#( *contentscanner *=.*icapscan[.]conf.*)/\1/' "${D}/etc/${PN}/${PN}.conf"
fi
if use kaspersky; then
sed -r -i -e 's/^#( *contentscanner *=.*kavdscan[.]conf.*)/\1/' "${D}/etc/${PN}/${PN}.conf"
fi
# Install Gentoo init script
newinitd "data/scripts/systemv-init" ${PN}
# Install systemd service unit
systemd_dounit data/scripts/${PN}.service
# Install log rotation file.
if use logrotate; then
insinto /etc/logrotate.d
doins data/scripts/${PN}
else
exeinto /etc/cron.weekly
newexe data/scripts/logrotation ${PN}.cron
fi
keepdir /var/log/${PN}
fperms o-rwx /var/log/${PN}
}
pkg_postinst() {
local runas="${PN}:${PN}"
if [ -d "${ROOT}/var/log/${PN}" ] ; then
chown -R ${runas} "${ROOT}/var/log/${PN}"
chmod o-rwx "${ROOT}/var/log/${PN}"
fi
einfo "For assistance configuring ${PN}, visit the wiki at ${WIKI}"
}

View File

@ -0,0 +1,9 @@
AUX blockedsites 8 BLAKE2B 859fc39a3734eda96cefa9d8997e6a63c74d8166e063b4d8ee0f12f224cb9dd9709fd7c868bd5775d05af2f0c710774742d39393377b4e0a6766089f6ad2bf05 SHA512 5b7ae0ece304235c61be154d285c52a622c82270d8af3447eabb05a3705a1f6987c51cc71a14fe2b75eb48440133674f22e5700630e5a96b3097f8d10ade1479
AUX squidGuard.conf.blocksites 192 BLAKE2B 0bbb4b05d91bc2ca78a5ba52213967bb5e428c6ffe361b319afe1e9e0dfa81bfb5f56090cb9d4e75a4c159f0fda5afb8642611dc2cae811a9e629de678f8209f SHA512 a6bab8318df1937c68c99de188c095b3deb61ae32cc0e96fe5f5652697bafa8f3591a7a239f93d3c3db84a7dfa2dab3f6c3a4e621c4b1a147bc7f1ec2d34fc19
AUX squidGuard.conf.minimal 61 BLAKE2B ddc399b51d396868be42a7dd1709e0b2df372dc95696da06916542c12a19ec15a7e596e04aa6454fc81315ee27dc1fddb4bb23fe1d31fcde3ca8c4b42298f85b SHA512 301263fcfaf345c34b5a988ce237bc578fb48f63ab2187b5dd2f146e4cf914bf823fcce49c27f8282e745f3125e32455d9c5a5f425d40ce7785f492663eb959c
AUX squidguard-1.6.0-gcc-10.patch 1351 BLAKE2B f13224eb35e98fb5ec83d286016404fcbb55976f4616d0dfea52472a29ca2ea8686d5450d32fee99c8198d0d3804bfa07624228c3d843294f34357edf5ddaed7 SHA512 906b8ad819f043115958aac90e88c1c8b17ea1a330d6fd734403bee67b4d7e6bf448ff14cd012df893ae5f5e58e126d8ac31c77e4f1b9447e7317c7cc5f749be
AUX squidguard-1.6.0-gentoo.patch 982 BLAKE2B 9858c7778fbf52573061fd12d3c3941c4f5b5011c09e7cd54859d6fdd9e969f9e7033abd8cfafa019000309aad50ceac63cc082f5b394ea9ee67c30561376879 SHA512 58b8f9a469fe1ca563f1e9e9425362a594eb7a472f0c019f54d42c06dcee2b6a207ee6dded297c86e06288e78ed62879170b8305b20aa29b37d0b658ef843288
AUX squidguard-1.6.0-stdlib.patch 1269 BLAKE2B ece723dbc97a6386ad04b585f04249fae738cf95a94cd06a5d9cfdf5df1e24200577fa91d7523df00979fbcb99b0d1800756256cb904aa251c05ce9cd716091c SHA512 acffe144817169c4df4fddcdb2ee5854e7db0b3e02951cbc6f3b9648e2ef65dba6eedbbce5592bc99a4e808d13c58df6ba5852f385397074e3550d252ec802fe
DIST squidguard-1.6.0.tar.gz 1902233 BLAKE2B 36b422fb2424c79532e0d9dc237b4a60b7817190a45de3646a50031b341c5e94540f55adea7b3e8241b8d87fdec551c5c40d1f60ea90e25347305ef9e473b5d3 SHA512 d6e934f550cd777d58abda5f4fd905ccc396afc28e1ddb0bb842a9a3364cbe43db5c30834fe1ed7d93623a361dde50362a79ac2b660382c7e81b4f067f2ac65e
EBUILD squidguard-1.6.0-r2.ebuild 2398 BLAKE2B 051ac6d30be1f2210fb5e463afde555eb4c6e07b29dfdb0856efa368b27b25df10d1c1b21449472cd01d7799b8a138fbfcda929ae6a2359a5467db73d26eb16d SHA512 93528ed7e83ecfdce6c948a66e0b1a8b64dfe715766bbcf907138e381e48d5e3258704ab3ee5d99cf88d7e079e0bbfd11714a08a3ad61ddcad4f82934235ec88
MISC metadata.xml 168 BLAKE2B 2e0e000b4c3b6ca04c12903fdbe278415c05a822623c52e9aa95cbbf3d50bcb1246b7edbda7d2f6b559af8950c6374e6e0a69b76319964cfe686bf50b0604a57 SHA512 4dcf45d1809e8390a2d8155c8ebfe0dd610203e392aeab0ccd8a10f42cc8532a4925eff32b35e7a6c35598a4efd288229034ec0732299dbd8cfa0acff705fed3

View File

@ -0,0 +1 @@
sex.com

View File

@ -0,0 +1,13 @@
logdir /var/log/squidGuard
dbhome /etc/squidGuard/db
dest blockedsites {
domainlist blockedsites
}
acl {
default {
pass !blockedsites all
redirect http://www.sample.com/empty.png
}
}

View File

@ -0,0 +1,7 @@
logdir /var/log/squidGuard
acl {
default {
pass all
}
}

View File

@ -0,0 +1,54 @@
--- a/src/y.tab.c.bison 2020-03-08 20:05:00.750000000 +0300
+++ b/src/y.tab.c.bison 2020-03-08 20:04:42.160000000 +0300
@@ -217,7 +217,7 @@
#include "sgEx.h"
-FILE *yyin, *yyout;
+extern FILE *yyin, *yyout;
char *configFile;
int numTimeElements;
--- a/src/sg.h.in 2020-03-08 20:02:46.900000000 +0300
+++ b/src/sg.h.in 2020-03-08 20:03:22.110000000 +0300
@@ -115,7 +115,7 @@
#define REDIRECT_PERMANENT "301:"
#define REDIRECT_TEMPORARILY "302:"
-char *progname;
+extern char *progname;
struct LogFileStat {
char *name;
@@ -337,7 +337,7 @@
struct AclDest *next;
};
-int lineno;
+extern int lineno;
char *sgParseRedirect __P((char *, struct SquidInfo *, struct Acl *, struct AclDest *));
char *sgAclAccess __P((struct Source *, struct Acl *, struct SquidInfo *));
--- a/src/main.c.in 2020-03-08 20:10:55.650000000 +0300
+++ b/src/main.c.in 2020-03-08 20:11:13.590000000 +0300
@@ -21,6 +21,9 @@
#include <syslog.h>
#endif
+char *progname;
+int lineno;
+
struct Setting *lastSetting = NULL;
struct Setting *Setting = NULL; /* linked list, Calloc */
--- a/src/sg.y.in 2020-03-08 20:14:46.180000000 +0300
+++ b/src/sg.y.in 2020-03-08 20:14:57.110000000 +0300
@@ -35,7 +35,7 @@
#include "sgEx.h"
-FILE *yyin, *yyout;
+extern FILE *yyin, *yyout;
char *configFile;
int numTimeElements;

View File

@ -0,0 +1,33 @@
--- squidGuard-1.6.orig/Makefile.in 2020-01-09 18:36:44.000000000 +0000
+++ squidGuard-1.6/Makefile.in 2020-01-10 13:02:14.000000000 +0000
@@ -43,7 +43,7 @@
# Dependencies for installing
#
-install: install-build install-conf
+install: install-build
install-conf:
@echo Installing configuration file ;
--- squidGuard-1.6.orig/src/Makefile.in 2020-01-03 12:05:39.000000000 +0000
+++ squidGuard-1.6/src/Makefile.in 2020-01-10 13:02:14.000000000 +0000
@@ -110,6 +110,8 @@
mv -f y.tab.c y.tab.c.bison
mv -f y.tab.h y.tab.h.bison
+sg.y sg.l:
+
#
# Dependencies for installing
#
@@ -122,8 +124,8 @@
install.bin:: squidGuard
@echo making $@ in `basename \`pwd\``
- @$(MKDIR) $(bindir) $(logdir) $(cfgdir)
- $(INSTALL_PROGRAM) squidGuard $(bindir)/squidGuard
+ @$(MKDIR) "$(DESTDIR)"/$(bindir) "$(DESTDIR)"/$(logdir) "$(DESTDIR)"/$(cfgdir)
+ $(INSTALL_PROGRAM) squidGuard "$(DESTDIR)"/$(bindir)/squidGuard
uninstall.bin::
@echo making $@ in `basename \`pwd\``

View File

@ -0,0 +1,53 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2019-02-02 18:00:40.000000000 +0100
+++ b/configure.ac 2025-01-13 12:13:48.087653985 +0100
@@ -233,6 +233,9 @@
AC_DEFINE(HAVE_LIBLDAP, 1, [Define if LDAP support should be compiled])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <ldap.h>
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
int main()
{
LDAP *p;
@@ -342,6 +345,9 @@
LIBS="$LIBS -ldb"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <db.h>
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
int main()
{
int major, minor, patch;
@@ -377,6 +383,9 @@
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <db.h>
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
int main()
{
int major, minor, patch;
@@ -413,6 +422,9 @@
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <db.h>
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
int main()
{
int major, minor, patch;
@@ -441,6 +453,9 @@
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <db.h>
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
int main()
{
int major, minor, patch;

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<!-- maintainer-needed -->
</pkgmetadata>

View File

@ -0,0 +1,101 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools db-use
DESCRIPTION="Combined filter, redirector and access controller plugin for Squid"
HOMEPAGE="http://www.squidguard.org"
SRC_URI="mirror://debian/pool/main/s/squidguard/${PN}_${PV}.orig.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ~arm ppc ppc64 ~sparc x86"
IUSE="ldap"
RDEPEND="
acct-group/squid
acct-user/squid
|| (
sys-libs/db:5.3
sys-libs/db:4.8
)
ldap? ( net-nds/openldap:= )"
DEPEND="${RDEPEND}"
BDEPEND="
app-alternatives/yacc:0
app-alternatives/lex:0
"
suitable_db_version() {
local tested_slots="5.3 4.8"
for ver in ${tested_slots}; do
if [[ -n $(db_findver sys-libs/db:${ver}) ]]; then
echo ${ver}
return 0
fi
done
die "No suitable BerkDB versions found, aborting"
}
src_prepare() {
eapply \
"${FILESDIR}/${P}-gentoo.patch" \
"${FILESDIR}/${P}-gcc-10.patch" \
"${FILESDIR}/${P}-stdlib.patch"
# Link only with specific BerkDB versions
# Do not inject default paths for library searching
db_version="$(suitable_db_version)"
sed -i \
-e "/\$LIBS -ldb/s/-ldb/-l$(db_libname ${db_version})/" \
-e '/$LDFLAGS $db_lib $ldap_lib/d' \
configure.ac || die
eapply_user
eautoreconf
# Workaround for missing install-sh, bug #705374
local amver=$(best_version dev-build/automake)
amver=$(ver_cut 1-2 "${amver#dev-build/automake-}")
cp -p "${BROOT}/usr/share/automake-${amver}/install-sh" . || die
}
src_configure() {
econf \
$(use_with ldap) \
--with-db-inc="$(db_includedir ${db_version})" \
--with-sg-config=/etc/squidGuard/squidGuard.conf \
--with-sg-logdir=/var/log/squidGuard
}
src_install() {
emake prefix="/usr" DESTDIR="${D}" install
keepdir /var/log/squidGuard
fowners squid:squid /var/log/squidGuard
insinto /etc/squidGuard/sample
doins "${FILESDIR}"/squidGuard.conf.*
insinto /etc/squidGuard/sample/db
doins "${FILESDIR}"/blockedsites
dodoc ANNOUNCE CHANGELOG README
docinto html
dodoc doc/*.html
docinto text
dodoc doc/*.txt
}
pkg_postinst() {
einfo "To enable squidGuard, add the following lines to /etc/squid/squid.conf:"
einfo " url_rewrite_program /usr/bin/squidGuard"
einfo " url_rewrite_children 10"
einfo ""
einfo "Remember to edit /etc/squidGuard/squidGuard.conf first!"
einfo "Examples can be found in /etc/squidGuard/sample/"
}

View File

@ -0,0 +1,10 @@
AUX ufdb.confd 672 BLAKE2B eb7506552be81d4ae85c6fab23a2dd00125473eb2e00135b2a842257a7e9d25cab5bc86de34578bfa0d84b6981b13286f209137927022862e29beb7d601ec768 SHA512 7a1b39ba44485c7f4c44841079a4ca774e8a5af76914c2b58d6467fc324b6a0350deb52d7afdfa766f6e6607d67743343c50874ef79bf6b7bea4e92585b0a164
AUX ufdb.initd 1905 BLAKE2B a5d0d6f0c6c87c5124fedfa20cdd3a5c5aabcfeac258677b91ca859b717e880992f4278d8dc864792f9423610e88fde544df3fa652ecf35b86c2682e14969a8c SHA512 1cec1a5f025674caff5f264b9d10944aeaf30c292d016c0676d904215b0601667c9a9ffbb14ecea880cd696355b64bd5a23d3878fa08234d63f0f33a60d346bd
AUX ufdb.initd.2 1625 BLAKE2B 1a0c54754ad841201df8835710c5abb4b64a1aaf7cbefea8201686c4bde9c5b55234a2e8a7e293523273d53b8d966cda58f417cc6910d968e52ef3b799b0ec42 SHA512 aff0438fec6201ef8d5af6a7478af2dbe8407498f3cc14894ba0d6d368a4267c402edc3dafa0d47bc84399026efafb2e4f96dc75c17d514f0c18cf3407e315a4
AUX ufdbUpdate.cron 464 BLAKE2B 518289ef45569aab463a4e8f97494a1d6d80e8764044c5789f312cae41cc700caeddbf678ddf3b52681a877a4d27732e688d6ae62c67dfc44ab5baf0f039e70f SHA512 162dc5021b1cc946c1ff8c0d082c3137302811bd0b2b781951b2eceb62121d48ceae7e87684af70a2176d314c8ee95b85c0044635b908a05a4f9c3dcf4daaabe
AUX ufdbguard-1.23-parallel-make.patch 3910 BLAKE2B cffc5e4e139f38de7acf64b3b5dfc9026fb07e8eb25066bd717214e0e5b9d431788bc2482dac69e45b4f34bedbf659ade10285fd33e4555a965ebb1cf3706c1b SHA512 0eecdefe1175f4ffefc48e8be82c9ccc7d4aff621d6c4044ccb2303d7a990aa5bf0f2fc5714a22a9b9f70f28dd35a1002a4274771586d32d02789052866a8967
AUX ufdbguard-1.24-gentoo.patch 536 BLAKE2B b13634ad226ca59d1d2a64349c958a0147b08b0b85d061ef35d21451c39264b8dd4a6c22667f0a88ee767ed59a249158d078b9aba1142b8a76bfb8deeaba134c SHA512 ddd39b4841d740df5102717dbe2eb41917e49d42338343f7f402e4049a5ab252841138541b7c659934d30cf9a31a7274bf226c108af80826b608fbc2e709f6e4
AUX ufdbguard-1.29-parallel-make.patch 3909 BLAKE2B 99e55d4fd84ecd14706132960a4178558abfde1fc200b581b93ef8ac65312d60a939b1d6a97063dcf1f81b04c85e0dbc3e39138c6f26633b73d8f024444ea11a SHA512 2dbc85c74f0bcc3d95ceba6403088285e8a4b930e31617b6d26471c02b42adda4c8c6a5edcb0cc69b5645ecc2cb865d08db2558b47f41c6e25d03d448ecd10e0
DIST ufdbGuard-1.35.8.tar.gz 1840959 BLAKE2B 909bc7f309bc139d7fec954e93917255c3ac52377db036a8981cbd96f5249411eb28860f290ea3aa7acaf03e082dac10f6c762e9f16a28e9cfc543c2383a58e2 SHA512 c80f1641bcf6eb4e7a7e457d0c45ccffe84c7cab8811360565566bcd38a49db5b9463c4327a3701e3e52f41593fa3a5be27c950f50dac15dc6df47035827faa5
DIST ufdbguard-1.35.8-manual.pdf 1290927 BLAKE2B ffec776d6d9ed53be02c82c34e343d82ded2e567ef620265e53e8b6f0568d4247e9b5284eb027c7a9db02873e49429851fc2988afeb16aaa8a9a589b0d1da9a6 SHA512 783540a2ccec6ae7b50390b292375deeef4fe59452dc792650766802378faf0b3837bf3d8628bcc1b8635245748a49a928ac3437960c5ba10afc125a9c4c8af0
EBUILD ufdbguard-1.35.8.ebuild 3982 BLAKE2B 886ebddb16d092364ba5076b49dd9267967a72a56d4490607fce7e01df331b26f82e87cdee85b099567b5ebd195e876c2160640b616c46ea3104516a106be857 SHA512 024b20641104db1077f23f2533443ceb404c5675f96178abf7eb83e17ce2cebca5745c69557e67567281634a95812eed1e665d0d104b729f45aa04cb5b118d5d

View File

@ -0,0 +1,21 @@
# -*- sh -*-
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ufdbguard/files/ufdb.confd,v 1.2 2011/05/01 16:05:50 flameeyes Exp $
# Tables to re-generate when starting or reloading ufdbguard
UFDB_GT="alwaysallow alwaysdeny"
# Options passed to ufdbGenTable when generating the tables listed in
# UFDB_GT
GENTABLE_OPTIONS="-W"
# User under which to run ufdbguard; it should be the same as the
# proxy server you're using, so by default it is squid.
UFDB_USER="squid"
# Options to pass to ufdbguardd; see /usr/libexec/ufdbguard/ufdbguardd
# -h for a brief list.
UFDB_OPTS=""
# Options used by the modified ufdbUpdate script in Gentoo
DOWNLOAD_USER=""
DOWNLOAD_PASSWORD=""

View File

@ -0,0 +1,83 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ufdbguard/files/ufdb.initd,v 1.4 2011/09/14 11:37:04 flameeyes Exp $
# reconfig is what the upstream documentation suggests, so let's
# provide it for compatibility.
extra_started_commands="reload reconfig"
depend() {
need net
before squid
use logger
}
get_config() {
awk '$1 == "'$1'" { print $2 }' "/etc/ufdbGuard.conf"
}
gentables() {
local dbhome=$(get_config dbhome)
for gt in ${UFDB_GT} ; do
[ -f "${dbhome}/${gt}/domains" ] || continue
urls=
[ -f "${dbhome}/${gt}/urls" ] && urls="${dbhome}/${gt}/urls"
ebegin "Generating domainlist ${gt}"
ufdbGenTable ${GENTABLE_OPTIONS} -t "${gt}" -d "${dbhome}/${gt}/domains" ${urls:+-u "${urls}"}
eend $?
done
}
start() {
gentables
local logdir=$(get_config logdir)
if [ ! -d "${logdir}" ] ; then
mkdir -p ${logdir}
chown -R ${UFDB_USER} ${logdir}
fi
if [ ! -d /var/run/ufdbguardd ] ; then
mkdir -p /var/run/ufdbguard
chown -R ${UFDB_USER} /var/run/ufdbguard
fi
ebegin "Starting ufdbGuard"
start-stop-daemon --start \
--user ${UFDB_USER} \
--wait 1500 \
--exec /usr/libexec/ufdbguard/ufdbguardd \
--pidfile /var/run/ufdbguard/ufdbguardd.pid -- \
-c /etc/ufdbGuard.conf ${UFDB_OPTS}
eend $? "Failed to start ufdbGuard"
}
stop() {
ebegin "Stopping ufdbGuard"
start-stop-daemon --stop \
--exec /usr/libexec/ufdbguard/ufdbguardd \
--pidfile /var/run/ufdbguard/ufdbguardd.pid
eend $? "Failed to stop ufdbGuard"
}
reload() {
if ! [ -f /var/run/ufdbguard/ufdbguardd.pid ]; then
eerror "Unable to find PID file for ufdbguardd, was it just started?"
return 1
fi
gentables
ebegin "Reloading ufdbGuard"
kill -HUP "$(cat /var/run/ufdbguard/ufdbguardd.pid)"
eend $? "Failed to reload ufdbGuard"
}
reconfig() {
reload
}

View File

@ -0,0 +1,68 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ufdbguard/files/ufdb.initd.2,v 1.3 2012/12/28 11:59:30 flameeyes Exp $
# reconfig is what the upstream documentation suggests, so let's
# provide it for compatibility.
extra_started_commands="reload reconfig"
: ${configfile:=/etc/ufdbGuard.conf}
pidfile=/var/run/ufdbguard/ufdbguardd.pid
command=/usr/libexec/ufdbguard/ufdbguardd
command_arguments="-c ${configfile} ${FUDB_OPTS}"
start_stop_daemon_args="--user ${UFDB_USER} --wait 1500"
name="ufdbGuard Daemon"
depend() {
need localmount
before squid
use logger
}
get_config() {
# Okay this sounds silly, but it is important because the settings
# in ufdbGuard are quoted, so this unquotes them.
eval echo $(awk '$1 == "'$1'" { print $2 }' "${configfile}")
}
gentables() {
local dbhome=$(get_config dbhome)
for gt in ${UFDB_GT} ; do
[ -f "${dbhome}/${gt}/domains" ] || continue
urls=
[ -f "${dbhome}/${gt}/urls" ] && urls="${dbhome}/${gt}/urls"
ebegin "Generating domainlist ${gt}"
ufdbGenTable ${GENTABLE_OPTIONS} -t "${gt}" -d "${dbhome}/${gt}/domains" ${urls:+-u "${urls}"}
eend $?
done
}
start_pre() {
gentables
checkpath -d -m 0755 -o ${UFDB_USER} $(get_config logdir) "$(dirname "${pidfile}")"
}
reload() {
if ! [ -f ${pidfile} ]; then
eerror "Unable to find PID file for ufdbguardd, was it just started?"
return 1
fi
gentables
ebegin "Reloading ufdbGuard"
kill -HUP "$(cat ${pidfile})"
eend $? "Failed to reload ufdbGuard"
}
reconfig() {
reload
}

View File

@ -0,0 +1,14 @@
#!/bin/sh
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ufdbguard/files/ufdbUpdate.cron,v 1.2 2011/01/31 05:37:32 jer Exp $
# cron.daily file to update the ufdb database
# Avoid doing anything if no download user is set in the configuration
# file
( . /etc/conf.d/ufdb ; [ -z "${DOWNLOAD_USER}" ]; ) && exit
/usr/sbin/ufdbUpdate
/etc/init.d/squid rotate

View File

@ -0,0 +1,133 @@
--- a/src/Makefile.in 2010-04-12 04:39:43.000000000 +0200
--- b/src/Makefile.in 2010-05-07 05:26:03.000000000 +0200
@@ -135,8 +135,8 @@
# Dependencies for installing
#
-daemon:
- cd mtserver; make
+daemon: $(UFDBOBJS)
+ cd mtserver; $(MAKE)
ufdbhttpd: ufdbhttpd.o httpserver.o ufdbbase.o ufdblib.o sgLog.o crypt.o
$(LINK) ufdbhttpd.o httpserver.o ufdbbase.o ufdblib.o sgLog.o crypt.o $(LIBS)
@@ -235,7 +235,7 @@
$(RM) $(bindir)/ufdbhttpd
install.mt::
- cd mtserver ; make
+ cd mtserver ; $(MAKE)
$(INSTALL_PROGRAM) mtserver/ufdbguardd $(bindir)/ufdbguardd
$(INSTALL_PROGRAM) mtserver/ufdbgclient $(bindir)/ufdbgclient
@@ -272,8 +272,8 @@
$(RM) *~ *.bak core core.* *.log *.log.[0-9] *.error
$(RM) *.o y.tab.c y.tab.h ufdbGuard ufdbGenTable ufdbAnalyse ufdbPrintTable ufdbhttpd
$(RM) ipv6 iptst rwtest lex.yy.c
- -@cd mtserver && make clean
- -@cd api 2>/dev/null && make clean
+ -@cd mtserver && $(MAKE) clean
+ -@cd api 2>/dev/null && $(MAKE) clean
realclean:: clean
@echo making $@ in `basename \`pwd\``
@@ -286,11 +286,11 @@
distclean:: realclean
@echo making $@ in `basename \`pwd\``
$(RM) Makefile sg.h config.h ufdbUpdate ufdbConvertDB ufdbGuard.conf
- -cd mtserver ; make distclean
+ -cd mtserver ; $(MAKE) distclean
apidistclean: distclean
@echo making $@ in `basename \`pwd\``
- -cd api ; make distclean
+ -cd api ; $(MAKE) distclean
grab: ufdbGrab
./ufdbGrab $(cfgdir) $(logdir)
@@ -532,25 +532,25 @@
$(CC) --version
g2953:
- make clean
- CC=/usr/local/gcc/2.95.3/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/2.95.3/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g344:
- make clean
- CC=/usr/local/gcc/3.4.4/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/3.4.4/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g401:
- make clean
- CC=/usr/local/gcc/4.0.1/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.0.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g411:
- make clean
- CC=/usr/local/gcc/4.1.1/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.1.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
qinst:
/etc/init.d/squid stop
/etc/init.d/ufdb stop
- make install
+ $(MAKE) install
/etc/init.d/ufdb start
/etc/init.d/squid start
--- a/src/mtserver/Makefile.in 2010-04-12 02:56:20.000000000 +0200
--- b/src/mtserver/Makefile.in 2010-05-07 05:26:03.000000000 +0200
@@ -48,10 +48,10 @@
$(LINK) ufdbgclient.o -L. -lufdbd $(SOLARIS_LIBS)
../lex.yy.o:
- cd .. ; make lex.yy.o
+ cd .. ; $(MAKE) lex.yy.o
../y.tab.o:
- cd .. ; make y.tab.o
+ cd .. ; $(MAKE) y.tab.o
$(MYLIB): ../crypt.o ../lex.yy.o ../sgDiv.o ../sgLog.o ../ufdbLookup.o \
../ufdblib.o ../y.tab.o ../ufdbbase.o
@@ -60,7 +60,7 @@
../ufdblib.o ../y.tab.o ../ufdbbase.o
ptmalloc3/libptmalloc3.a:
- cd ptmalloc3 ; make linux-pthread
+ cd ptmalloc3 ; $(MAKE) linux-pthread
$(MYLIBSSL): ../ufdbchkport.o ../httpsQueue.o ../ufdbHashtable.o
-@rm -f $(MYLIBSSL)
@@ -102,7 +102,7 @@
./ufdbgclient -p $(PORT) -l . -d "www.sex.com" 10.1.1.1 kees
../../test/blacklist/domains.ufdb: ../../test/blacklist/domains
- cd ../../test ; make blacklist/domains.ufdb
+ cd ../../test ; $(MAKE) blacklist/domains.ufdb
LEAKOPTS= --leak-check=full --show-reachable=yes
LEAKOPTS=
@@ -382,7 +382,7 @@
time ./ufdbgclient -p $(PORT) -l . < ../100000 > /dev/null 2>&1
tt:
- make tp3
+ $(MAKE) tp3
sleep 3
kill -HUP `ps -ef | grep ufdbguardd | grep -v grep | head -1 | awk '{ print $$2 }'`
@@ -455,6 +455,6 @@
g411:
- make clean
- CC=/usr/local/gcc/4.1.1/bin/gcc make -e $(MAKEFLAGS) all
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.1.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) all

View File

@ -0,0 +1,13 @@
Index: ufdbGuard-1.24/src/ufdbUpdate.in
===================================================================
--- ufdbGuard-1.24.orig/src/ufdbUpdate.in
+++ ufdbGuard-1.24/src/ufdbUpdate.in
@@ -39,6 +39,8 @@ WGET_COMMAND="@WGET@"
NOTIFY_UFDBGUARDD="yes" # send HUP signal to ufdbguardd
SYSLOG_FACILITY="local6" # errors/warnings in system log have this facility name
+source /etc/conf.d/ufdb
+
# end of user settings.
# DO NOT EDIT ANYTHING BELOW THIS LINE. ########################################

View File

@ -0,0 +1,132 @@
--- a/src/Makefile.in 2010-04-12 04:39:43.000000000 +0200
--- b/src/Makefile.in 2010-05-07 05:26:03.000000000 +0200
@@ -135,8 +135,8 @@
# Dependencies for installing
#
-daemon:
- cd mtserver; make
+daemon: $(UFDBOBJS)
+ cd mtserver; $(MAKE)
ufdbhttpd: ufdbhttpd.o httpserver.o ufdbbase.o ufdblib.o sgLog.o crypt.o
$(LINK) ufdbhttpd.o httpserver.o ufdbbase.o ufdblib.o sgLog.o crypt.o $(LIBS)
@@ -235,6 +235,6 @@
$(RM) $(bindir)/ufdbhttpd
install.mt::
- cd mtserver ; make
+ cd mtserver ; $(MAKE)
$(INSTALL_PROGRAM) mtserver/ufdbguardd $(bindir)/ufdbguardd
$(INSTALL_PROGRAM) mtserver/ufdbgclient $(bindir)/ufdbgclient
@@ -272,8 +272,8 @@
$(RM) *~ *.bak core core.* *.log *.log.[0-9] *.error
$(RM) *.o y.tab.c y.tab.h ufdbGuard ufdbGenTable ufdbAnalyse ufdbPrintTable ufdbhttpd
$(RM) ipv6 iptst rwtest lex.yy.c
- -@cd mtserver && make clean
- -@cd api 2>/dev/null && make clean
+ -@cd mtserver && $(MAKE) clean
+ -@cd api 2>/dev/null && $(MAKE) clean
realclean:: clean
@echo making $@ in `basename \`pwd\``
@@ -286,11 +286,11 @@
distclean:: realclean
@echo making $@ in `basename \`pwd\``
$(RM) Makefile sg.h config.h ufdbUpdate ufdbConvertDB ufdbGuard.conf
- -cd mtserver ; make distclean
+ -cd mtserver ; $(MAKE) distclean
apidistclean: distclean
@echo making $@ in `basename \`pwd\``
- -cd api ; make distclean
+ -cd api ; $(MAKE) distclean
grab: ufdbGrab
./ufdbGrab $(cfgdir) $(logdir)
@@ -532,25 +532,25 @@
$(CC) --version
g2953:
- make clean
- CC=/usr/local/gcc/2.95.3/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/2.95.3/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g344:
- make clean
- CC=/usr/local/gcc/3.4.4/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/3.4.4/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g401:
- make clean
- CC=/usr/local/gcc/4.0.1/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.0.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
g411:
- make clean
- CC=/usr/local/gcc/4.1.1/bin/gcc make -e $(MAKEFLAGS) ccversion all ufdbPrintTable
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.1.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) ccversion all ufdbPrintTable
qinst:
/etc/init.d/squid stop
/etc/init.d/ufdb stop
- make install
+ $(MAKE) install
/etc/init.d/ufdb start
/etc/init.d/squid start
--- a/src/mtserver/Makefile.in 2010-04-12 02:56:20.000000000 +0200
--- b/src/mtserver/Makefile.in 2010-05-07 05:26:03.000000000 +0200
@@ -48,10 +48,10 @@
$(LINK) ufdbgclient.o -L. -lufdbd $(SOLARIS_LIBS)
../lex.yy.o:
- cd .. ; make lex.yy.o
+ cd .. ; $(MAKE) lex.yy.o
../y.tab.o:
- cd .. ; make y.tab.o
+ cd .. ; $(MAKE) y.tab.o
$(MYLIB): ../crypt.o ../lex.yy.o ../sgDiv.o ../sgLog.o ../ufdbLookup.o \
../ufdblib.o ../y.tab.o ../ufdbbase.o
@@ -60,7 +60,7 @@
../ufdblib.o ../y.tab.o ../ufdbbase.o
ptmalloc3/libptmalloc3.a:
- cd ptmalloc3 ; make linux-pthread
+ cd ptmalloc3 ; $(MAKE) linux-pthread
$(MYLIBSSL): ../ufdbchkport.o ../httpsQueue.o ../ufdbHashtable.o
-@rm -f $(MYLIBSSL)
@@ -102,7 +102,7 @@
./ufdbgclient -p $(PORT) -l . -d "www.sex.com" 10.1.1.1 kees
../../test/blacklist/domains.ufdb: ../../test/blacklist/domains
- cd ../../test ; make blacklist/domains.ufdb
+ cd ../../test ; $(MAKE) blacklist/domains.ufdb
LEAKOPTS= --leak-check=full --show-reachable=yes
LEAKOPTS=
@@ -382,7 +382,7 @@
time ./ufdbgclient -p $(PORT) -l . < ../100000 > /dev/null 2>&1
tt:
- make tp3
+ $(MAKE) tp3
sleep 3
kill -HUP `ps -ef | grep ufdbguardd | grep -v grep | head -1 | awk '{ print $$2 }'`
@@ -455,6 +455,6 @@
g411:
- make clean
- CC=/usr/local/gcc/4.1.1/bin/gcc make -e $(MAKEFLAGS) all
+ $(MAKE) clean
+ CC=/usr/local/gcc/4.1.1/bin/gcc $(MAKE) -e $(MAKEFLAGS) all

View File

@ -0,0 +1,129 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ufdbguard/ufdbguard-1.29.ebuild,v 1.1 2012/08/29 22:30:16 flameeyes Exp $
EAPI="8"
inherit flag-o-matic
MY_P="ufdbGuard-${PV}"
DESCRIPTION="ufdbGuard is a redirector for the Squid internet proxy."
HOMEPAGE="https://www.urlfilterdb.com/products/ufdbguard.html"
SRC_URI="https://downloads.sourceforge.net/project/ufdbguard/1.35/ufdbGuard-${PV}.tar.gz
doc? ( https://downloads.sourceforge.net/project/ufdbguard/1.35/ReferenceManual_v1_35.pdf -> ${P}-manual.pdf )"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="+httpd doc"
RDEPEND="dev-libs/openssl
app-arch/bzip2
net-misc/wget"
DEPEND="${RDEPEND}
acct-group/squid
acct-user/squid
sys-devel/bison
sys-devel/flex"
S="${WORKDIR}/${MY_P}"
##src_prepare() {
## epatch "${FILESDIR}"/${PN}-1.29-parallel-make.patch
## epatch "${FILESDIR}"/${PN}-1.24-gentoo.patch
##
## egrep -r -e '/var/tmp/ufdb(guard|http)d.pid' "${S}" -lZ | xargs -0 \
## sed -i -e 's:/var/tmp/ufdb\(guard\|http\)d.pid:/var/run/ufdbguard/ufdb\1d.pid:' \
## || die
##
## # directory where ufdbhttpd is to be found
## sed -i -e 's:DEFAULT_BINDIR.*:DEFAULT_BINDIR "/usr/libexec/ufdbguard":' \
## src/ufdb.h.in || die
##}
src_configure() {
# better safe than sorry, the code has a number of possible
# breakage, and at least one certain breakage.
append-flags -fno-strict-aliasing
econf \
--with-ufdb-user=squid \
--with-ufdb-config=/etc \
--with-ufdb-logdir=/var/log/ufdbguard \
--with-ufdb-dbhome=/usr/share/ufdbguard/blacklists
}
src_install() {
dodoc CHANGELOG INSTALL README src/sampleufdbGuard.conf
doman doc/*.1
dobin src/ufdbAnalyse src/ufdbGenTable src/ufdbGrab \
src/ufdbConvertDB
dosbin src/ufdbUpdate
exeinto /usr/libexec/ufdbguard
doexe src/mtserver/ufdbguardd src/mtserver/ufdbgclient
if use httpd; then
exeinto /usr/libexec/ufdbguard
doexe src/ufdbhttpd
fi
keepdir /usr/share/ufdbguard/blacklists
insinto /etc
doins src/ufdbGuard.conf
insinto /usr/share/ufdbguard/images
doins src/images/*
newconfd "${FILESDIR}"/ufdb.confd ufdb
newinitd "${FILESDIR}"/ufdb.initd.2 ufdb
exeinto /etc/cron.daily
newexe "${FILESDIR}"/ufdbUpdate.cron ufdbUpdate
if use doc; then
insinto /usr/share/doc/${PF}
newins "${DISTDIR}"/${P}-manual.pdf ReferenceManual.pdf
fi
}
pkg_postinst() {
elog "The default location for the blacklist database has been"
elog "moved to /usr/share/ufdbguard/blacklists."
elog ""
elog "The configuration file is no longer configurable in the"
elog "service file, and now resides at /etc/ufdbGuard.conf ."
elog ""
elog "The service script has been renamed from ufdbguad to simply"
elog "/etc/init.d/ufdb, to follow the official documentation, and"
elog "it gained a reload option with a reconfig alias."
elog ""
elog "You can configure the username and password parameters for"
elog "ufdbUpdate, to fetch the blacklist database provided by"
elog "URLfilterDB, directly in /etc/conf.d/ufdb without touching"
elog "the script itself."
elog ""
elog "To enable ufdbguard in squid, you should add this to your"
elog "squid.conf:"
elog ""
elog " url_rewrite_program /usr/libexec/ufdbguard/ufdbgclient -l /var/log/ufdbguard"
elog " url_rewrite_children 64"
elog ""
if ! use httpd; then
elog "You chose to not install the lightweight http daemon that"
elog "comes with ufdbguard."
else
elog "The ufdb service will start both the ufdbguardd daemon and"
elog "the ufdbhttpd http daemon to provide a local redirect CGI."
elog "If you don't want this to happen, disable the httpd USE flag."
fi
if use doc; then
elog ""
elog "The reference manual has been installed as"
elog " /usr/share/doc/${PF}/ReferenceManual.pdf"
fi
}