diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-proxy/ufdbguard/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-proxy/ufdbguard/files')
-rw-r--r-- | net-proxy/ufdbguard/files/ufdb.confd | 20 | ||||
-rw-r--r-- | net-proxy/ufdbguard/files/ufdb.initd | 82 | ||||
-rw-r--r-- | net-proxy/ufdbguard/files/ufdb.initd.2 | 67 | ||||
-rw-r--r-- | net-proxy/ufdbguard/files/ufdbUpdate.cron | 13 | ||||
-rw-r--r-- | net-proxy/ufdbguard/files/ufdbguard-1.24-gentoo.patch | 13 |
5 files changed, 195 insertions, 0 deletions
diff --git a/net-proxy/ufdbguard/files/ufdb.confd b/net-proxy/ufdbguard/files/ufdb.confd new file mode 100644 index 000000000000..08c7e5f1a8fa --- /dev/null +++ b/net-proxy/ufdbguard/files/ufdb.confd @@ -0,0 +1,20 @@ +# -*- sh -*- + +# 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="" diff --git a/net-proxy/ufdbguard/files/ufdb.initd b/net-proxy/ufdbguard/files/ufdb.initd new file mode 100644 index 000000000000..e55c0e7d1a1e --- /dev/null +++ b/net-proxy/ufdbguard/files/ufdb.initd @@ -0,0 +1,82 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# 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 +} diff --git a/net-proxy/ufdbguard/files/ufdb.initd.2 b/net-proxy/ufdbguard/files/ufdb.initd.2 new file mode 100644 index 000000000000..44a7f59026e0 --- /dev/null +++ b/net-proxy/ufdbguard/files/ufdb.initd.2 @@ -0,0 +1,67 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# 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 +} diff --git a/net-proxy/ufdbguard/files/ufdbUpdate.cron b/net-proxy/ufdbguard/files/ufdbUpdate.cron new file mode 100644 index 000000000000..f9147648c8b7 --- /dev/null +++ b/net-proxy/ufdbguard/files/ufdbUpdate.cron @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# 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 diff --git a/net-proxy/ufdbguard/files/ufdbguard-1.24-gentoo.patch b/net-proxy/ufdbguard/files/ufdbguard-1.24-gentoo.patch new file mode 100644 index 000000000000..63da98175a0e --- /dev/null +++ b/net-proxy/ufdbguard/files/ufdbguard-1.24-gentoo.patch @@ -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. ######################################## + |