summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Hajdan <phajdan.jr@gentoo.org>2011-11-11 17:24:02 +0000
committerPaweł Hajdan <phajdan.jr@gentoo.org>2011-11-11 17:24:02 +0000
commitadb928214b945ba5db89651ef6c8d0256b065e6b (patch)
tree0034a18864aa7b42e71a981792ca8e54af097574 /net-proxy/dansguardian
parentFix bug #389801, allowing a clean build with [gtk,-sqlite]. (diff)
downloadgentoo-2-adb928214b945ba5db89651ef6c8d0256b065e6b.tar.gz
gentoo-2-adb928214b945ba5db89651ef6c8d0256b065e6b.tar.bz2
gentoo-2-adb928214b945ba5db89651ef6c8d0256b065e6b.zip
Run as a dedicated user instead of nobody.
(Portage version: 2.1.10.11/cvs/Linux i686)
Diffstat (limited to 'net-proxy/dansguardian')
-rw-r--r--net-proxy/dansguardian/ChangeLog10
-rw-r--r--net-proxy/dansguardian/dansguardian-2.10.1.1-r1.ebuild129
2 files changed, 137 insertions, 2 deletions
diff --git a/net-proxy/dansguardian/ChangeLog b/net-proxy/dansguardian/ChangeLog
index 23e98b5355f1..52bfe4455613 100644
--- a/net-proxy/dansguardian/ChangeLog
+++ b/net-proxy/dansguardian/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-proxy/dansguardian
-# Copyright 2000-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-proxy/dansguardian/ChangeLog,v 1.48 2009/07/05 00:04:17 mrness Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/dansguardian/ChangeLog,v 1.49 2011/11/11 17:24:02 phajdan.jr Exp $
+
+*dansguardian-2.10.1.1-r1 (11 Nov 2011)
+
+ 11 Nov 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+ +dansguardian-2.10.1.1-r1.ebuild:
+ Run as a dedicated user instead of nobody.
*dansguardian-2.10.1.1 (05 Jul 2009)
diff --git a/net-proxy/dansguardian/dansguardian-2.10.1.1-r1.ebuild b/net-proxy/dansguardian/dansguardian-2.10.1.1-r1.ebuild
new file mode 100644
index 000000000000..cf6bfc00a267
--- /dev/null
+++ b/net-proxy/dansguardian/dansguardian-2.10.1.1-r1.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/dansguardian/dansguardian-2.10.1.1-r1.ebuild,v 1.1 2011/11/11 17:24:02 phajdan.jr Exp $
+
+EAPI="2"
+
+inherit eutils
+
+DESCRIPTION="Web content filtering via proxy"
+HOMEPAGE="http://dansguardian.org"
+SRC_URI="http://dansguardian.org/downloads/2/Stable/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="clamav kaspersky debug ntlm pcre"
+
+RDEPEND="sys-libs/zlib
+ pcre? ( dev-libs/libpcre )
+ clamav? ( >=app-antivirus/clamav-0.93 )"
+DEPEND="${RDEPEND}
+ dev-util/pkgconfig"
+
+pkg_setup() {
+ if has_version "<${CATEGORY}/${PN}-2.9" ; then
+ ewarn "This version introduces brand new USE flags:"
+ ewarn " clamav kaspersky ntlm pcre"
+ echo
+
+ local f="${ROOT}/etc/dansguardian"
+ f=${f//\/\///}
+ if [ -d "${f}" ] ; then
+ eerror "The structure of ${f} has changed in this version!"
+ eerror "For avoiding confusion, you must either move or delete the old ${f},"
+ eerror "then continue with the upgrade:"
+ eerror " mv '${f}' '${f}.old'"
+ eerror " emerge --resume"
+ die "Obsolete config files detected"
+ fi
+ fi
+
+ if ! use clamav; then
+ enewgroup dansguardian
+ enewuser dansguardian -1 -1 /dev/null dansguardian
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gcc44.patch
+}
+
+src_configure() {
+ local myconf="--with-logdir=/var/log/dansguardian
+ --with-piddir=/var/run
+ --docdir=/usr/share/doc/${PF}
+ --htmldir=/usr/share/doc/${PF}/html
+ $(use_enable pcre)
+ $(use_enable ntlm)
+ --enable-orig-ip
+ --enable-fancydm
+ --enable-email"
+ if use clamav; then
+ # readd --enable-clamav in the next version if it works with >=clamav-0.95 (#264820)
+ myconf="${myconf} --enable-clamd
+ --with-proxyuser=clamav
+ --with-proxygroup=clamav"
+ else
+ myconf="${myconf}
+ --with-proxyuser=dansguardian
+ --with-proxygroup=dansguardian"
+ fi
+ if use kaspersky; then
+ myconf="${myconf} --enable-kavd"
+ fi
+ if use debug; then
+ myconf="${myconf} --with-dgdebug=on"
+ fi
+
+ econf ${myconf} || die "configure failed"
+}
+
+src_compile() {
+ emake OPTIMISE="${CFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ emake "DESTDIR=${D}" install || die "emake install failed"
+
+ # Move html documents to html dir
+ mkdir "${D}"/usr/share/doc/${PF}/html \
+ && mv "${D}"/usr/share/doc/${PF}/*.html "${D}"/usr/share/doc/${PF}/html \
+ || die "no html docs found in docdir"
+
+ # Copying init script
+ newinitd "${FILESDIR}/dansguardian.init" dansguardian
+
+ if use clamav; then
+ sed -r -i -e 's/[ \t]+use dns/& clamd/' "${D}/etc/init.d/dansguardian"
+ sed -r -i -e 's/^#( *contentscanner *=.*clamdscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf"
+ sed -r -i -e 's/^#( *clamdudsfile *=.*)/\1/' "${D}/etc/dansguardian/contentscanners/clamdscan.conf"
+ elif use kaspersky; then
+ sed -r -i -e 's/^#( *contentscanner *=.*kavdscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf"
+ fi
+
+ # Copying logrotation file
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/dansguardian.logrotate" dansguardian
+
+ keepdir /var/log/dansguardian
+ fperms o-rwx /var/log/dansguardian
+}
+
+pkg_postinst() {
+ local runas="dansguardian:dansguardian"
+ if use clamav ; then
+ runas="clamav:clamav"
+ else
+ elog "dansguardian runs as a dedicated user now"
+ elog "You may need to remove old ipc files or adjust their ownership."
+ elog "By default, those files are /tmp/.dguardianipc"
+ elog "and /tmp/.dguardianurlipc"
+ fi
+ einfo "The dansguardian daemon will run by default as ${runas}"
+
+ if [ -d "${ROOT}/var/log/dansguardian" ] ; then
+ chown -R ${runas} "${ROOT}/var/log/dansguardian"
+ chmod o-rwx "${ROOT}/var/log/dansguardian"
+ fi
+}