~ubuntu-branches/ubuntu/precise/apparmor/precise-security

« back to all changes in this revision

Viewing changes to .pc/0014-apparmor-lp979095.patch/common/Make.rules

  • Committer: Package Import Robot
  • Author(s): Steve Beattie, Jamie Strandboge, Serge Hallyn, Steve Beattie
  • Date: 2012-04-12 06:17:42 UTC
  • Revision ID: package-import@ubuntu.com-20120412061742-9v75hjko2mjtbewv
Tags: 2.7.102-0ubuntu3
[ Jamie Strandboge ]
* debian/patches/0007-ubuntu-manpage-updates.patch: update apparmor(5)
  to describe Ubuntu's two-stage policy load and how to add utilize it
  when developing policy (LP: #974089)

[ Serge Hallyn ]
* debian/apparmor.init: do nothing in a container.  This can be
  removed once stacked profiles are supported and used by lxc.
  (LP: #978297)

[ Steve Beattie ]
* debian/patches/0008-apparmor-lp963756.patch: Fix permission mapping
  for change_profile onexec (LP: #963756)
* debian/patches/0009-apparmor-lp959560-part1.patch,
  debian/patches/0010-apparmor-lp959560-part2.patch: Update the parser
  to support the 'in' keyword for value lists, and make mount
  operations aware of 'in' keyword so they can affect the flags build
  list (LP: #959560)
* debian/patches/0011-apparmor-lp872446.patch: fix logprof missing
  exec events in complain mode (LP: #872446)
* debian/patches/0012-apparmor-lp978584.patch: allow inet6 access in
  dovecot imap-login profile (LP: #978584)
* debian/patches/0013-apparmor-lp800826.patch: fix libapparmor
  log parsing library from dropping apparmor network events that
  contain ip addresses or ports in them (LP: #800826)
* debian/patches/0014-apparmor-lp979095.patch: document new mount rule
  syntax and usage in apparmor.d(5) manpage (LP: #979095)
* debian/patches/0015-apparmor-lp963756.patch: Fix change_onexec
  for profiles without attachment specification (LP: #963756,
  LP: #978038)
* debian/patches/0016-apparmor-lp968956.patch: Fix protocol error when
  loading policy to kernels without compat patches (LP: #968956)
* debian/patches/0017-apparmor-lp979135.patch: Fix change_profile to
  grant access to /proc/attr api (LP: #979135)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ------------------------------------------------------------------
 
2
#
 
3
#    Copyright (C) 2002-2005 Novell/SUSE
 
4
#    Copyright (C) 2010 Canonical, Ltd.
 
5
#
 
6
#    This program is free software; you can redistribute it and/or
 
7
#    modify it under the terms of version 2 of the GNU General Public 
 
8
#    License published by the Free Software Foundation.
 
9
#
 
10
#    This program is distributed in the hope that it will be useful,
 
11
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
#    GNU General Public License for more details.
 
14
#
 
15
#    You should have received a copy of the GNU General Public License
 
16
#    along with this program; if not, contact Novell, Inc.
 
17
# ------------------------------------------------------------------
 
18
# Make.rules - common make targets and variables for building the SHASS
 
19
# product.
 
20
#
 
21
# NOTES:
 
22
#   - must define the package NAME before including this file.
 
23
#   - After checking in to cvs, you'll need to delele the hardlinked
 
24
#     Make.rules files that already exist in the individual application
 
25
#     directories
 
26
 
 
27
DISTRIBUTION=AppArmor
 
28
VERSION=$(shell cat common/Version)
 
29
 
 
30
# OVERRIDABLE variables
 
31
# Set these variables before including Make.rules to change its behavior
 
32
#   SPECFILE - for packages that have a non-standard specfile name
 
33
#   EXTERNAL_PACKAGE - for packages that have upstream versions that
 
34
#       we're locally modifying (e.g. imnxcerttool/gnutls).
 
35
#
 
36
# use 'make BUILDIR=/some/where/else/' to override the /usr/src/redhat
 
37
# location -- it *should* pick out the right thing to do based on the
 
38
# .rpmmacros file, but you can still use BUILDDIR to override that.
 
39
TESTBUILDDIR=$(shell [ -f ${HOME}/.rpmmacros ] && awk '/^%_topdir/ {print $$2}' ${HOME}/.rpmmacros)
 
40
ifndef BUILDDIR
 
41
BUILDDIR=$(shell if [ -d "${TESTBUILDDIR}" ] ; then \
 
42
                    echo ${TESTBUILDDIR} | sed "s^/$$^^" ; \
 
43
                  elif [ -d "/usr/src/redhat" ] ; then \
 
44
                    echo "/usr/src/redhat" ; \
 
45
                  elif [ -d "/usr/src/packages" ] ; then \
 
46
                    echo "/usr/src/packages" ; \
 
47
                  else \
 
48
                    echo "/tmp/${NAME}"  ; \
 
49
                  fi ;)
 
50
endif
 
51
ifndef DISTRO
 
52
DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \
 
53
                  echo slackware ; \
 
54
               elif [ -f /etc/debian_version ] ; then \
 
55
                  echo debian ;\
 
56
               elif which rpm > /dev/null ; then \
 
57
                 if [ "$(rpm --eval '0%{?suse_version}')" != "0" ] ; then \
 
58
                     echo suse ;\
 
59
                 elif [ "$(rpm --eval '%{_host_vendor}')" = redhat ] ; then \
 
60
                    echo rhel4 ;\
 
61
                 elif [ "$(rpm --eval '0%{?fedora}')" != "0" ] ; then \
 
62
                    echo rhel4 ;\
 
63
                 else \
 
64
                    echo unknown ;\
 
65
                 fi ;\
 
66
               else \
 
67
                  echo unknown ;\
 
68
               fi)
 
69
endif
 
70
RPMARG=--define "_topdir $(BUILDDIR:/=)" \
 
71
        --define "vendor NOVELL, Inc." \
 
72
        --define "distribution ${DISTRIBUTION}" \
 
73
        --define "debug_package %{nil}" \
 
74
        --define "immunix_version ${VERSION}" \
 
75
        $(shell [ -d ${BUILDDIR}/BUILDROOT ] && echo --define \"buildroot $(BUILDDIR:/=)/BUILDROOT\") \
 
76
        $(shell [ -n "${DISTRO}" ] && echo --define \"distro ${DISTRO}\")
 
77
 
 
78
REPO_VERSION_CMD=([ -x /usr/bin/bzr ] && /usr/bin/bzr version-info . 2> /dev/null || awk '{ print "revno: "$2 }' common/.stamp_rev) | awk '/^revno:/ { print $2 }'
 
79
 
 
80
ifdef EXTERNAL_PACKAGE
 
81
RPMARG+=--define "_sourcedir $(shell pwd)"
 
82
endif
 
83
 
 
84
ifndef SPECFILE
 
85
SPECFILE        = $(NAME).spec
 
86
endif
 
87
RELEASE_DIR     = $(NAME)-$(VERSION)
 
88
TAR             = /bin/tar czvp -h --exclude .svn --exclude .bzr --exclude .bzrignore --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude")
 
89
LDCONFIG        = /sbin/ldconfig
 
90
 
 
91
RPMSUBDIRS=SOURCES SPECS BUILD BUILDROOT SRPMS RPMS/i386 RPMS/i586 \
 
92
        RPMS/i686 RPMS/athlon RPMS/noarch RPMS/x86_64
 
93
BUILDRPMSUBDIRS=$(foreach subdir, $(RPMSUBDIRS), $(BUILDDIR:/=)/$(subdir))
 
94
 
 
95
ifdef EXTERNAL_PACKAGE
 
96
.PHONY: rpm
 
97
rpm: clean $(BUILDRPMSUBDIRS)
 
98
        rpmbuild -ba ${RPMARG} ${SPECFILE}
 
99
 
 
100
else
 
101
.PHONY: rpm
 
102
rpm: clean $(BUILDRPMSUBDIRS)
 
103
        __REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \
 
104
        __TARBALL=$(NAME)-$(VERSION)-$${__REPO_VERSION}.tar.gz ; \
 
105
        make $${__TARBALL} ; \
 
106
        cp $${__TARBALL} $(BUILDDIR)/SOURCES/
 
107
        cp ${SPECFILE} $(BUILDDIR)/SPECS/
 
108
        rpmbuild -ba ${RPMARG} ${SPECFILE}
 
109
 
 
110
.PHONY: ${SPECFILE}
 
111
${SPECFILE}: ${SPECFILE}.in
 
112
        __REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \
 
113
        sed -e "s/@@immunix_version@@/${VERSION}/g" \
 
114
            -e "s/@@repo_version@@/$${__REPO_VERSION}/g" $< > $@
 
115
 
 
116
%.tar.gz: clean ${SPECFILE}
 
117
        -rm -rf $(RELEASE_DIR)
 
118
        mkdir $(RELEASE_DIR)
 
119
        $(TAR) --exclude $@ . | tar xz -C $(RELEASE_DIR)
 
120
        $(TAR) --exclude $@ -f $@ $(RELEASE_DIR)
 
121
        rm -rf $(RELEASE_DIR)
 
122
 
 
123
ifndef OVERRIDE_TARBALL
 
124
.PHONY: tarball
 
125
tarball: clean $(TARBALL)
 
126
endif
 
127
 
 
128
endif
 
129
 
 
130
.PHONY: version
 
131
.SILENT: version
 
132
version:
 
133
         rpm -q --define "_sourcedir ." ${RPMARG} --specfile ${SPECFILE}
 
134
 
 
135
.PHONY: repo_version
 
136
.SILENT: repo_version
 
137
repo_version:
 
138
         $(value REPO_VERSION_CMD)
 
139
 
 
140
 
 
141
.PHONY: build_dir 
 
142
build_dir: $(BUILDRPMSUBDIRS)
 
143
 
 
144
$(BUILDRPMSUBDIRS):
 
145
        mkdir -p $(BUILDRPMSUBDIRS)
 
146
 
 
147
.PHONY: _clean
 
148
.SILENT: _clean
 
149
_clean:
 
150
        -rm -f ${NAME}-${VERSION}-*.tar.gz
 
151
        -rm -f ${MANPAGES} *.[0-9].gz ${HTMLMANPAGES} pod2htm*.tmp
 
152
 
 
153
# =====================
 
154
# generate list of capabilities based on
 
155
# /usr/include/linux/capabilities.h for use in multiple locations in
 
156
# the source tree
 
157
# =====================
 
158
 
 
159
# emits defined capabilities in a simple list, e.g. "CAP_NAME CAP_NAME2"
 
160
CAPABILITIES=$(shell echo "\#include <linux/capability.h>" | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | sort)
 
161
 
 
162
.PHONY: list_capabilities
 
163
list_capabilities: /usr/include/linux/capability.h
 
164
        @echo "$(CAPABILITIES)"
 
165
 
 
166
# =====================
 
167
# generate list of network protocols based on
 
168
# sys/socket.h for use in multiple locations in
 
169
# the source tree
 
170
# =====================
 
171
 
 
172
# These are the families that it doesn't make sense for apparmor
 
173
# to mediate. We use PF_ here since that is what is required in
 
174
# bits/socket.h, but we will rewrite these as AF_.
 
175
 
 
176
FILTER_FAMILIES=PF_UNSPEC PF_UNIX PF_LOCAL PF_NETLINK
 
177
 
 
178
__FILTER=$(shell echo $(strip $(FILTER_FAMILIES)) | sed -e 's/ /\\\|/g')
 
179
 
 
180
# emits the AF names in a "AF_NAME NUMBER," pattern
 
181
AF_NAMES=$(shell echo "\#include <sys/socket.h>" | cpp -dM | LC_ALL=C sed -n -e '/$(__FILTER)/d' -e 's/^\#define[ \t]\+PF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\).*$$/AF_\1 \2,/p' | sort -n -k2)
 
182
 
 
183
.PHONY: list_af_names
 
184
list_af_names:
 
185
        @echo "$(AF_NAMES)"
 
186
 
 
187
# =====================
 
188
# manpages
 
189
# =====================
 
190
 
 
191
POD2MAN                         = /usr/bin/pod2man
 
192
POD2HTML                        = /usr/bin/pod2html
 
193
MANDIR                          = /usr/share/man
 
194
DOCDIR                          = /usr/share/doc/${NAME}-${VERSION}
 
195
 
 
196
# get list of directory numbers based on definition of MANPAGES variable
 
197
MANDIRS=$(sort $(foreach dir, 1 2 3 4 5 6 7 8, $(patsubst %.${dir}, ${dir}, $(filter %.${dir}, ${MANPAGES}))))
 
198
HTMLMANPAGES=$(foreach manpage, ${MANPAGES}, ${manpage}.html)
 
199
 
 
200
.PHONY: install_manpages
 
201
install_manpages: $(MANPAGES)
 
202
        $(foreach dir, ${MANDIRS}, \
 
203
             install -d ${DESTDIR}/${MANDIR}/man${dir} ; \
 
204
             install -m 644 $(filter %.${dir}, ${MANPAGES}) ${DESTDIR}/${MANDIR}/man${dir}; \
 
205
        )
 
206
 
 
207
MAN_RELEASE="AppArmor ${VERSION}"
 
208
 
 
209
%.1: %.pod
 
210
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=1 > $@
 
211
 
 
212
%.2: %.pod
 
213
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=2 > $@
 
214
 
 
215
%.3: %.pod
 
216
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=3 > $@
 
217
 
 
218
%.4: %.pod
 
219
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=4 > $@
 
220
 
 
221
%.5: %.pod
 
222
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=5 > $@
 
223
 
 
224
%.6: %.pod
 
225
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=6 > $@
 
226
 
 
227
%.7: %.pod
 
228
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=7 > $@
 
229
 
 
230
%.8: %.pod
 
231
        $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --section=8 > $@
 
232
 
 
233
%.1.html: %.pod
 
234
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
235
 
 
236
%.2.html: %.pod
 
237
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
238
 
 
239
%.3.html: %.pod
 
240
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
241
 
 
242
%.4.html: %.pod
 
243
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
244
 
 
245
%.5.html: %.pod
 
246
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
247
 
 
248
%.6.html: %.pod
 
249
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
250
 
 
251
%.7.html: %.pod
 
252
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
253
 
 
254
%.8.html: %.pod
 
255
        $(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
 
256
 
 
257
A2PS_ARGS=-Ec -g --line-numbers=1
 
258
ENSCRIPT_ARGS=-C -2jGr -f Courier6 -E
 
259
%.c.ps: %.c
 
260
        #a2ps ${A2PS_ARGS} $< -o $@
 
261
        enscript ${ENSCRIPT_ARGS} -o $@ $<
 
262
 
 
263
%.pm.ps: %.pm
 
264
        enscript ${ENSCRIPT_ARGS} -o $@ $<