Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/audit/
Date: Fri, 02 Mar 2018 10:37:53
Message-Id: 1519986994.03b2e0109fa387b910bb56b326c93c280359d147.perfinion@gentoo
1 commit: 03b2e0109fa387b910bb56b326c93c280359d147
2 Author: Jason Zaman <perfinion <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 2 10:35:54 2018 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 2 10:36:34 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03b2e010
7
8 sys-process/audit: bump to 2.8.2
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 sys-process/audit/Manifest | 1 +
13 sys-process/audit/audit-2.8.2.ebuild | 230 +++++++++++++++++++++++++++++++++++
14 2 files changed, 231 insertions(+)
15
16 diff --git a/sys-process/audit/Manifest b/sys-process/audit/Manifest
17 index 4124620727f..7303bc7843e 100644
18 --- a/sys-process/audit/Manifest
19 +++ b/sys-process/audit/Manifest
20 @@ -1,2 +1,3 @@
21 DIST audit-2.6.4.tar.gz 1078677 BLAKE2B 056d9f269926d9b0d74f7187f833f1e94d4e03a5137750fe4ff87b71fa0ce0e0a8569b97ecbd671f951061cfb088dff17b46e37cc14122864c37615356646fc5 SHA512 69b5d3987d2b8b189d1242fde639af3d7d366e901733133e47ee71223caf73aa7da40b7811298f0af861969b0ab482c5ef9830b711bdd15bd5f4d0ebc88a1224
22 DIST audit-2.7.1.tar.gz 1099083 BLAKE2B 10f72ac3273ce9e23e1fb8ad8d57dcae772ba1f861f519867399d95e14f4809897637969de45566d62a73a35e5674260155773daf8de00481fcbd1b9c3138f96 SHA512 37964d81deee8608fde5f90d5d096727d3eb009e084be34749adcb0662e607e35c49c80bd83ce38b17161f11363b691721c8a8aa5dea832d320c53ab0ebb7483
23 +DIST audit-2.8.2.tar.gz 1121970 BLAKE2B bbec694ed1177a8590d035c2d6d197e49343fc370b101589e58736042c3b12cabb68fe796422f3133feb79068ab7d5931efa5414d22edead10c8871fefcd2549 SHA512 888ebf5e8e9d285b82d87377fc8836886d7a8b089c1be4091420a77a0250c9baf09aebb7a6330ff5043fb35f51eb6baf8d4491e26da7ad0811f0087e395b5012
24
25 diff --git a/sys-process/audit/audit-2.8.2.ebuild b/sys-process/audit/audit-2.8.2.ebuild
26 new file mode 100644
27 index 00000000000..c03f103ef2f
28 --- /dev/null
29 +++ b/sys-process/audit/audit-2.8.2.ebuild
30 @@ -0,0 +1,230 @@
31 +# Copyright 1999-2018 Gentoo Foundation
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI="6"
35 +
36 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
37 +
38 +inherit autotools multilib multilib-minimal toolchain-funcs preserve-libs python-r1 linux-info systemd
39 +
40 +DESCRIPTION="Userspace utilities for storing and processing auditing records"
41 +HOMEPAGE="https://people.redhat.com/sgrubb/audit/"
42 +SRC_URI="https://people.redhat.com/sgrubb/audit/${P}.tar.gz"
43 +
44 +LICENSE="GPL-2"
45 +SLOT="0"
46 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
47 +IUSE="gssapi ldap python static-libs"
48 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
49 +# Testcases are pretty useless as they are built for RedHat users/groups and kernels.
50 +RESTRICT="test"
51 +
52 +RDEPEND="gssapi? ( virtual/krb5 )
53 + ldap? ( net-nds/openldap )
54 + sys-libs/libcap-ng
55 + python? ( ${PYTHON_DEPS} )"
56 +DEPEND="${RDEPEND}
57 + >=sys-kernel/linux-headers-2.6.34
58 + python? ( dev-lang/swig:0 )"
59 +# Do not use os-headers as this is linux specific
60 +
61 +CONFIG_CHECK="~AUDIT"
62 +
63 +pkg_setup() {
64 + linux-info_pkg_setup
65 +}
66 +
67 +src_prepare() {
68 + eapply_user
69 +
70 + # Do not build GUI tools
71 + sed -i \
72 + -e '/AC_CONFIG_SUBDIRS.*system-config-audit/d' \
73 + "${S}"/configure.ac || die
74 + sed -i \
75 + -e 's,system-config-audit,,g' \
76 + "${S}"/Makefile.am || die
77 + rm -rf "${S}"/system-config-audit
78 +
79 + if ! use ldap; then
80 + sed -i \
81 + -e '/^AC_OUTPUT/s,audisp/plugins/zos-remote/Makefile,,g' \
82 + "${S}"/configure.ac || die
83 + sed -i \
84 + -e '/^SUBDIRS/s,zos-remote,,g' \
85 + "${S}"/audisp/plugins/Makefile.am || die
86 + fi
87 +
88 + # Don't build static version of Python module.
89 + eapply "${FILESDIR}"/${PN}-2.4.3-python.patch
90 +
91 + # glibc/kernel upstreams suck with both defining ia64_fpreg
92 + # This patch is a horribly workaround that is only valid as long as you
93 + # don't need the OTHER definitions in fpu.h.
94 + eapply "${FILESDIR}"/${PN}-2.1.3-ia64-compile-fix.patch
95 +
96 + # there is no --without-golang conf option
97 + sed -e "/^SUBDIRS =/s/ @gobind_dir@//" -i bindings/Makefile.am || die
98 +
99 + # Regenerate autotooling
100 + eautoreconf
101 +}
102 +
103 +multilib_src_configure() {
104 + local ECONF_SOURCE=${S}
105 + econf \
106 + --sbindir="${EPREFIX}/sbin" \
107 + $(use_enable gssapi gssapi-krb5) \
108 + $(use_enable static-libs static) \
109 + --enable-systemd \
110 + --without-python \
111 + --without-python3
112 +
113 + if multilib_is_native_abi; then
114 + python_configure() {
115 + mkdir -p "${BUILD_DIR}" || die
116 + cd "${BUILD_DIR}" || die
117 +
118 + if python_is_python3; then
119 + econf --without-python --with-python3
120 + else
121 + econf --with-python --without-python3
122 + fi
123 + }
124 +
125 + use python && python_foreach_impl python_configure
126 + fi
127 +}
128 +
129 +src_configure() {
130 + tc-export_build_env BUILD_{CC,CPP}
131 + export CC_FOR_BUILD="${BUILD_CC}"
132 + export CPP_FOR_BUILD="${BUILD_CPP}"
133 +
134 + multilib-minimal_src_configure
135 +}
136 +
137 +multilib_src_compile() {
138 + if multilib_is_native_abi; then
139 + default
140 +
141 + python_compile() {
142 + local pysuffix pydef
143 + if python_is_python3; then
144 + pysuffix=3
145 + pydef='USE_PYTHON3=true'
146 + else
147 + pysuffix=2
148 + pydef='HAVE_PYTHON=true'
149 + fi
150 +
151 + emake -C "${BUILD_DIR}"/bindings/swig \
152 + VPATH="${native_build}/lib" \
153 + LIBS="${native_build}/lib/libaudit.la" \
154 + _audit_la_LIBADD="${native_build}/lib/libaudit.la" \
155 + _audit_la_DEPENDENCIES="${S}/lib/libaudit.h ${native_build}/lib/libaudit.la" \
156 + ${pydef}
157 + emake -C "${BUILD_DIR}"/bindings/python/python${pysuffix} \
158 + VPATH="${S}/bindings/python/python${pysuffix}:${native_build}/bindings/python/python${pysuffix}" \
159 + auparse_la_LIBADD="${native_build}/auparse/libauparse.la ${native_build}/lib/libaudit.la" \
160 + ${pydef}
161 + }
162 +
163 + local native_build="${BUILD_DIR}"
164 + use python && python_foreach_impl python_compile
165 + else
166 + emake -C lib
167 + emake -C auparse
168 + fi
169 +}
170 +
171 +multilib_src_install() {
172 + if multilib_is_native_abi; then
173 + emake DESTDIR="${D}" initdir="$(systemd_get_systemunitdir)" install
174 +
175 + python_install() {
176 + local pysuffix pydef
177 + if python_is_python3; then
178 + pysuffix=3
179 + pydef='USE_PYTHON3=true'
180 + else
181 + pysuffix=2
182 + pydef='HAVE_PYTHON=true'
183 + fi
184 +
185 + emake -C "${BUILD_DIR}"/bindings/swig \
186 + VPATH="${native_build}/lib" \
187 + LIBS="${native_build}/lib/libaudit.la" \
188 + _audit_la_LIBADD="${native_build}/lib/libaudit.la" \
189 + _audit_la_DEPENDENCIES="${S}/lib/libaudit.h ${native_build}/lib/libaudit.la" \
190 + ${pydef} \
191 + DESTDIR="${D}" install
192 + emake -C "${BUILD_DIR}"/bindings/python/python${pysuffix} \
193 + VPATH="${S}/bindings/python/python${pysuffix}:${native_build}/bindings/python/python${pysuffix}" \
194 + auparse_la_LIBADD="${native_build}/auparse/libauparse.la ${native_build}/lib/libaudit.la" \
195 + ${pydef} \
196 + DESTDIR="${D}" install
197 + }
198 +
199 + local native_build=${BUILD_DIR}
200 + use python && python_foreach_impl python_install
201 +
202 + # things like shadow use this so we need to be in /
203 + gen_usr_ldscript -a audit auparse
204 + else
205 + emake -C lib DESTDIR="${D}" install
206 + emake -C auparse DESTDIR="${D}" install
207 + fi
208 +}
209 +
210 +multilib_src_install_all() {
211 + dodoc AUTHORS ChangeLog README* THANKS TODO
212 + docinto contrib
213 + dodoc contrib/{avc_snap,skeleton.c}
214 + docinto contrib/plugin
215 + dodoc contrib/plugin/*
216 + docinto rules
217 + dodoc rules/*
218 +
219 + newinitd "${FILESDIR}"/auditd-init.d-2.4.3 auditd
220 + newconfd "${FILESDIR}"/auditd-conf.d-2.1.3 auditd
221 +
222 + fperms 644 "$(systemd_get_systemunitdir)"/auditd.service # 556436
223 +
224 + [ -f "${ED}"/sbin/audisp-remote ] && \
225 + dodir /usr/sbin && \
226 + mv "${ED}"/{sbin,usr/sbin}/audisp-remote || die
227 +
228 + # Gentoo rules
229 + insinto /etc/audit/
230 + newins "${FILESDIR}"/audit.rules-2.1.3 audit.rules
231 + doins "${FILESDIR}"/audit.rules.stop*
232 +
233 + # audit logs go here
234 + keepdir /var/log/audit/
235 +
236 + find "${D}" -name '*.la' -delete || die
237 +
238 + # Security
239 + lockdown_perms "${ED}"
240 +}
241 +
242 +pkg_preinst() {
243 + # Preserve from the audit-1 series
244 + preserve_old_lib /$(get_libdir)/libaudit.so.0
245 +}
246 +
247 +pkg_postinst() {
248 + lockdown_perms "${EROOT}"
249 + # Preserve from the audit-1 series
250 + preserve_old_lib_notify /$(get_libdir)/libaudit.so.0
251 +}
252 +
253 +lockdown_perms() {
254 + # Upstream wants these to have restrictive perms.
255 + # Should not || die as not all paths may exist.
256 + local basedir="$1"
257 + chmod 0750 "${basedir}"/sbin/au{ditctl,report,dispd,ditd,search,trace} 2>/dev/null
258 + chmod 0750 "${basedir}"/var/log/audit/ 2>/dev/null
259 + chmod 0640 "${basedir}"/etc/{audit/,}{auditd.conf,audit.rules*} 2>/dev/null
260 +}