Browse code

Add apparmor package

Changes include
1. Updated gcc package to include libstdc++ static libs.
2. Apparmor package.
3. Updated docker spec file to include apparmor during build.

Change-Id: Ia1cf31369f7448bb9bb9d40a198a352a4b622a17
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5391
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

Keerthana K authored on 2018/07/24 02:49:18
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,363 @@
0
+Name:           apparmor
1
+Version:        2.13
2
+Release:        1%{?dist}
3
+Summary:        AppArmor is an effective and easy-to-use Linux application security system.
4
+License:        GNU LGPL v2.1
5
+URL:            https://launchpad.net/apparmor
6
+Source0:        https://launchpad.net/apparmor/2.13/2.13.0/+download/%{name}-%{version}.tar.gz
7
+%define sha1    apparmor=54202cafce24911c45141d66e2d1e037e8aa5746
8
+Vendor:         VMware, Inc.
9
+Distribution:   Photon
10
+Group:          Productivity/Security
11
+BuildRequires:  python3
12
+BuildRequires:  python3-devel
13
+BuildRequires:  python3-libs
14
+BuildRequires:  ruby
15
+BuildRequires:  swig
16
+BuildRequires:  make
17
+BuildRequires:  gawk
18
+BuildRequires:  which
19
+BuildRequires:  libstdc++
20
+BuildRequires:  libstdc++-devel
21
+BuildRequires:  gcc
22
+BuildRequires:  libgcc
23
+BuildRequires:  libgcc-devel
24
+BuildRequires:  glibc
25
+BuildRequires:  glibc-devel
26
+BuildRequires:  autoconf
27
+BuildRequires:  automake
28
+BuildRequires:  libtool
29
+BuildRequires:  httpd
30
+BuildRequires:  httpd-devel
31
+BuildRequires:  httpd-tools
32
+BuildRequires:  apr
33
+BuildRequires:  apr-util-devel
34
+BuildRequires:  Linux-PAM
35
+BuildRequires:  Linux-PAM-devel
36
+
37
+%global debug_package %{nil}
38
+
39
+%description
40
+AppArmor is a file and network mandatory access control
41
+mechanism. AppArmor confines processes to the resources allowed by the
42
+systems administrator and can constrain the scope of potential security
43
+vulnerabilities.
44
+
45
+%package -n libapparmor
46
+Summary:    Utility library for AppArmor
47
+License:    GNU LGPL v2.1
48
+Group:      Development/Libraries/C and C++
49
+
50
+%description -n libapparmor
51
+This package contains the AppArmor library.
52
+
53
+%package -n libapparmor-devel
54
+Summary:    Development headers and libraries for libapparmor
55
+License:    GNU LGPL v2.1
56
+Group:      Development/Libraries/C and C++
57
+Requires:   libapparmor = %{version}-%{release}
58
+
59
+%description -n libapparmor-devel
60
+This package contains development files for libapparmor.
61
+
62
+%package -n apache2-mod_apparmor
63
+Summary:    AppArmor module for apache2
64
+License:    GNU LGPL v2.1
65
+Group:      Productivity/Security
66
+
67
+%description -n apache2-mod_apparmor
68
+This provides the Apache module needed to declare various differing
69
+confinement policies when running virtual hosts in the webserver
70
+by using the changehat abilities exposed through libapparmor.
71
+
72
+%package profiles
73
+Summary:    AppArmor profiles that are loaded into the apparmor kernel module
74
+License:    GNU LGPL v2.1
75
+Group:      Productivity/Security
76
+Requires:   apparmor-parser = %{version}-%{release}
77
+
78
+%description profiles
79
+This package contains the basic AppArmor profiles.
80
+
81
+%package parser
82
+Summary:    AppArmor userlevel parser utility
83
+License:    GNU LGPL v2.1
84
+Group:      Productivity/Security
85
+Requires:   libapparmor = %{version}-%{release}
86
+
87
+%description parser
88
+The AppArmor Parser is a userlevel program that is used to load in
89
+program profiles to the AppArmor Security kernel module.
90
+This package is part of a suite of tools that used to be named
91
+SubDomain.
92
+
93
+%package abstractions
94
+Summary:    AppArmor abstractions and directory structure
95
+License:    GNU LGPL v2.1
96
+Group:      Productivity/Security
97
+Requires:   apparmor-parser = %{version}-%{release}
98
+
99
+%description abstractions
100
+AppArmor abstractions (common parts used in various profiles) and
101
+the /etc/apparmor.d/ directory structure.
102
+
103
+%package -n pam_apparmor
104
+Summary:    PAM module for AppArmor change_hat
105
+License:    GNU LGPL v2.1
106
+Group:      Productivity/Security
107
+Requires:   Linux-PAM
108
+Requires:   Linux-PAM-devel
109
+
110
+%description -n pam_apparmor
111
+The pam_apparmor module provides the means for any PAM applications
112
+that call pam_open_session() to automatically perform an AppArmor
113
+change_hat operation in order to switch to a user-specific security
114
+policy.
115
+
116
+%package utils
117
+Summary:    AppArmor User-Level Utilities Useful for Creating AppArmor Profiles
118
+License:    GNU LGPL v2.1
119
+Group:      Productivity/Security
120
+Requires:   libapparmor = %{version}-%{release}
121
+Requires:   audit
122
+
123
+%description utils
124
+This package contains programs to help create and manage AppArmor
125
+profiles.
126
+
127
+%package -n python3-apparmor
128
+Summary:    Python 3 interface for libapparmor functions
129
+License:    GNU LGPL v2.1
130
+Group:      Development/Libraries/Python
131
+Requires:   libapparmor = %{version}-%{release}
132
+Requires:   python3
133
+
134
+%description -n python3-apparmor
135
+This package provides the python3 interface to AppArmor. It is used for python
136
+applications interfacing with AppArmor.
137
+
138
+%package -n perl-apparmor
139
+Summary:    AppArmor module for perl.
140
+License:    GNU LGPL v2.1
141
+Group:      Development/Libraries/Perl
142
+Requires:   libapparmor = %{version}-%{release}
143
+
144
+%description -n perl-apparmor
145
+This package contains the AppArmor module for perl.
146
+
147
+%package -n ruby-apparmor
148
+Summary:    Ruby interface for libapparmor functions
149
+License:    GNU LGPL v2.1
150
+Group:      Development/Languages/Ruby
151
+Requires:   libapparmor = %{version}-%{release}
152
+Requires:   ruby
153
+
154
+%description -n ruby-apparmor
155
+This package provides the ruby interface to AppArmor. It is used for ruby
156
+applications interfacing with AppArmor.
157
+
158
+%prep
159
+%setup -q -n %{name}-%{version}
160
+
161
+%build
162
+export PYTHONPATH=/usr/lib/python3.6/site-packages
163
+export PYTHON=/usr/bin/python3
164
+export PYTHON_VERSION=3.6
165
+export PYTHON_VERSIONS=python3
166
+#Building libapparmor
167
+cd ./libraries/libapparmor
168
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/"
169
+/sbin/ldconfig
170
+sh ./autogen.sh
171
+./configure \
172
+    --prefix=%{_prefix} \
173
+    --bindir=%{_bindir} \
174
+    --libdir=%{_libdir} \
175
+    --sysconfdir=/etc   \
176
+    --with-perl         \
177
+    --with-python       \
178
+    --with-ruby
179
+make %{?_smp_mflags}
180
+#Building Binutils
181
+cd ../../binutils/
182
+make %{?_smp_mflags}
183
+#Building parser
184
+cd ../parser
185
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/"
186
+export LIBRARY_PATH="$LIBRARY_PATH:/usr/lib"
187
+echo $LD_LIBRARY_PATH
188
+echo $LIBRARY_PATH
189
+make %{?_smp_mflags}
190
+#Building Utilities
191
+cd ../utils
192
+make %{?_smp_mflags}
193
+#Building Apache mod_apparmor
194
+cd ../changehat/mod_apparmor
195
+make %{?_smp_mflags}
196
+#Building PAM AppArmor
197
+cd ../pam_apparmor
198
+make %{?_smp_mflags}
199
+#Building Profiles
200
+cd ../../profiles
201
+make %{?_smp_mflags}
202
+
203
+
204
+%check
205
+make check -C libraries/libapparmor
206
+make check -C binutils
207
+make check -C parser
208
+make check -C utils
209
+make check -C changehat/mod_apparmor
210
+make check -C pam_apparmor
211
+make check -C profiles
212
+
213
+%install
214
+export PYTHONPATH=/usr/lib/python3.6/site-packages
215
+export PYTHON=/usr/bin/python3
216
+export PYTHON_VERSION=3.6
217
+export PYTHON_VERSIONS=python3
218
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/"
219
+cd libraries/libapparmor
220
+make DESTDIR=%{buildroot} install
221
+cd ../../binutils/
222
+make DESTDIR=%{buildroot} install
223
+cd ../parser
224
+make DESTDIR=%{buildroot} install
225
+cd ../utils
226
+make DESTDIR=%{buildroot} install
227
+cd ../changehat/mod_apparmor
228
+make DESTDIR=%{buildroot} install
229
+cd ../pam_apparmor
230
+make DESTDIR=%{buildroot} install
231
+cd ../../profiles
232
+make DESTDIR=%{buildroot} install
233
+
234
+
235
+%files -n libapparmor
236
+%defattr(-,root,root)
237
+%{_libdir}/libapparmor.so.*
238
+
239
+%files -n libapparmor-devel
240
+%defattr(-,root,root)
241
+%{_libdir}/libapparmor.a
242
+%{_libdir}/libapparmor.la
243
+%{_libdir}/libapparmor.so
244
+%{_libdir}/pkgconfig/libapparmor.pc
245
+%dir %{_includedir}/aalogparse
246
+%dir %{_includedir}/sys
247
+%{_includedir}/aalogparse/*
248
+%{_includedir}/sys/*
249
+%doc %{_mandir}/man2/aa_change_hat.2.gz
250
+%doc %{_mandir}/man2/aa_find_mountpoint.2.gz
251
+%doc %{_mandir}/man2/aa_getcon.2.gz
252
+%doc %{_mandir}/man2/aa_query_label.2.gz
253
+%doc %{_mandir}/man3/aa_features.3.gz
254
+%doc %{_mandir}/man3/aa_kernel_interface.3.gz
255
+%doc %{_mandir}/man3/aa_policy_cache.3.gz
256
+%doc %{_mandir}/man3/aa_splitcon.3.gz
257
+
258
+%files -n apache2-mod_apparmor
259
+%defattr(-,root,root)
260
+%{_libdir}/httpd/modules/mod_apparmor.so
261
+%doc %{_mandir}/man8/mod_apparmor.8.gz
262
+
263
+%files profiles
264
+%defattr(-,root,root,755)
265
+%dir %{_sysconfdir}/apparmor.d/apache2.d
266
+%{_sysconfdir}/apparmor.d/apache2.d/phpsysinfo
267
+%{_sysconfdir}/apparmor.d/bin.*
268
+%{_sysconfdir}/apparmor.d/sbin.*
269
+%{_sysconfdir}/apparmor.d/usr.*
270
+%{_sysconfdir}/apparmor.d/local/*
271
+%dir %{_datadir}/apparmor
272
+%{_datadir}/apparmor/extra-profiles/*
273
+
274
+%files parser
275
+%defattr(755,root,root,755)
276
+/sbin/apparmor_parser
277
+/sbin/rcapparmor
278
+/lib/apparmor/rc.apparmor.functions
279
+/lib/apparmor/apparmor.systemd
280
+%{_bindir}/aa-exec
281
+%{_bindir}/aa-enabled
282
+%{_prefix}%{_unitdir}/apparmor.service
283
+%dir %{_sysconfdir}/apparmor
284
+%{_sysconfdir}/apparmor/parser.conf
285
+%{_sysconfdir}/apparmor/subdomain.conf
286
+%{_localstatedir}/lib/apparmor
287
+%doc %{_mandir}/man5/apparmor.d.5.gz
288
+%doc %{_mandir}/man5/apparmor.vim.5.gz
289
+%doc %{_mandir}/man5/subdomain.conf.5.gz
290
+%doc %{_mandir}/man7/apparmor.7.gz
291
+%doc %{_mandir}/man8/apparmor_parser.8.gz
292
+%doc %{_mandir}/man1/aa-enabled.1.gz
293
+%doc %{_mandir}/man1/aa-exec.1.gz
294
+%doc %{_mandir}/man2/aa_stack_profile.2.gz
295
+
296
+%post parser
297
+/sbin/ldconfig
298
+
299
+%preun parser
300
+/sbin/ldconfig
301
+
302
+%files abstractions
303
+%defattr(644,root,root,755)
304
+%dir %{_sysconfdir}/apparmor.d/
305
+%dir %{_sysconfdir}/apparmor.d/abstractions
306
+%{_sysconfdir}/apparmor.d/abstractions/*
307
+%dir %{_sysconfdir}/apparmor.d/disable
308
+%dir %{_sysconfdir}/apparmor.d/local
309
+%dir %{_sysconfdir}/apparmor.d/tunables
310
+%{_sysconfdir}/apparmor.d/tunables/*
311
+%exclude %{_datadir}/locale
312
+
313
+%files utils
314
+%defattr(-,root,root)
315
+%dir %{_sysconfdir}/apparmor
316
+%{_sysconfdir}/apparmor/easyprof.conf
317
+%{_sysconfdir}/apparmor/logprof.conf
318
+%{_sysconfdir}/apparmor/notify.conf
319
+%{_sysconfdir}/apparmor/severity.db
320
+/sbin/aa-teardown
321
+%{_sbindir}/aa-*
322
+%{_sbindir}/apparmor_status
323
+%{_bindir}/aa-easyprof
324
+%{_datadir}/apparmor/easyprof/
325
+%dir %{_datadir}/apparmor
326
+%{_datadir}/apparmor/apparmor.vim
327
+%doc %{_mandir}/man2/aa_change_profile.2.gz
328
+%doc %{_mandir}/man5/logprof.conf.5.gz
329
+%doc %{_mandir}/man8/aa-*.gz
330
+%doc %{_mandir}/man8/apparmor_status.8.gz
331
+
332
+%files -n pam_apparmor
333
+%defattr(-,root,root,755)
334
+/lib/security/pam_apparmor.so
335
+
336
+%files -n python3-apparmor
337
+%defattr(-,root,root)
338
+%dir %{_libdir}/python3.6/site-packages/LibAppArmor
339
+%dir %{_libdir}/python3.6/site-packages/LibAppArmor/__pycache__
340
+%{_libdir}/python3.6/site-packages/LibAppArmor/_LibAppArmor.cpython-*.so
341
+%{_libdir}/python3.6/site-packages/LibAppArmor/__pycache__/__init__.cpython-*.pyc
342
+%{_libdir}/python3.6/site-packages/LibAppArmor/__pycache__/LibAppArmor.cpython-*.pyc
343
+%{_libdir}/python3.6/site-packages/LibAppArmor/__init__.py
344
+%{_libdir}/python3.6/site-packages/LibAppArmor/LibAppArmor.py
345
+%{_libdir}/python3.6/site-packages/LibAppArmor-%{version}-py*.egg-info
346
+%{_libdir}/python3.6/site-packages/apparmor-%{version}-py*.egg-info
347
+%dir %{_libdir}/python3.6/site-packages/apparmor
348
+%{_libdir}/python3.6/site-packages/apparmor/*
349
+
350
+%files -n perl-apparmor
351
+%defattr(-,root,root)
352
+%{perl_vendorarch}/auto/LibAppArmor/
353
+%{perl_vendorarch}/LibAppArmor.pm
354
+%exclude %{_libdir}/perl5/5.24.1/x86_64-linux-thread-multi/perllocal.pod
355
+
356
+%files -n ruby-apparmor
357
+%defattr(-,root,root)
358
+%{_libdir}/ruby/site_ruby/2.4.0/x86_64-linux/LibAppArmor.so
359
+
360
+%changelog
361
+*   Thu Jul 19 2018 Keerthana K <keerthanak@vmware.com> 2.13-1
362
+-   Initial Apparmor package for Photon.
... ...
@@ -4,7 +4,7 @@
4 4
 Summary:        Docker
5 5
 Name:           docker
6 6
 Version:        17.06.0
7
-Release:        4%{?dist}
7
+Release:        5%{?dist}
8 8
 License:        ASL 2.0
9 9
 URL:            http://docs.docker.com
10 10
 Group:          Applications/File
... ...
@@ -43,6 +43,9 @@ BuildRequires:  sed
43 43
 BuildRequires:  cmake
44 44
 BuildRequires:  findutils
45 45
 BuildRequires:  git
46
+BuildRequires:  libapparmor
47
+BuildRequires:  libapparmor-devel
48
+Requires:       libapparmor
46 49
 Requires:       libltdl
47 50
 Requires:       libgcc
48 51
 Requires:       glibc
... ...
@@ -100,8 +103,8 @@ git config --global http.proxy http://localhost:0
100 100
 export GOPATH="/go"
101 101
 export PATH="$PATH:$GOPATH/bin"
102 102
 
103
-export DOCKER_BUILDTAGS="pkcs11 seccomp exclude_graphdriver_aufs"
104
-export RUNC_BUILDTAGS="seccomp"
103
+export DOCKER_BUILDTAGS="pkcs11 seccomp apparmor exclude_graphdriver_aufs"
104
+export RUNC_BUILDTAGS="seccomp apparmor"
105 105
 
106 106
 cd /go/src/github.com
107 107
 
... ...
@@ -220,6 +223,8 @@ rm -rf %{buildroot}/*
220 220
 %{_datadir}/vim/vimfiles/syntax/dockerfile.vim
221 221
 
222 222
 %changelog
223
+*   Wed Jul 25 2018 Keerthana K <keerthanak@vmware.com> 17.06.0-5
224
+-   Updated BuildTags to include apparmor.
223 225
 *   Fri Sep 22 2017 Bo Gan <ganb@vmware.com> 17.06.0-4
224 226
 -   disable docker service by default
225 227
 *   Fri Sep 08 2017 Bo Gan <ganb@vmware.com> 17.06.0-3
... ...
@@ -2,7 +2,7 @@
2 2
 Summary:        Contains the GNU compiler collection
3 3
 Name:           gcc
4 4
 Version:        6.3.0
5
-Release:        6%{?dist}
5
+Release:        7%{?dist}
6 6
 License:        GPLv2+
7 7
 URL:            http://gcc.gnu.org
8 8
 Group:          Development/Tools
... ...
@@ -237,9 +237,11 @@ make %{?_smp_mflags} check-gcc
237 237
 %ifarch x86_64
238 238
 %{_lib64dir}/libstdc++.so
239 239
 %{_lib64dir}/libstdc++.la
240
+%{_lib64dir}/libstdc++.a
240 241
 %else
241 242
 %{_libdir}/libstdc++.so
242 243
 %{_libdir}/libstdc++.la
244
+%{_libdir}/libstdc++.a
243 245
 %endif
244 246
 
245 247
 %{_includedir}/c++/*
... ...
@@ -267,6 +269,8 @@ make %{?_smp_mflags} check-gcc
267 267
 %endif
268 268
 
269 269
 %changelog
270
+*   Fri Jul 20 2018 Keerthana K <keerthanak@vmware.com> 6.3.0-7
271
+-   Packaging .a files (libstdc++-static files).
270 272
 *   Mon Oct 02 2017 Alexey Makhalov <amakhalov@vmware.com> 6.3.0-6
271 273
 -   Added smp_mflags for parallel build
272 274
 *   Mon Sep 25 2017 Alexey Makhalov <amakhalov@vmware.com> 6.3.0-5