tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
Merge #8897: AppArmor updates
Vladimír Čunát
10 years ago
f2d03ee0
38d83144
+152
-288
4 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
apparmor
2.9
default.nix
capability.patch
default.nix
top-level
all-packages.nix
-183
pkgs/os-specific/linux/apparmor/2.9/default.nix
reviewed
···
1
1
-
{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, perl, which
2
2
-
, glibc, flex, bison, python27, swig, dbus, pam
3
3
-
}:
4
4
-
5
5
-
let
6
6
-
apparmor-series = "2.9";
7
7
-
apparmor-patchver = "2";
8
8
-
apparmor-version = "${apparmor-series}.${apparmor-patchver}";
9
9
-
10
10
-
apparmor-meta = component: with stdenv.lib; {
11
11
-
homepage = http://apparmor.net/;
12
12
-
description = "Linux application security system - ${component}";
13
13
-
license = licenses.gpl2;
14
14
-
maintainers = with maintainers; [ phreedom thoughtpolice joachifm ];
15
15
-
platforms = platforms.linux;
16
16
-
};
17
17
-
18
18
-
apparmor-sources = fetchurl {
19
19
-
url = "https://launchpad.net/apparmor/${apparmor-series}/${apparmor-version}/+download/apparmor-${apparmor-version}.tar.gz";
20
20
-
sha256 = "1mayly7d7w959fya7z8q6kab2x3jcwhqhkpx36jsvpjhxkhmc4fh";
21
21
-
};
22
22
-
23
23
-
prePatchCommon = ''
24
24
-
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man"
25
25
-
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html"
26
26
-
substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
27
27
-
substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
28
28
-
'';
29
29
-
30
30
-
libapparmor = stdenv.mkDerivation {
31
31
-
name = "libapparmor-${apparmor-version}";
32
32
-
src = apparmor-sources;
33
33
-
34
34
-
buildInputs = [
35
35
-
autoconf
36
36
-
automake
37
37
-
bison
38
38
-
flex
39
39
-
dbus # requires patch to dbus ...
40
40
-
glibc
41
41
-
libtool
42
42
-
perl
43
43
-
pkgconfig
44
44
-
python27
45
45
-
swig
46
46
-
which
47
47
-
];
48
48
-
49
49
-
prePatch = prePatchCommon + ''
50
50
-
substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${glibc}/include/netinet/in.h"
51
51
-
substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${glibc}/include/netinet/in.h"
52
52
-
'';
53
53
-
54
54
-
buildPhase = ''
55
55
-
cd ./libraries/libapparmor
56
56
-
./autogen.sh
57
57
-
./configure --prefix="$out" --with-python --with-perl
58
58
-
make
59
59
-
'';
60
60
-
61
61
-
installPhase = ''
62
62
-
make install
63
63
-
'';
64
64
-
65
65
-
meta = apparmor-meta "library";
66
66
-
};
67
67
-
68
68
-
apparmor-utils = stdenv.mkDerivation {
69
69
-
name = "apparmor-utils-${apparmor-version}";
70
70
-
src = apparmor-sources;
71
71
-
72
72
-
buildInputs = [
73
73
-
python27
74
74
-
libapparmor
75
75
-
which
76
76
-
];
77
77
-
78
78
-
prePatch = prePatchCommon;
79
79
-
80
80
-
buildPhase = ''
81
81
-
cd ./utils
82
82
-
make LANGS=""
83
83
-
'';
84
84
-
85
85
-
installPhase = ''
86
86
-
make install LANGS="" DESTDIR="$out" BINDIR="$out/bin" VIM_INSTALL_PATH="$out/share" PYPREFIX=""
87
87
-
'';
88
88
-
89
89
-
meta = apparmor-meta "user-land utilities";
90
90
-
};
91
91
-
92
92
-
apparmor-parser = stdenv.mkDerivation {
93
93
-
name = "apparmor-parser-${apparmor-version}";
94
94
-
src = apparmor-sources;
95
95
-
96
96
-
buildInputs = [
97
97
-
libapparmor
98
98
-
bison
99
99
-
flex
100
100
-
which
101
101
-
];
102
102
-
103
103
-
prePatch = prePatchCommon + ''
104
104
-
substituteInPlace ./parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison"
105
105
-
substituteInPlace ./parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex"
106
106
-
substituteInPlace ./parser/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
107
107
-
## techdoc.pdf still doesn't build ...
108
108
-
substituteInPlace ./parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
109
109
-
'';
110
110
-
111
111
-
buildPhase = ''
112
112
-
cd ./parser
113
113
-
make LANGS="" USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include
114
114
-
'';
115
115
-
116
116
-
installPhase = ''
117
117
-
make install LANGS="" USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include DESTDIR="$out" DISTRO="unknown"
118
118
-
'';
119
119
-
120
120
-
meta = apparmor-meta "rule parser";
121
121
-
};
122
122
-
123
123
-
apparmor-pam = stdenv.mkDerivation {
124
124
-
name = "apparmor-pam-${apparmor-version}";
125
125
-
src = apparmor-sources;
126
126
-
127
127
-
buildInputs = [
128
128
-
libapparmor
129
129
-
pam
130
130
-
pkgconfig
131
131
-
which
132
132
-
];
133
133
-
134
134
-
buildPhase = ''
135
135
-
cd ./changehat/pam_apparmor
136
136
-
make USE_SYSTEM=1
137
137
-
'';
138
138
-
139
139
-
installPhase = ''
140
140
-
make install DESTDIR="$out"
141
141
-
'';
142
142
-
143
143
-
meta = apparmor-meta "PAM service";
144
144
-
};
145
145
-
146
146
-
apparmor-profiles = stdenv.mkDerivation {
147
147
-
name = "apparmor-profiles-${apparmor-version}";
148
148
-
src = apparmor-sources;
149
149
-
150
150
-
buildInputs = [ which ];
151
151
-
152
152
-
buildPhase = ''
153
153
-
cd ./profiles
154
154
-
make
155
155
-
'';
156
156
-
157
157
-
installPhase = ''
158
158
-
make install DESTDIR="$out" EXTRAS_DEST="$out/share/apparmor/extra-profiles"
159
159
-
'';
160
160
-
161
161
-
meta = apparmor-meta "profiles";
162
162
-
};
163
163
-
164
164
-
apparmor-kernel-patches = stdenv.mkDerivation {
165
165
-
name = "apparmor-kernel-patches-${apparmor-version}";
166
166
-
src = apparmor-sources;
167
167
-
168
168
-
phases = ''unpackPhase installPhase'';
169
169
-
170
170
-
installPhase = ''
171
171
-
mkdir "$out"
172
172
-
cp -R ./kernel-patches "$out"
173
173
-
'';
174
174
-
175
175
-
meta = apparmor-meta "kernel patches";
176
176
-
};
177
177
-
178
178
-
in
179
179
-
180
180
-
{
181
181
-
inherit libapparmor apparmor-utils apparmor-parser apparmor-pam
182
182
-
apparmor-profiles apparmor-kernel-patches;
183
183
-
}
-16
pkgs/os-specific/linux/apparmor/capability.patch
reviewed
···
1
1
-
Description: allow parser to build even when not on Linux.
2
2
-
Author: Kees Cook <kees@debian.org>
3
3
-
4
4
-
Index: apparmor-debian/common/Make.rules
5
5
-
===================================================================
6
6
-
--- apparmor-debian.orig/common/Make.rules 2012-05-05 14:41:25.967259523 -0700
7
7
-
+++ apparmor-debian/common/Make.rules 2012-05-05 14:41:28.451291053 -0700
8
8
-
@@ -160,7 +160,7 @@
9
9
-
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)
10
10
-
11
11
-
.PHONY: list_capabilities
12
12
-
-list_capabilities: /usr/include/linux/capability.h
13
13
-
+list_capabilities:
14
14
-
@echo "$(CAPABILITIES)"
15
15
-
16
16
-
# =====================
+146
-77
pkgs/os-specific/linux/apparmor/default.nix
reviewed
···
1
1
-
{ stdenv, fetchurl
2
2
-
, autoconf, automake, libtool, makeWrapper
3
3
-
, perl, bison, flex, glibc, gettext, which, rpm, LocaleGettext
4
4
-
, bash, pam, TermReadKey, RpcXML, swig, python}:
5
5
-
stdenv.mkDerivation rec {
1
1
+
{ stdenv, fetchurl, makeWrapper, autoconf, autoreconfHook, automake, libtool, pkgconfig, perl, which
2
2
+
, glibc, flex, bison, python27Packages, swig, pam
3
3
+
}:
6
4
7
7
-
name = "apparmor-${version}";
8
8
-
version = "2.8.4";
5
5
+
let
6
6
+
apparmor-series = "2.10";
7
7
+
apparmor-version = apparmor-series;
9
8
10
10
-
src = fetchurl {
11
11
-
url = "http://launchpad.net/apparmor/2.8/${version}/+download/${name}.tar.gz";
12
12
-
sha256 = "1mki4c44ljmr7dpn55grzn33929kdjx149jx00s80yp1war83jwq";
9
9
+
apparmor-meta = component: with stdenv.lib; {
10
10
+
homepage = http://apparmor.net/;
11
11
+
description = "Linux application security system - ${component}";
12
12
+
license = licenses.gpl2;
13
13
+
maintainers = with maintainers; [ phreedom thoughtpolice joachifm ];
14
14
+
platforms = platforms.linux;
13
15
};
14
16
15
15
-
buildInputs = [
16
16
-
autoconf automake libtool perl bison flex gettext which rpm
17
17
-
LocaleGettext pam TermReadKey RpcXML swig makeWrapper python ];
17
17
+
apparmor-sources = fetchurl {
18
18
+
url = "https://launchpad.net/apparmor/${apparmor-series}/${apparmor-version}/+download/apparmor-${apparmor-version}.tar.gz";
19
19
+
sha256 = "1x06qmmbha9krx7880pxj2k3l8fxy3nm945xjjv735m2ax1243jd";
20
20
+
};
18
21
19
19
-
prePatch = ''
20
20
-
substituteInPlace libraries/libapparmor/src/Makefile.in --replace "/usr/include" "${glibc}/include"
21
21
-
substituteInPlace libraries/libapparmor/src/Makefile.am --replace "/usr/include" "${glibc}/include"
22
22
-
substituteInPlace common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man"
23
23
-
substituteInPlace common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html"
24
24
-
substituteInPlace common/Make.rules --replace "cpp -dM" "cpp -dM -I${glibc}/include"
22
22
+
prePatchCommon = ''
23
23
+
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man"
24
24
+
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html"
25
25
+
substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
26
26
+
substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
27
27
+
'';
28
28
+
29
29
+
libapparmor = stdenv.mkDerivation {
30
30
+
name = "libapparmor-${apparmor-version}";
31
31
+
src = apparmor-sources;
32
32
+
33
33
+
buildInputs = [
34
34
+
autoconf
35
35
+
automake
36
36
+
autoreconfHook
37
37
+
bison
38
38
+
flex
39
39
+
glibc
40
40
+
libtool
41
41
+
perl
42
42
+
pkgconfig
43
43
+
python27Packages.python
44
44
+
swig
45
45
+
which
46
46
+
];
47
47
+
48
48
+
# required to build apparmor-parser
49
49
+
dontDisableStatic = true;
50
50
+
51
51
+
prePatch = prePatchCommon + ''
52
52
+
substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${glibc}/include/netinet/in.h"
53
53
+
substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${glibc}/include/netinet/in.h"
54
54
+
'';
55
55
+
56
56
+
postPatch = "cd ./libraries/libapparmor";
57
57
+
configureFlags = "--with-python --with-perl";
58
58
+
59
59
+
meta = apparmor-meta "library";
60
60
+
};
61
61
+
62
62
+
apparmor-utils = stdenv.mkDerivation {
63
63
+
name = "apparmor-utils-${apparmor-version}";
64
64
+
src = apparmor-sources;
65
65
+
66
66
+
buildInputs = [
67
67
+
perl
68
68
+
python27Packages.python
69
69
+
python27Packages.readline
70
70
+
libapparmor
71
71
+
makeWrapper
72
72
+
which
73
73
+
];
74
74
+
75
75
+
prePatch = prePatchCommon;
76
76
+
postPatch = "cd ./utils";
77
77
+
makeFlags = ''LANGS='';
78
78
+
installFlags = ''DESTDIR=$(out) BINDIR=$(out)/bin VIM_INSTALL_PATH=$(out)/share PYPREFIX='';
79
79
+
80
80
+
postInstall = ''
81
81
+
for prog in aa-audit aa-autodep aa-cleanprof aa-complain aa-disable aa-enforce aa-genprof aa-logprof aa-mergeprof aa-status aa-unconfined ; do
82
82
+
wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python27Packages.python.libPrefix}/site-packages:$PYTHONPATH"
83
83
+
done
84
84
+
85
85
+
for prog in aa-exec aa-notify ; do
86
86
+
wrapProgram $out/bin/$prog --prefix PERL5LIB : "${libapparmor}/lib/perl5:$PERL5LIB"
87
87
+
done
88
88
+
'';
89
89
+
90
90
+
meta = apparmor-meta "user-land utilities";
91
91
+
};
92
92
+
93
93
+
apparmor-parser = stdenv.mkDerivation {
94
94
+
name = "apparmor-parser-${apparmor-version}";
95
95
+
src = apparmor-sources;
96
96
+
97
97
+
buildInputs = [
98
98
+
libapparmor
99
99
+
bison
100
100
+
flex
101
101
+
which
102
102
+
];
25
103
26
26
-
substituteInPlace parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison"
27
27
-
substituteInPlace parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex"
28
28
-
substituteInPlace parser/Makefile --replace "/usr/include/bits/socket.h" "${glibc}/include/bits/socket.h"
29
29
-
substituteInPlace parser/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
30
30
-
#substituteInPlace parser/utils/vim/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
104
104
+
prePatch = prePatchCommon + ''
105
105
+
substituteInPlace ./parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison"
106
106
+
substituteInPlace ./parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex"
107
107
+
substituteInPlace ./parser/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
108
108
+
## techdoc.pdf still doesn't build ...
109
109
+
substituteInPlace ./parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
110
110
+
'';
111
111
+
postPatch = "cd ./parser";
112
112
+
makeFlags = ''LANGS= USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include'';
113
113
+
installFlags = ''DESTDIR=$(out) DISTRO=unknown'';
31
114
32
32
-
# for some reason pdf documentation doesn't build
33
33
-
substituteInPlace parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
115
115
+
meta = apparmor-meta "rule parser";
116
116
+
};
34
117
35
35
-
substituteInPlace parser/tst/gen-xtrans.pl --replace "/usr/bin/perl" "${perl}/bin/perl"
36
36
-
substituteInPlace parser/tst/Makefile --replace "/usr/bin/prove" "${perl}/bin/prove"
37
37
-
substituteInPlace parser/tst/Makefile --replace "./caching.sh" "${bash}/bin/bash ./caching.sh"
38
38
-
'';
118
118
+
apparmor-pam = stdenv.mkDerivation {
119
119
+
name = "apparmor-pam-${apparmor-version}";
120
120
+
src = apparmor-sources;
39
121
40
40
-
patches = ./capability.patch;
122
122
+
buildInputs = [
123
123
+
libapparmor
124
124
+
pam
125
125
+
pkgconfig
126
126
+
which
127
127
+
];
41
128
42
42
-
buildPhase =''
43
43
-
PERL5LIB=$PERL5LIB:$out/lib/perl5/site_perl:$out/lib
129
129
+
postPatch = "cd ./changehat/pam_apparmor";
130
130
+
makeFlags = ''USE_SYSTEM=1'';
131
131
+
installFlags = ''DESTDIR=$(out)'';
44
132
45
45
-
cd libraries/libapparmor
46
46
-
./autogen.sh
47
47
-
./configure --prefix=$out --with-perl # see below
48
48
-
make
49
49
-
make check
50
50
-
make install
51
51
-
mkdir -p $out/lib/perl5/site_perl/
52
52
-
cp swig/perl/LibAppArmor.pm $out/lib/perl5/site_perl/
53
53
-
cp swig/perl/LibAppArmor.bs $out/lib/perl5/site_perl/
54
54
-
# this is automatically copied elsewhere....
133
133
+
meta = apparmor-meta "PAM service";
134
134
+
};
55
135
56
56
-
cd ../../utils
57
57
-
make
58
58
-
make install DESTDIR=$out BINDIR=$out/bin VENDOR_PERL=/lib/perl5/site_perl
136
136
+
apparmor-profiles = stdenv.mkDerivation {
137
137
+
name = "apparmor-profiles-${apparmor-version}";
138
138
+
src = apparmor-sources;
59
139
60
60
-
cd ../parser
61
61
-
make
62
62
-
make install DESTDIR=$out DISTRO=unknown
140
140
+
buildInputs = [ which ];
63
141
64
64
-
# cd ../changehat/mod_apparmor
65
65
-
# make # depends on libapparmor having been built first
66
66
-
# make install
142
142
+
postPatch = "cd ./profiles";
143
143
+
installFlags = ''DESTDIR=$(out) EXTRAS_DEST=$(out)/share/apparmor/extra-profiles'';
67
144
68
68
-
cd ../changehat/pam_apparmor
69
69
-
make # depends on libapparmor having been built first
70
70
-
make install DESTDIR=$out
145
145
+
meta = apparmor-meta "profiles";
146
146
+
};
71
147
72
72
-
cd ../../profiles
73
73
-
LD_LIBRARY_PATH=$out/lib make
74
74
-
#LD_LIBRARY_PATH=$out/lib make check # depends on the parser having been built first
75
75
-
make install DESTDIR=$out
148
148
+
apparmor-kernel-patches = stdenv.mkDerivation {
149
149
+
name = "apparmor-kernel-patches-${apparmor-version}";
150
150
+
src = apparmor-sources;
76
151
77
77
-
cd ..
78
78
-
cp -r kernel-patches $out
79
79
-
'';
152
152
+
phases = ''unpackPhase installPhase'';
80
153
81
81
-
installPhase = let
82
82
-
perlVersion = (builtins.parseDrvName perl.name).version;
83
83
-
in ''
84
84
-
for i in $out/bin/*; do
85
85
-
wrapProgram $i --prefix PERL5LIB : \
86
86
-
"$PERL5LIB:$out/lib/perl5/${perlVersion}/${stdenv.system}-thread-multi/"
87
87
-
done
88
88
-
'';
154
154
+
installPhase = ''
155
155
+
mkdir "$out"
156
156
+
cp -R ./kernel-patches "$out"
157
157
+
'';
89
158
90
90
-
meta = with stdenv.lib; {
91
91
-
homepage = http://apparmor.net/;
92
92
-
description = "Linux application security system";
93
93
-
license = licenses.gpl2;
94
94
-
maintainers = [ maintainers.phreedom maintainers.thoughtpolice ];
95
95
-
platforms = platforms.linux;
159
159
+
meta = apparmor-meta "kernel patches";
96
160
};
97
97
-
}
161
161
+
162
162
+
in
98
163
164
164
+
{
165
165
+
inherit libapparmor apparmor-utils apparmor-parser apparmor-pam
166
166
+
apparmor-profiles apparmor-kernel-patches;
167
167
+
}
+6
-12
pkgs/top-level/all-packages.nix
reviewed
···
9291
9291
9292
9292
microcodeIntel = callPackage ../os-specific/linux/microcode/intel.nix { };
9293
9293
9294
9294
-
apparmor = callPackage ../os-specific/linux/apparmor {
9295
9295
-
inherit (perlPackages) LocaleGettext TermReadKey RpcXML;
9296
9296
-
bison = bison2;
9297
9297
-
perl = perl516; # ${perl}/.../CORE/handy.h:124:34: error: 'bool' undeclared
9298
9298
-
};
9299
9299
-
9300
9300
-
apparmor_2_9 = callPackage ../os-specific/linux/apparmor/2.9 { };
9301
9301
-
libapparmor = apparmor_2_9.libapparmor;
9302
9302
-
apparmor-pam = apparmor_2_9.apparmor-pam;
9303
9303
-
apparmor-parser = apparmor_2_9.apparmor-parser;
9304
9304
-
apparmor-profiles = apparmor_2_9.apparmor-profiles;
9305
9305
-
apparmor-utils = apparmor_2_9.apparmor-utils;
9294
9294
+
apparmor = callPackage ../os-specific/linux/apparmor { swig = swig2; };
9295
9295
+
libapparmor = apparmor.libapparmor;
9296
9296
+
apparmor-pam = apparmor.apparmor-pam;
9297
9297
+
apparmor-parser = apparmor.apparmor-parser;
9298
9298
+
apparmor-profiles = apparmor.apparmor-profiles;
9299
9299
+
apparmor-utils = apparmor.apparmor-utils;
9306
9300
9307
9301
atop = callPackage ../os-specific/linux/atop { };
9308
9302