From 9aa80713372911cec499b3adb2cd746790920916 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 29 Jun 2021 10:15:54 +0100 Subject: gentoo resync : 29.06.2021 --- app-antivirus/clamav/Manifest | 2 + app-antivirus/clamav/clamav-0.103.3-r1.ebuild | 234 +++++++++++++++++++++ .../clamav/files/clamav-milter.logrotate-r1 | 25 +++ 3 files changed, 261 insertions(+) create mode 100644 app-antivirus/clamav/clamav-0.103.3-r1.ebuild create mode 100644 app-antivirus/clamav/files/clamav-milter.logrotate-r1 (limited to 'app-antivirus/clamav') diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest index 1d7c8f908395..d7e34d2a85b2 100644 --- a/app-antivirus/clamav/Manifest +++ b/app-antivirus/clamav/Manifest @@ -4,6 +4,7 @@ AUX clamav-0.103.0-system-tomsfastmath.patch 3725 BLAKE2B 85640ded83600adfdcc03e AUX clamav-0.103.1-upstream-openrc.patch 18249 BLAKE2B 305db3181a4a22acde5b28cef6c2d01b639be8c5b9e9c77737be1ebcb0553040b6eda117285e3e8b4bf06d2565a5d73225d7ce20ba1f115fd08bc822d779b370 SHA512 89e95057ee2f29bcdf5787f659ffe43b055b599d9bb80bf54794859113d760dad135b5b8d80c23e98f8c6b699dc839d4922c4c3b45edf97296f4eea668e62672 AUX clamav-milter.README.gentoo 2284 BLAKE2B 7afc18f3dad57c2d7595257b356943efb3d1af28d55ac8f09f0506430fd0dedf0820906ced666a7237e3af44a9bc1b43fff017c03faad844f96b132ca4c5dde6 SHA512 38eadf2d919a0c48345600ea5a39c90e766b62e8b1ffc7bb01969a8fd93c4545f2030058a470ac7efb75a1d6c74f9930438f58aeff5035e19e38241ed381f7b3 AUX clamav-milter.logrotate 1105 BLAKE2B 5bb2b00dbe6e74c51d4ed7233964cfddf0ef7fd8c913caad42a421fc152baa3ffc3e910f38f46ebb72a08a8b53eba880647a6988d38558ec52129afca8dddfad SHA512 cb6cbefc4a093fda5a3cdb52911ff13b04d641896271b844db9ca30a051cb4beb911ee973a5958df8bba59b7b922cfb23bfa69cdd4fe3c0c2b8abe76bf834c2f +AUX clamav-milter.logrotate-r1 1103 BLAKE2B b506a07f6ebdf697f87060424368ce4e4085564c3fa8e8cc4780ba786f2f543ae51a6e0f9d04db9ea9eb5554c1e395592453235db5abcc243fd2523cb44adec2 SHA512 890744086dcd8d6f7eba0f49df0941c643c6d730ea27a660ecaaab50c51c931489fa25079ad1aa9e307f919ac98a4e5d6b2e952cc46dcea8322b3253c6ba07b1 AUX clamav-milter.service 284 BLAKE2B 7fbdce10ffa1d85aa671616f17ad45683177916269b434283582ecb53000f7a9a8978119e6a8170ddad8f7c0f14f09398fd7b893aad5d718083b002f6371ff21 SHA512 442148ac3c42ecbb893de5c6edde337b72a745d20f6c5ffa33131f9a0b2daadcffac39b686ada986a5ab500ea7b9153c448abc1b819e15fef488da1812bb0cee AUX clamav-milter.service-r1 303 BLAKE2B 55253d9a660699411e352bc80837add840dc6740afed4fe64a86def84610cad836ea3ea620664f540f242b917aab560201cca9c33b9fbc9b1cef2c8b29bfce36 SHA512 5dc30e3c57d9bff6595155e8299336c579c713aed429ab770f10d7678dd74691a135aa2070a825ddb726fdabcb001c19caeb993c1cd9a6fcf95d1d47f7160540 AUX clamd.logrotate 603 BLAKE2B f39f5938f8fca2d2820d86c8dc144dca0216468a3cfd7dcd84c794d9402e3978da254684053eab108d71263a75266a96f2b6f5e0c635a2b5b0a1a50068920bde SHA512 e9689c99e37a1f2814497e4df19bd760dd94b6134be72341dd3b7f6e5f67505cda913367a5e80873ae601c88a9d7aa994733b8ac7017a6d0aa62d2170845df37 @@ -16,5 +17,6 @@ AUX tmpfiles.d/clamav.conf 33 BLAKE2B 447c5ad4ad79bc70fc386833fa763451d30bf30f1a DIST clamav-0.103.2.tar.gz 13387954 BLAKE2B de0ececd2fe4486d2e8194dbeb45bfb74086ab3eb45fcab7590e75aa5a2242981066a4e8fa99b571cf7278f4516d986ad1a24254a8fe2c5caf4c870b3179c4b6 SHA512 87d47c4529a57da0b47b3744a279996ca24fa74ce10d7e27a53c19c1e13098af680e0e48ed767122bb2bbd3f927302451da84ccf51a933e7e3556ef43cbe9f45 DIST clamav-0.103.3.tar.gz 13389239 BLAKE2B 1846cceed39fbd48fcf973d05a57901cf6f9ccdbb4d7eae501e712d84ab4d0a662e4477696aa6a1446116db85a89603428d7092a55e18f7acb805016d3cd5431 SHA512 c2ee24a6f63735c064140aa5baa347d51e8240b2f7eced3480d05435202aedd481fa7057fd40ecbc2e93a62fe8b0cefb574d8accdf9acede643ffbe0d396686f EBUILD clamav-0.103.2.ebuild 7297 BLAKE2B 40c860b711dab3cceca4f854e660a1303166deefe0da4a0eb7e6461ad040ec4196484376c2f5d86808ed64c96cf33d1ace904611f99764b6d839e988b6c7a9a9 SHA512 0c638901b57bc9bf7afd3eac018f3a9dc0cb0a93829f8ebdc29f172bd67507073e7fe61240fecc30b0eeab4b36da98f93f8f79c7a7d4da4913c208c48a9ba3eb +EBUILD clamav-0.103.3-r1.ebuild 7306 BLAKE2B 07bee5cf33a8ba38754095ec9e11d0ebf050dc10e7cd162ecd22c2f153691b5b1898cdc3847997e811f5e4c0e0776f2efe2aa5f08a75152a7e3662b92d23a605 SHA512 7c14bd2f5daefe7180110ddf88e0dd8c8da6440f747b61d35df23e5685a5332bbebc09cebea8dd93710ffa3eab62195f4f09f0b55365c3e6056011eca2493a67 EBUILD clamav-0.103.3.ebuild 7303 BLAKE2B 2e3e460a6c20e7ce2d09ca65b0555cedf4afadc3e4f902ae807fe532bc6f61e07d0bb8e26203fbaef13fd865660d30ef83cd9f1c875609d1ddfbf52c1c9b11a1 SHA512 0f11faddec0d91f6511bc82dbd5ad3c0fd4c1b5c86530cbf9a1774389334fee95c31c874b90cac555322bd062b16e045ae64cb481fb6de5d3b9b2684a392f484 MISC metadata.xml 933 BLAKE2B 867499e23131bf714cdddd911ef727dc6e487be8c6f0be1985611bc2ce8bfbee639e114f8ade6a6b9418095d03a45095030168912ab21484da81385c53255b05 SHA512 c0a3132dbfafbdb8852d621de187cfbd5daa30ab682593b88c77278e0c8a58fb57ed1427b9f8aa798926ccc94db4a19eeec77915f06de9b0cd182237aa77a892 diff --git a/app-antivirus/clamav/clamav-0.103.3-r1.ebuild b/app-antivirus/clamav/clamav-0.103.3-r1.ebuild new file mode 100644 index 000000000000..5fcae6ee66c1 --- /dev/null +++ b/app-antivirus/clamav/clamav-0.103.3-r1.ebuild @@ -0,0 +1,234 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools flag-o-matic systemd tmpfiles + +DESCRIPTION="Clam Anti-Virus Scanner" +HOMEPAGE="https://www.clamav.net/" +SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris" +IUSE="bzip2 doc clamonacc clamdtop clamsubmit iconv ipv6 libclamav-only milter metadata-analysis-api selinux systemd test uclibc xml" + +REQUIRED_USE="libclamav-only? ( !clamonacc !clamdtop !clamsubmit !milter !metadata-analysis-api )" + +RESTRICT="!test? ( test )" + +# Require acct-{user,group}/clamav at build time so that we can set +# the permissions on /var/lib/clamav in src_install rather than in +# pkg_postinst; calling "chown" on the live filesystem scares me. +CDEPEND="acct-group/clamav + acct-user/clamav + dev-libs/libltdl + dev-libs/libmspack + || ( dev-libs/libpcre2 >dev-libs/libpcre-6 ) + dev-libs/tomsfastmath + >=sys-libs/zlib-1.2.2:= + bzip2? ( app-arch/bzip2 ) + clamdtop? ( sys-libs/ncurses:0 ) + clamsubmit? ( net-misc/curl dev-libs/json-c:= ) + elibc_musl? ( sys-libs/fts-standalone ) + iconv? ( virtual/libiconv ) + !libclamav-only? ( net-misc/curl ) + dev-libs/openssl:0= + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) ) + xml? ( dev-libs/libxml2 )" + +# We need at least autoconf-2.69-r5 because that's the first (patched) +# version of it in Gentoo that supports ./configure --runstatedir. +BDEPEND=">=sys-devel/autoconf-2.69-r5 + virtual/pkgconfig" + +DEPEND="${CDEPEND} + metadata-analysis-api? ( dev-libs/json-c:* ) + test? ( dev-libs/check )" +RDEPEND="${CDEPEND} + selinux? ( sec-policy/selinux-clamav )" + +PATCHES=( + "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328 + "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616 + "${FILESDIR}/${PN}-0.103.0-system-tomsfastmath.patch" # 649394 + "${FILESDIR}/${PN}-0.103.1-upstream-openrc.patch" +) + +src_prepare() { + default + + # Be extra sure that we're using the system copy of tomsfastmath + einfo "removing bundled copy of dev-libs/tomsfastmath" + rm -r libclamav/tomsfastmath || \ + die "failed to remove bundled tomsfastmath" + + AT_NO_RECURSIVE="yes" eautoreconf +} + +src_configure() { + use elibc_musl && append-ldflags -lfts + use ppc64 && append-flags -mminimal-toc + use uclibc && export ac_cv_type_error_t=yes + + # according to configure help it should be + # $(use_enable xml) + # but that does not work + # do not add this, since --disable-xml seems to override + # --without-xml + JSONUSE="--without-libjson" + + if use clamsubmit || use metadata-analysis-api; then + # either of those 2 requires libjson. + # clamsubmit will be built as soon as libjson and curl are found + # but we only install the binary if requested + JSONUSE="--with-libjson=${EPREFIX}/usr" + fi + + local myeconfargs=( + $(use_enable bzip2) + $(use_enable clamonacc) + $(use_enable clamdtop) + $(use_enable ipv6) + $(use_enable milter) + $(use_enable test check) + $(use_with xml) + $(use_with iconv) + ${JSONUSE} + $(use_enable libclamav-only) + $(use_with !libclamav-only libcurl) + --with-system-libmspack + --cache-file="${S}"/config.cache + --disable-experimental + --disable-static + --disable-zlib-vcheck + --enable-id-check + --with-dbdir="${EPREFIX}"/var/lib/clamav + # Don't call --with-zlib=/usr (see bug #699296) + --with-zlib + --disable-llvm + --enable-openrc + --runstatedir=/run + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + + rm -rf "${ED}"/var/lib/clamav || die + + if ! use libclamav-only ; then + if use systemd; then + # The tmpfiles entry is behind USE=systemd because the + # upstream OpenRC service files should (and do) ensure that + # the directories they need exist and have the correct + # permissions without the help of opentmpfiles. There are + # years-old root exploits in opentmpfiles, the design is + # fundamentally flawed, and the maintainer is not up to + # the task of fixing it. + dotmpfiles "${FILESDIR}/tmpfiles.d/clamav.conf" + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service" + systemd_dounit "${FILESDIR}/clamd.service" + systemd_newunit "${FILESDIR}/freshclamd.service-r1" \ + "freshclamd.service" + fi + + insinto /etc/logrotate.d + newins "${FILESDIR}/clamd.logrotate" clamd + newins "${FILESDIR}/freshclam.logrotate" freshclam + use milter && \ + newins "${FILESDIR}/clamav-milter.logrotate-r1" clamav-milter + + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box + sed -i -e "s:^\(Example\):\# \1:" \ + -e "s/^#\(PidFile .*\)/\1/" \ + -e "s/^#\(LocalSocket .*\)/\1/" \ + -e "s/^#\(User .*\)/\1/" \ + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \ + -e "s:^\#\(LogTime\).*:\1 yes:" \ + -e "s/^#\(DatabaseDirectory .*\)/\1/" \ + "${ED}"/etc/clamd.conf.sample || die + + sed -i -e "s:^\(Example\):\# \1:" \ + -e "s/^#\(PidFile .*\)/\1/" \ + -e "s/^#\(DatabaseOwner .*\)/\1/" \ + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \ + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \ + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \ + -e "s/^#\(DatabaseDirectory .*\)/\1/" \ + "${ED}"/etc/freshclam.conf.sample || die + + if use milter ; then + # Note: only keep the "unix" ClamdSocket and MilterSocket! + sed -i -e "s:^\(Example\):\# \1:" \ + -e "s/^#\(PidFile .*\)/\1/" \ + -e "s/^#\(ClamdSocket unix:.*\)/\1/" \ + -e "s/^#\(User .*\)/\1/" \ + -e "s/^#\(MilterSocket unix:.*\)/\1/" \ + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \ + "${ED}"/etc/clamav-milter.conf.sample || die + + cat >> "${ED}"/etc/conf.d/clamd <<-EOF + MILTER_NICELEVEL=19 + START_MILTER=no + EOF + + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service + fi + + local i + for i in clamd freshclam clamav-milter + do + if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then + mv "${ED}"/etc/"${i}".conf{.sample,} || die + fi + done + + # These both need to be writable by the clamav user. + # TODO: use syslog by default; that's what it's for. + diropts -o clamav -g clamav + keepdir /var/lib/clamav + keepdir /var/log/clamav + fi + + if use doc ; then + local HTML_DOCS=( docs/html/. ) + einstalldocs + + if ! use libclamav-only ; then + doman docs/man/*.[1-8] + fi + fi + + find "${ED}" -name '*.la' -delete || die +} + +src_test() { + if use libclamav-only ; then + ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..." + return 0 + fi + + emake quick-check +} + +pkg_postinst() { + if use milter ; then + elog "For simple instructions how to setup the clamav-milter read the" + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}" + fi + + local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d ) + if [[ ! -f "${databases}" ]] ; then + ewarn "You must run freshclam manually to populate the virus database" + ewarn "before starting clamav for the first time." + fi + + ewarn "This version of ClamAV provides separate OpenRC services" + ewarn "for clamd, freshclam, clamav-milter, and clamonacc. The" + ewarn "clamd service now starts only the clamd daemon itself. You" + ewarn "should add freshclam (and perhaps clamav-milter) to any" + ewarn "runlevels that previously contained clamd." +} diff --git a/app-antivirus/clamav/files/clamav-milter.logrotate-r1 b/app-antivirus/clamav/files/clamav-milter.logrotate-r1 new file mode 100644 index 000000000000..8d2f31a852a2 --- /dev/null +++ b/app-antivirus/clamav/files/clamav-milter.logrotate-r1 @@ -0,0 +1,25 @@ +# This script is intended to rotate the logs for clamav-milter in its +# default configuration on Gentoo, where clamav-milter writes to its +# own log file but does not rotate that file itself. The clamav-milter +# daemon is capable of rotating its own logs; if you have "LogRotate +# yes" in clamav-milter.conf then you do not need this script (and +# should disable it). Likewise, if you are logging to syslog +# (LogSyslog yes), this is redundant. +# +# This is more complicated than the clamd/freshclam scripts because +# the milter doesn't yet reopen its log files when it receives a +# SIGHUP. See https://bugzilla.clamav.net/show_bug.cgi?id=12615 +# for that. Instead we have to attempt OpenRC/systemd service +# restarts on (only) the machines that support them. +/var/log/clamav/clamav-milter.log { + su clamav clamav + missingok + postrotate + if command -v rc-service >/dev/null; then + rc-service clamav-milter status 2>/dev/null 1>&2 && rc-service clamav-milter restart 1>/dev/null + fi + if command -v systemctl >/dev/null; then + systemctl try-restart clamav-milter + fi + endscript +} -- cgit v1.2.3