From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v7 04/22] audit: new package
Date: Wed, 17 Jun 2015 23:45:13 +0200 [thread overview]
Message-ID: <20150617234513.6e589827@free-electrons.com> (raw)
In-Reply-To: <1433251718-3167-5-git-send-email-clayton.shotwell@rockwellcollins.com>
Dear Clayton Shotwell,
On Tue, 2 Jun 2015 08:28:20 -0500, Clayton Shotwell wrote:
> package/audit/0001-Enable-cross-compiling.patch | 773 +++++++++++++++++++++
> .../0002-Make-zos-remote-plugin-optional.patch | 56 ++
> ...03-Default-ADDR_NO_RANDOMIZE-if-not-found.patch | 44 ++
> ...o-not-call-posix_fallocate-if-unavailable.patch | 47 ++
> ...Fix-header-detection-when-cross-compiling.patch | 46 ++
I know we've already discussed this, but again, please make sure to
submit all these patches upstream.
> diff --git a/package/audit/Config.in b/package/audit/Config.in
> new file mode 100644
> index 0000000..66fceec
> --- /dev/null
> +++ b/package/audit/Config.in
> @@ -0,0 +1,18 @@
> +config BR2_PACKAGE_AUDIT
> + bool "audit"
> + # needs memory fences for internal libev
> + depends on !BR2_bfin
Actually, I believe this package is only available on a much smaller
selection of architectures: x86, x86-64, PowerPC, ARM and AArch64. It
does not have the system call tables for other architectures (or
architectures not supported in Buildroot, such as Alpha or S390).
So, I've added a BR2_PACKAGE_AUDIT_ARCH_SUPPORTS instead to express
this architecture dependency.
> + depends on BR2_TOOLCHAIN_HAS_THREADS
> + help
> + The audit package contains the user space utilities for
> + storing and searching the audit records generated by
> + the audit subsystem in the Linux 2.6 kernel
> +
> + Note: The z/OS remote plugin is disabled in this package
> +
> + http://people.redhat.com/sgrubb/audit/
> +
> +comment "audit needs a toolchain w/ threads"
> + depends on !BR2_TOOLCHAIN_HAS_THREADS
> + depends on !BR2_bfin
> +
> diff --git a/package/audit/S01auditd b/package/audit/S01auditd
> new file mode 100644
> index 0000000..27de572
> --- /dev/null
> +++ b/package/audit/S01auditd
I am still not entirely happy with this init script. However, since I
wanted the topic to make progress, I've applied the package, just after
removing the init script for now (and with some other changes I'll
detail below). Please resubmit a patch re-adding the init script with a
few fixes.
> @@ -0,0 +1,99 @@
> +#!/bin/sh
> +#
> +# auditd This starts and stops auditd
> +#
> +# description: This starts the Linux Auditing System Daemon,
> +# which collects security related events in a dedicated
> +# audit log. If this daemon is turned off, audit events
> +# will be sent to syslog.
> +#
> +
> +NAME=auditd
> +DAEMON=/usr/sbin/${NAME}
> +CONFIG=/etc/audit/auditd.conf
> +LOCK=/var/run/${NAME}.pid
Please name this variable PIDFILE. It's not really a lock, and we call
it PIDFILE in most other Buildroot packages.
> +
> +start(){
> + echo -n "Initializing ${NAME}: "
Should be "Starting ${NAME}: " to match other Buildroot packages.
> +
> + # Create dir to store log files in if one doesn't exist. Create
> + # the directory with SELinux permissions if possible
> + command -v matchpathcon >/dev/null 2>&1 && \
> + mkdir -p /var/log/audit -Z `matchpathcon -n /var/log/audit` || \
> + mkdir -p /var/log/audit
This seems a bit hard to read, maybe (untested):
if command -v matchpathcon >/dev/null 2>&1 ; then
mkdir -p /var/log/audit -Z `matchpathcon -n /var/log/audit`
else
mkdir -p /var/log/audit
fi
But it's a bit weird to do things "if possible". Either it is needed
and we always do it (which requires a dependency on libselinux, since
that's where matchpathcon is), or we never do it.
> + # Run audit daemon executable
> + start-stop-daemon -S -q -p ${LOCK} --exec ${DAEMON}
> +
> + # Load the default rules
> + test -f /etc/audit/rules.d/audit.rules && /usr/sbin/auditctl -R /etc/audit/rules.d/audit.rules >/dev/null
> +
> + echo "OK"
Lacks some error handling, no? Look at other init scripts.
> +}
> +
> +stop(){
> + echo -n "Uninitializing ${NAME}: "
"Stopping ${NAME}: "
> +
> + start-stop-daemon -K -q -p ${LOCK}
> +
> + echo "OK"
> +}
> +
> +reload(){
> + echo -n "Reloading ${NAME} configuration: "
> + if [ -e ${LOCK} ]; then
> + kill -HUP `cat ${LOCK}`
> + RETVAL=$?
> + if [ ${RETVAL} ]; then
> + echo "OK"
> + else
> + echo "FAILED"
> + fi
> + else
> + echo "FAILED: ${NAME} not started"
> + RETVAL=1
> + fi
> + return ${RETVAL}
Can you try just something like:
echo -n "Reloading ${NAME} configuration: "
start-stop-daemon --stop -s 1 -p ${PIDFILE}
[ $? = 0 ] && echo "OK" || echo "FAIL"
> +rotate(){
> + echo -n "Rotating ${NAME} logs: "
> + if [ -e ${LOCK} ]; then
> + kill -USR1 `cat ${LOCK}`
> + RETVAL=$?
> + if [ ${RETVAL} ]; then
> + echo "OK"
> + else
> + echo "FAILED"
> + fi
> + else
> + echo "FAILED: ${NAME} not started"
> + RETVAL=1
> + fi
> + return ${RETVAL}
Same, but with -s 30 passed as start-stop-daemon argument?
> +exit $?
Not needed probably.
> diff --git a/package/audit/audit.mk b/package/audit/audit.mk
> new file mode 100644
> index 0000000..c3ee0bb
> --- /dev/null
> +++ b/package/audit/audit.mk
> @@ -0,0 +1,43 @@
> +################################################################################
> +#
> +# audit
> +#
> +################################################################################
> +
> +AUDIT_VERSION = 2.4.1
> +AUDIT_SITE = http://people.redhat.com/sgrubb/audit/
> +AUDIT_LICENSE = GPLv2
> +AUDIT_LICENSE_FILES = COPYING
> +
> +AUDIT_INSTALL_STAGING = YES
> +
> +# Patching configure.ac and Makefile.am
> +AUDIT_AUTORECONF = YES
> +
> +AUDIT_CONF_OPTS = --without-python --disable-zos-remote
> +
> +ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
> +AUDIT_DEPENDENCIES += libcap-ng
> +AUDIT_CONF_OPTS += --with-libcap-ng=yes
> +else
> +AUDIT_CONF_OPTS += --with-libcap-ng=no
> +endif
> +
> +ifeq ($(BR2_arm)$(BR2_armeb),y)
> +AUDIT_CONF_OPTS += --with-arm
> +endif
> +ifeq ($(BR2_aarch64),y)
> +AUDIT_CONF_OPTS += --with-aarch64
> +endif
I've added a comment above these lines to explain why we need special
handling for ARM and AArch64 and not for other architectures.
> +
> +define AUDIT_INSTALL_INIT_SYSV
> + $(INSTALL) -m 755 package/audit/S01auditd $(TARGET_DIR)/etc/init.d/
> +endef
I've removed these lines, since I did not include the init script for
the moment.
> +
> +define AUDIT_INSTALL_CLEANUP
> + $(RM) -rf $(TARGET_DIR)/etc/rc.d
> + $(RM) -rf $(TARGET_DIR)/etc/sysconfig
> +endef
> +AUDIT_POST_INSTALL_TARGET_HOOKS += AUDIT_INSTALL_CLEANUP
> +
> +$(eval $(autotools-package))
So, patch applied, with the comments mentioned above: removal of init
script, addition of BR2_PACKAGE_AUDIT_ARCH_SUPPORTS, and comment in
the .mk file about the ARM/AArch64 options.
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-06-17 21:45 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 13:28 [Buildroot] [PATCH v7 00/22] SELinux Buildroot Additions Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 01/22] sqlite: Add host build support Clayton Shotwell
2015-06-17 21:05 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 02/22] setools: new package Clayton Shotwell
2015-06-17 21:06 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 03/22] python-pyparsing: Add host build option Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 04/22] audit: new package Clayton Shotwell
2015-06-17 21:45 ` Thomas Petazzoni [this message]
2015-06-19 15:56 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 05/22] policycoreutils: " Clayton Shotwell
2015-06-17 22:13 ` Thomas Petazzoni
2015-07-08 20:40 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 06/22] refpolicy: " Clayton Shotwell
2015-07-10 18:09 ` Samuel Martin
2015-07-10 22:31 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 07/22] busybox: applets as individual binaries Clayton Shotwell
2015-06-20 16:13 ` Samuel Martin
2015-07-10 17:50 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 08/22] busybox: selinux support Clayton Shotwell
2015-06-20 16:23 ` Samuel Martin
2015-07-10 17:56 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 09/22] linux-pam: " Clayton Shotwell
2015-06-20 17:08 ` Samuel Martin
2015-07-10 19:13 ` Clayton Shotwell
2015-07-10 19:16 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 10/22] busybox: added linux-pam support Clayton Shotwell
2015-06-20 17:13 ` Samuel Martin
2015-06-02 13:28 ` [Buildroot] [PATCH v7 11/22] sysvinit: added libselinux dependency Clayton Shotwell
2015-07-10 18:30 ` Samuel Martin
2015-06-02 13:28 ` [Buildroot] [PATCH v7 12/22] dbus: selinux file context support Clayton Shotwell
2015-07-10 20:32 ` Samuel Martin
2015-06-02 13:28 ` [Buildroot] [PATCH v7 13/22] openssh: selinux and pam support Clayton Shotwell
[not found] ` <CAHXCMML3=hbmcTV7p9ycJdohW4PCm_PoVaFmnGr3=ABZAKC3fQ@mail.gmail.com>
2015-07-10 23:01 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 14/22] util-linux: selinux, audit, " Clayton Shotwell
2015-07-10 21:28 ` Samuel Martin
2015-06-02 13:28 ` [Buildroot] [PATCH v7 15/22] vim: selinux support Clayton Shotwell
2015-06-20 17:41 ` Samuel Martin
2015-07-01 8:57 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 16/22] rsyslog: fix config file comment style Clayton Shotwell
2015-07-10 22:01 ` Samuel Martin
2015-07-10 23:16 ` Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 17/22] qemu x86 selinux: added common selinux support files Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 18/22] qemu x86 selinux: base br defconfig Clayton Shotwell
2015-06-02 13:28 ` [Buildroot] [PATCH v7 19/22] libsemanage: cleanup python use and license definition Clayton Shotwell
2015-06-30 14:39 ` Thomas Petazzoni
2015-06-30 15:27 ` Matthew Weber
2015-06-30 16:43 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 20/22] squashfs: Add xattr support Clayton Shotwell
2015-07-06 10:16 ` Thomas Petazzoni
2015-07-10 19:54 ` Clayton Shotwell
2015-07-10 20:23 ` Thomas Petazzoni
2015-07-11 17:12 ` Matthew Weber
2015-07-15 20:21 ` Thomas Petazzoni
2015-07-15 21:55 ` Matthew Weber
2015-07-16 15:18 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 21/22] mtd: " Clayton Shotwell
2015-07-06 10:35 ` Thomas Petazzoni
2015-06-02 13:28 ` [Buildroot] [PATCH v7 22/22] cpio: new package Clayton Shotwell
2015-07-06 10:38 ` Thomas Petazzoni
2015-07-10 21:02 ` Clayton Shotwell
2015-07-10 22:16 ` Thomas Petazzoni
2015-07-10 22:18 ` Clayton Shotwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150617234513.6e589827@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox