apparmor/utils/Makefile

105 lines
3.2 KiB
Makefile
Raw Normal View History

# ----------------------------------------------------------------------
# Copyright (c) 1999, 2004-2009 NOVELL (All rights reserved)
# Copyright (c) 2010-2016 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
# ----------------------------------------------------------------------
NAME = apparmor-utils
all:
COMMONDIR=../common/
include $(COMMONDIR)/Make.rules
PYTOOLS = aa-easyprof aa-genprof aa-logprof aa-cleanprof aa-mergeprof \
aa-autodep aa-audit aa-complain aa-enforce aa-disable \
aa-notify aa-unconfined
TOOLS = ${PYTOOLS} aa-decode aa-remove-unknown
This patchset is broken into 4 parts: * the application, library, documentation and installation script * the initial templates and policy groups. This will undoubtedly need refinement as we get feedback from users. Initial policy is based on Ubuntu's Application Review Board (ARB) requirements[2]. * tests for the library * Makefile integration Templates are stored in /usr/share/apparmor/easyprof/templates and policy groups in /usr/share/apparmor/easyprof/policygroups. This can be adjusted via /etc/apparmor/easyprof.conf. The aa-easyprof.pod has complete documentation on usage with some additional information in utils/easyprof/README (mostly duplicated here). Testing can be performed in a number of ways: $ cd utils ; make check # runs unit tests and pyflakes Unit tests manually: $ ./test/test-aa-easyprof.py In source manual testing: $ ./aa-easyprof --templates-dir=./easyprof/templates \ --policy-groups-dir=./easyprof/policygroups \ ... \ /opt/foo/bin/foo Post-install manual testing: $ make DESTDIR=/tmp/test PERLDIR=/tmp/test/usr/share/perl5/Immunix install $ cd /tmp/test $ PYTHONPATH=/tmp/test/usr/local/.../dist-packages ./usr/bin/aa-easyprof \ --templates-dir=/tmp/test/usr/share/apparmor/easyprof/templates \ --policy-groups-dir=/tmp/test/usr/share/apparmor/easyprof/policygroups \ /opt/bin/foo (you may also adjust /tmp/test/etc/apparmor/easyprof.conf to avoid specifying --templates-dir and --policy-groups-dir). Committing this now based on conversation with John and Steve. Acked-By: Jamie Strandboge <jamie@canonical.com>
2012-05-07 22:37:48 -07:00
PYSETUP = python-tools-setup.py
PYMODULES = $(wildcard apparmor/*.py apparmor/rule/*.py)
MANPAGES = ${TOOLS:=.8} logprof.conf.5
PYFLAKES ?= pyflakes3
all: docs
$(MAKE) -C po all
$(MAKE) -C vim all
.PHONY: docs
docs: ${MANPAGES} ${HTMLMANPAGES}
# need some better way of determining this
DESTDIR=/
BINDIR=${DESTDIR}/usr/sbin
CONFDIR=${DESTDIR}/etc/apparmor
This patchset is broken into 4 parts: * the application, library, documentation and installation script * the initial templates and policy groups. This will undoubtedly need refinement as we get feedback from users. Initial policy is based on Ubuntu's Application Review Board (ARB) requirements[2]. * tests for the library * Makefile integration Templates are stored in /usr/share/apparmor/easyprof/templates and policy groups in /usr/share/apparmor/easyprof/policygroups. This can be adjusted via /etc/apparmor/easyprof.conf. The aa-easyprof.pod has complete documentation on usage with some additional information in utils/easyprof/README (mostly duplicated here). Testing can be performed in a number of ways: $ cd utils ; make check # runs unit tests and pyflakes Unit tests manually: $ ./test/test-aa-easyprof.py In source manual testing: $ ./aa-easyprof --templates-dir=./easyprof/templates \ --policy-groups-dir=./easyprof/policygroups \ ... \ /opt/foo/bin/foo Post-install manual testing: $ make DESTDIR=/tmp/test PERLDIR=/tmp/test/usr/share/perl5/Immunix install $ cd /tmp/test $ PYTHONPATH=/tmp/test/usr/local/.../dist-packages ./usr/bin/aa-easyprof \ --templates-dir=/tmp/test/usr/share/apparmor/easyprof/templates \ --policy-groups-dir=/tmp/test/usr/share/apparmor/easyprof/policygroups \ /opt/bin/foo (you may also adjust /tmp/test/etc/apparmor/easyprof.conf to avoid specifying --templates-dir and --policy-groups-dir). Committing this now based on conversation with John and Steve. Acked-By: Jamie Strandboge <jamie@canonical.com>
2012-05-07 22:37:48 -07:00
PYPREFIX=/usr
po/${NAME}.pot: ${TOOLS} ${PYMODULES}
$(MAKE) -C po ${NAME}.pot NAME=${NAME} SOURCES="${TOOLS} ${PYMODULES}"
.PHONY: install
install: ${MANPAGES} ${HTMLMANPAGES}
install -d ${CONFDIR}
install -m 644 logprof.conf severity.db notify.conf ${CONFDIR}
install -d ${BINDIR}
# aa-easyprof is installed by python-tools-setup.py
install -m 755 $(filter-out aa-easyprof, ${TOOLS}) ${BINDIR}
$(MAKE) -C po install DESTDIR=${DESTDIR} NAME=${NAME}
$(MAKE) install_manpages DESTDIR=${DESTDIR}
$(MAKE) -C vim install DESTDIR=${DESTDIR}
2012-06-11 17:56:21 +01:00
${PYTHON} ${PYSETUP} install --prefix=${PYPREFIX} --root=${DESTDIR} --version=${VERSION}
.PHONY: clean
ifndef VERBOSE
.SILENT: clean
endif
clean: pod_clean
rm -f core core.* *.o *.s *.a *~
$(MAKE) -C po clean
$(MAKE) -C vim clean
$(MAKE) -C test clean
This patchset is broken into 4 parts: * the application, library, documentation and installation script * the initial templates and policy groups. This will undoubtedly need refinement as we get feedback from users. Initial policy is based on Ubuntu's Application Review Board (ARB) requirements[2]. * tests for the library * Makefile integration Templates are stored in /usr/share/apparmor/easyprof/templates and policy groups in /usr/share/apparmor/easyprof/policygroups. This can be adjusted via /etc/apparmor/easyprof.conf. The aa-easyprof.pod has complete documentation on usage with some additional information in utils/easyprof/README (mostly duplicated here). Testing can be performed in a number of ways: $ cd utils ; make check # runs unit tests and pyflakes Unit tests manually: $ ./test/test-aa-easyprof.py In source manual testing: $ ./aa-easyprof --templates-dir=./easyprof/templates \ --policy-groups-dir=./easyprof/policygroups \ ... \ /opt/foo/bin/foo Post-install manual testing: $ make DESTDIR=/tmp/test PERLDIR=/tmp/test/usr/share/perl5/Immunix install $ cd /tmp/test $ PYTHONPATH=/tmp/test/usr/local/.../dist-packages ./usr/bin/aa-easyprof \ --templates-dir=/tmp/test/usr/share/apparmor/easyprof/templates \ --policy-groups-dir=/tmp/test/usr/share/apparmor/easyprof/policygroups \ /opt/bin/foo (you may also adjust /tmp/test/etc/apparmor/easyprof.conf to avoid specifying --templates-dir and --policy-groups-dir). Committing this now based on conversation with John and Steve. Acked-By: Jamie Strandboge <jamie@canonical.com>
2012-05-07 22:37:48 -07:00
rm -rf staging/ build/
rm -f apparmor/*.pyc apparmor/rule/*.pyc
rm -rf apparmor/__pycache__/ apparmor/rule/__pycache__/
rm -rf apparmor.egg-info/
# ${CAPABILITIES} is defined in common/Make.rules
.PHONY: check_severity_db
.SILENT: check_severity_db
check_severity_db: /usr/include/linux/capability.h severity.db
# The sed statement is based on the one in the parser's makefile
RC=0 ; for cap in $(shell ../common/list_capabilities.sh) ; do \
if ! grep -q -w $${cap} severity.db ; then \
echo "ERROR: capability $${cap} not found in severity.db" ; \
RC=1 ; \
fi ;\
done ; \
test "$$RC" -eq 0
manpages: incorporate podchecker; fix errors and (most) warnings This patch adds a 'check_pod_files' make target to the common make rules, and then fixes the errors it highlighted as well as most of the warnings. It will cause 'make check' in most of the directories to fail if there are errors in a pod file (but not if there are warnings). Common issues were: - using an '=over/=back' pair for code-like snippets that did not contain any =items therein; the =over keyword is intended for indenting lists of =item entries, and generates a warning if there isn't any. - not escaping '<' or '>' - blank lines that contained spaces or tabs The second -warnings flag passed to podchecker is to add additional warnings, un-escaped '<' and '>' being of them. I did not fix all of the warnings in apparmor.d.pod, as I have not come up with a good warning-free way to express the BNF of the language similar in format to what is currently generated. The existing libapparmor warnings (complaints about duplicate =item definition names) are actually a result of passing the second -warnings flag. The integration into libapparmor is suboptimal due to automake's expectation that there will be a test driver program(s) for make check targets; that's why I added the podchecker call to the manpage generation point. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Seth Arnold <seth.arnold@canonical.com> --- changehat/mod_apparmor/Makefile | 3 changehat/mod_apparmor/mod_apparmor.pod | 28 ++- common/Make.rules | 4 libraries/libapparmor/doc/Makefile.am | 7 parser/Makefile | 2 parser/apparmor.d.pod | 275 +++++++++++++------------------- utils/Makefile | 3 utils/aa-cleanprof.pod | 2 utils/aa-complain.pod | 2 utils/aa-decode.pod | 2 utils/aa-easyprof.pod | 69 +++----- utils/aa-enforce.pod | 2 utils/aa-genprof.pod | 2 utils/aa-logprof.pod | 6 utils/aa-sandbox.pod | 64 ++----- utils/logprof.conf.pod | 2 utils/vim/Makefile | 2 17 files changed, 212 insertions(+), 263 deletions(-)
2014-09-15 11:30:47 -07:00
# check_pod_files is defined in common/Make.rules
.PHONY: check_lint
.SILENT: check_lint
check_lint:
for i in ${PYTOOLS} apparmor test/*.py; do \
This patchset is broken into 4 parts: * the application, library, documentation and installation script * the initial templates and policy groups. This will undoubtedly need refinement as we get feedback from users. Initial policy is based on Ubuntu's Application Review Board (ARB) requirements[2]. * tests for the library * Makefile integration Templates are stored in /usr/share/apparmor/easyprof/templates and policy groups in /usr/share/apparmor/easyprof/policygroups. This can be adjusted via /etc/apparmor/easyprof.conf. The aa-easyprof.pod has complete documentation on usage with some additional information in utils/easyprof/README (mostly duplicated here). Testing can be performed in a number of ways: $ cd utils ; make check # runs unit tests and pyflakes Unit tests manually: $ ./test/test-aa-easyprof.py In source manual testing: $ ./aa-easyprof --templates-dir=./easyprof/templates \ --policy-groups-dir=./easyprof/policygroups \ ... \ /opt/foo/bin/foo Post-install manual testing: $ make DESTDIR=/tmp/test PERLDIR=/tmp/test/usr/share/perl5/Immunix install $ cd /tmp/test $ PYTHONPATH=/tmp/test/usr/local/.../dist-packages ./usr/bin/aa-easyprof \ --templates-dir=/tmp/test/usr/share/apparmor/easyprof/templates \ --policy-groups-dir=/tmp/test/usr/share/apparmor/easyprof/policygroups \ /opt/bin/foo (you may also adjust /tmp/test/etc/apparmor/easyprof.conf to avoid specifying --templates-dir and --policy-groups-dir). Committing this now based on conversation with John and Steve. Acked-By: Jamie Strandboge <jamie@canonical.com>
2012-05-07 22:37:48 -07:00
echo Checking $$i; \
$(PYFLAKES) $$i || exit 1; \
done
# check_pod_files is defined in common/Make.rules
.PHONY: check
.SILENT: check
check: check_severity_db check_pod_files check_lint
$(MAKE) -C test check
$(MAKE) -C vim check