2006-04-11 21:52:54 +00:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
2010-08-05 15:10:33 -05:00
|
|
|
# Copyright (C) 2002-2009 Novell/SUSE
|
|
|
|
# Copyright (C) 2010 Canonical Ltd.
|
2006-04-11 21:52:54 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2006-06-05 16:39:29 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2006-04-11 21:52:54 +00:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
2010-08-05 15:10:33 -05:00
|
|
|
# Makefile for LSM-based AppArmor profiles
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
NAME=apparmor-profiles
|
2011-03-18 22:31:26 -07:00
|
|
|
ALL: local
|
2006-04-12 20:35:41 +00:00
|
|
|
COMMONDIR=../common/
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2006-11-04 21:34:47 +00:00
|
|
|
include common/Make.rules
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
COMMONDIR_EXISTS=$(strip $(shell [ -d ${COMMONDIR} ] && echo true))
|
|
|
|
ifeq ($(COMMONDIR_EXISTS), true)
|
2006-11-04 21:34:47 +00:00
|
|
|
common/Make.rules: $(COMMONDIR)/Make.rules
|
|
|
|
ln -sf $(COMMONDIR) .
|
2006-04-11 21:52:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DESTDIR=/
|
2007-05-16 18:51:46 +00:00
|
|
|
PROFILES_DEST=${DESTDIR}/etc/apparmor.d
|
|
|
|
EXTRAS_DEST=${DESTDIR}/etc/apparmor/profiles/extras/
|
|
|
|
PROFILES_SOURCE=./apparmor.d
|
|
|
|
EXTRAS_SOURCE=./apparmor/profiles/extras/
|
2010-08-05 15:10:33 -05:00
|
|
|
SUBDIRS_MUST_BE_SKIPPED=${PROFILES_SOURCE}/abstractions ${PROFILES_SOURCE}/apache2.d ${PROFILES_SOURCE}/program-chunks ${PROFILES_SOURCE}/tunables ${PROFILES_SOURCE}/local
|
2007-05-16 18:51:46 +00:00
|
|
|
PROFILES_TO_COPY=$(filter-out ${SUBDIRS_MUST_BE_SKIPPED}, $(wildcard ${PROFILES_SOURCE}/*))
|
2011-03-23 16:10:33 -07:00
|
|
|
TUNABLES_TO_COPY=$(filter-out ${PROFILES_SOURCE}/tunables/home.d ${PROFILES_SOURCE}/tunables/multiarch.d, $(wildcard ${PROFILES_SOURCE}/tunables/*))
|
2010-08-10 16:42:00 -05:00
|
|
|
ABSTRACTIONS_TO_COPY=$(filter-out ${PROFILES_SOURCE}/abstractions/ubuntu-browsers.d, $(wildcard ${PROFILES_SOURCE}/abstractions/*))
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2010-08-05 15:10:33 -05:00
|
|
|
local:
|
|
|
|
for profile in ${PROFILES_TO_COPY}; do \
|
|
|
|
fn=$$(basename $$profile); \
|
|
|
|
echo "# Site-specific additions and overrides for '$$fn'" > ${PROFILES_SOURCE}/local/$$fn; \
|
|
|
|
done; \
|
|
|
|
|
2006-04-11 21:52:54 +00:00
|
|
|
.PHONY: install
|
2010-08-05 15:10:33 -05:00
|
|
|
install: local
|
2007-05-16 18:51:46 +00:00
|
|
|
install -m 755 -d ${PROFILES_DEST}
|
|
|
|
install -m 755 -d ${PROFILES_DEST}/abstractions \
|
2009-11-11 11:42:30 -08:00
|
|
|
${PROFILES_DEST}/apache2.d \
|
2011-10-20 00:23:19 +02:00
|
|
|
${PROFILES_DEST}/disable \
|
2007-05-16 18:51:46 +00:00
|
|
|
${PROFILES_DEST}/program-chunks \
|
2010-01-05 15:58:43 -06:00
|
|
|
${PROFILES_DEST}/tunables \
|
2010-08-05 15:10:33 -05:00
|
|
|
${PROFILES_DEST}/tunables/home.d \
|
2012-01-03 23:41:07 +01:00
|
|
|
${PROFILES_DEST}/tunables/multiarch.d \
|
2010-08-05 15:10:33 -05:00
|
|
|
${PROFILES_DEST}/local
|
2007-05-16 18:51:46 +00:00
|
|
|
install -m 644 ${PROFILES_TO_COPY} ${PROFILES_DEST}
|
2010-08-10 16:42:00 -05:00
|
|
|
install -m 644 ${ABSTRACTIONS_TO_COPY} ${PROFILES_DEST}/abstractions
|
|
|
|
install -m 755 -d ${PROFILES_DEST}/abstractions/ubuntu-browsers.d
|
|
|
|
install -m 644 ${PROFILES_SOURCE}/abstractions/ubuntu-browsers.d/* ${PROFILES_DEST}/abstractions/ubuntu-browsers.d
|
2009-11-11 11:42:30 -08:00
|
|
|
install -m 644 ${PROFILES_SOURCE}/apache2.d/* ${PROFILES_DEST}/apache2.d
|
2007-05-16 18:51:46 +00:00
|
|
|
install -m 644 ${PROFILES_SOURCE}/program-chunks/* ${PROFILES_DEST}/program-chunks
|
2010-01-05 15:58:43 -06:00
|
|
|
install -m 644 ${TUNABLES_TO_COPY} ${PROFILES_DEST}/tunables
|
|
|
|
install -m 644 ${PROFILES_SOURCE}/tunables/home.d/* ${PROFILES_DEST}/tunables/home.d
|
2011-03-23 16:10:33 -07:00
|
|
|
install -m 644 ${PROFILES_SOURCE}/tunables/multiarch.d/* ${PROFILES_DEST}/tunables/multiarch.d
|
2007-05-16 18:51:46 +00:00
|
|
|
install -m 755 -d ${EXTRAS_DEST}
|
|
|
|
install -m 644 ${EXTRAS_SOURCE}/* ${EXTRAS_DEST}
|
2010-08-05 15:10:33 -05:00
|
|
|
install -m 644 ${PROFILES_SOURCE}/local/* ${PROFILES_DEST}/local
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2010-08-05 16:00:23 -05:00
|
|
|
LOCAL_ADDITIONS=$(filter-out ${PROFILES_SOURCE}/local/README, $(wildcard ${PROFILES_SOURCE}/local/*))
|
2006-04-11 21:52:54 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2010-08-05 16:00:23 -05:00
|
|
|
-rm -f $(NAME)-$(VERSION)*.tar.gz Make.rules ${LOCAL_ADDITIONS}
|
2006-06-05 16:39:29 +00:00
|
|
|
|
|
|
|
ifndef VERBOSE
|
|
|
|
Q=@
|
|
|
|
else
|
|
|
|
Q=
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef PARSER
|
|
|
|
# use system parser
|
2011-03-18 22:31:26 -07:00
|
|
|
PARSER=../parser/apparmor_parser
|
2006-06-05 16:39:29 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef LOGPROF
|
2011-03-18 22:31:26 -07:00
|
|
|
# use ../utils logprof
|
|
|
|
LOGPROF=perl -I../utils/ ../utils/aa-logprof
|
2006-06-05 16:39:29 +00:00
|
|
|
endif
|
|
|
|
|
2011-03-18 22:31:26 -07:00
|
|
|
IGNORE_FILES=${EXTRAS_SOURCE}/README
|
|
|
|
CHECK_PROFILES=$(filter-out ${IGNORE_FILES} ${SUBDIRS_MUST_BE_SKIPPED}, $(wildcard ${PROFILES_SOURCE}/*) $(wildcard ${EXTRAS_SOURCE}/*))
|
2006-06-05 16:39:29 +00:00
|
|
|
|
|
|
|
.PHONY: check
|
|
|
|
check:
|
2011-03-18 22:31:26 -07:00
|
|
|
@echo "*** Checking profiles from ${PROFILES_SOURCE} and ${EXTRAS_SOURCE} against apparmor_parser"
|
2006-06-05 16:39:29 +00:00
|
|
|
$(Q)for profile in ${CHECK_PROFILES} ; do \
|
2011-03-18 22:31:26 -07:00
|
|
|
${PARSER} -S -b ${PWD}/apparmor.d $${profile} > /dev/null || exit 1; \
|
2006-06-05 16:39:29 +00:00
|
|
|
done
|
2007-05-16 18:51:46 +00:00
|
|
|
@echo "*** Checking profiles from ${PROFILES_SOURCE} against logprof"
|
2011-03-18 22:31:26 -07:00
|
|
|
$(Q)${LOGPROF} -d ${PROFILES_SOURCE} -f /dev/null || exit 1
|