summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/etc/apparmor.d/usr.bin.icedove
blob: 8fa892faf98179d44ee7758e4c06cb314441d68b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# vim:syntax=apparmor
# Author: Simon Deziel <simon.deziel at gmail_com>
# This apparmor profile is derived from firefox profile
# by Jamie Strandboge <jamie@canonical.com>

# Declare an apparmor variable to help with overrides
@{MOZ_LIBDIR}=/usr/lib/icedove

#include <tunables/global>

profile icedove /usr/lib/icedove/icedove {
  #include <abstractions/audio>
  #include <abstractions/aspell>
  #include <abstractions/cups-client>
  # TODO: finetune this for required accesses
  #include <abstractions/dbus>
  #include <abstractions/dbus-accessibility>
  #include <abstractions/dbus-session>
  #include <abstractions/gnome>
  #include <abstractions/ibus>
  #include <abstractions/nameservice>
  #include <abstractions/p11-kit>
  #include <abstractions/private-files>
  #include <abstractions/ssl_certs>
  #include <abstractions/ubuntu-browsers>
  #include <abstractions/ubuntu-helpers>

  # for crash reports?
  ptrace (read,trace) peer=@{profile_name},

  # Pulseaudio
  /usr/bin/pulseaudio Pixr,

  owner @{HOME}/.{cache,config}/dconf/user rw,
  owner /run/user/[0-9]*/dconf/user rw,
  owner @{HOME}/.config/gtk-3.0/bookmarks r,
  deny owner @{HOME}/.local/share/gvfs-metadata/* r,

  # potentially extremely sensitive files
  audit deny @{HOME}/.gnupg/** mrwkl,
  audit deny @{HOME}/.ssh/** mrwkl,

  # rw access to HOME is useful when sending/receiving attachments
  owner @{HOME}/** rw,

  # Required for LVM setups
  /sys/devices/virtual/block/dm-[0-9]*/uevent r,

  # Addons (too lax for icedove)
  ##include <abstractions/ubuntu-browsers.d/firefox>

  # for networking
  network inet stream,
  network inet6 stream,
  @{PROC}/[0-9]*/net/if_inet6 r,
  @{PROC}/[0-9]*/net/ipv6_route r,
  @{PROC}/[0-9]*/net/dev r,
  @{PROC}/[0-9]*/net/wireless r,

  # should maybe be in abstractions
  /etc/ r,
  /etc/mime.types r,
  /etc/mailcap r,
  /etc/xdg/*buntu/applications/defaults.list    r, # for all derivatives
  /etc/xfce4/defaults.list r,
  /usr/share/xubuntu/applications/defaults.list r,
  owner @{HOME}/.local/share/applications/defaults.list r,
  owner @{HOME}/.local/share/applications/mimeapps.list r,
  owner @{HOME}/.local/share/applications/mimeinfo.cache r,
  owner /tmp/** m,
  owner /var/tmp/** m,
  /tmp/.X[0-9]*-lock r,
  /etc/udev/udev.conf r,
  # Doesn't seem to be required, but noisy. Maybe allow 'r' for 'b*' if needed.
  # Possibly move to an abstraction if anything else needs it.
  deny /run/udev/data/** r,

  /etc/timezone r,
  /etc/wildmidi/wildmidi.cfg r,

  # icedove specific
  /etc/icedove/ r,
  /etc/icedove/** r,
  /etc/xul-ext/** r,
  /etc/xulrunner-2.0*/ r,
  /etc/xulrunner-2.0*/** r,
  /etc/gre.d/ r,
  /etc/gre.d/* r,

  # noisy
  deny @{MOZ_LIBDIR}/** w,
  deny /usr/lib/icedove-addons/** w,
  deny /usr/lib/xulrunner-addons/** w,
  deny /usr/lib/xulrunner-*/components/*.tmp w,
  deny /.suspended r,
  deny /boot/initrd.img* r,
  deny /boot/vmlinuz* r,
  deny /var/cache/fontconfig/ w,
  deny @{HOME}/.local/share/recently-used.xbel r,
  deny @{HOME}/.* r,

  # TODO: investigate
  deny /usr/bin/gconftool-2 x,

  owner @{PROC}/[0-9]*/mountinfo r,
  owner @{PROC}/[0-9]*/stat r,
  owner @{PROC}/[0-9]*/task/[0-9]*/stat r,
  /sys/devices/pci[0-9]*/**/uevent r,
  /etc/mtab r,
  /etc/fstab r,

  # Needed for the crash reporter
  owner @{PROC}/[0-9]*/environ r,
  owner @{PROC}/[0-9]*/auxv r,
  /etc/lsb-release r,
  /usr/bin/expr ix,
  /sys/devices/system/cpu/ r,
  /sys/devices/system/cpu/** r,

  # about:memory
  owner @{PROC}/[0-9]*/statm r,
  owner @{PROC}/[0-9]*/smaps r,

  # Needed for container to work in xul builds
  /usr/lib/xulrunner-*/plugin-container ixr,

  # allow access to documentation and other files the user may want to look
  # at in /usr and /opt
  /usr/ r,
  /usr/** r,
  /opt/ r,
  /opt/** r,

  # so browsing directories works
  / r,
  /**/ r,

  # per-user icedove configuration
  owner @{HOME}/.icedove/ rw,
  owner @{HOME}/.icedove/** rw,
  owner @{HOME}/.icedove/**/storage.sdb k,
  owner @{HOME}/.icedove/**/*.{db,parentlock,sqlite}* k,
  owner @{HOME}/.icedove/plugins/** rm,
  owner @{HOME}/.icedove/**/plugins/** rm,
  owner @{HOME}/.cache/icedove/ rw,
  owner @{HOME}/.cache/icedove/** rw,

  #
  # Extensions
  # /usr/share/.../extensions/... is already covered by '/usr/** r', above.
  # Allow 'x' for downloaded extensions, but inherit policy for safety
  owner @{HOME}/.icedove/**/extensions/** mixrw,
  owner @{HOME}/.mozilla/extensions/**        mixr,
  /usr/share/xul-ext/**/*.sqlite              rk,
  /usr/lib/xul-ext/**/*.sqlite                rk,
  /usr/lib/icedove-addons/extensions/**/*.sqlite rk,

  deny @{MOZ_LIBDIR}/update.test w,
  deny /usr/lib/mozilla/extensions/**/ w,
  deny /usr/lib/xulrunner-addons/extensions/**/ w,
  deny /usr/share/mozilla/extensions/**/ w,
  deny /usr/share/mozilla/ w,

  # Miscellaneous (to be abstracted)
  # Ideally these would use a child profile. They are all ELF executables
  # so running with 'Ux', while not ideal, is ok because we will at least
  # benefit from glibc's secure execute.
  /usr/bin/mkfifo Uxr,  # investigate
  /bin/ps Uxr,
  /bin/uname Uxr,
  /usr/bin/locale Uxr,

  /usr/bin/gpg Cx -> gpg,

  profile gpg {
    #include <abstractions/base>

    # Required to import keys from keyservers
    #include <abstractions/nameservice>
    #include <abstractions/p11-kit>

    # For smartcards?
    /dev/bus/usb/ r,
    /dev/bus/usb/[0-9]*/ r,
    /dev/bus/usb/[0-9]*/[0-9]* r,

    # LDAP key servers
    /etc/ldap/ldap.conf r,

    /usr/bin/gpg mr,
    /usr/lib/gnupg/gpgkeys_* ix,
    owner @{HOME}/.gnupg r,
    owner @{HOME}/.gnupg/gpg.conf r,
    owner @{HOME}/.gnupg/random_seed rwk,
    owner @{HOME}/.gnupg/pubring.gpg{,~} rw,
    owner @{HOME}/.gnupg/secring.gpg rw,
    owner @{HOME}/.gnupg/trustdb.gpg rw,
    owner @{HOME}/.gnupg/*.gpg.{lock,tmp} rwl,
    owner @{HOME}/.gnupg/.#*[0-9]  rw,
    owner @{HOME}/.gnupg/.#*[0-9]x rwl,
    owner @{HOME}/** r,

    owner /run/user/[0-9]*/keyring-*/gpg rw,

    # for inline pgp
    owner /tmp/encfile rw,
    owner /tmp/encfile-[0-9]* rw,
  }

  /usr/bin/gpg2              Cx -> gpg2,
  /usr/bin/gpgconf           Cx -> gpg2,
  /usr/bin/gpg-connect-agent Cx -> gpg2,

  # TB tries to create this file but has no business doing so
  deny @{HOME}/.gnupg/gpg-agent.conf w,

  profile gpg2 {
    #include <abstractions/base>

    # Required to import keys from keyservers
    #include <abstractions/nameservice>
    #include <abstractions/p11-kit>
    /usr/lib/gnupg2/gpg2keys_hkp ix,

    # silence noise from enigmail 1.9+
    deny owner @{HOME}/.icedove/*/.parentlock w,
    deny owner @{HOME}/.icedove/*/panacea.dat w,
    deny owner @{HOME}/.icedove/*/*.mab w,
    deny owner @{HOME}/.icedove/**/*.msf w,
    deny owner @{HOME}/.cache/icedove/**/_CACHE_* w,

    # For smartcards?
    /dev/bus/usb/ r,
    /dev/bus/usb/[0-9]*/ r,
    /dev/bus/usb/[0-9]*/[0-9]* r,

    # LDAP key servers
    /etc/ldap/ldap.conf r,

    /usr/bin/gpg-connect-agent mr,
    owner @{HOME}/.gnupg/S.gpg-agent rw,
    owner @{HOME}/.gnupg/S.dirmngr rw,

    /usr/bin/gpg2 mr,
    owner @{HOME}/.gnupg/ rw,
    owner @{HOME}/.gnupg/gpg.conf r,
    owner @{HOME}/.gnupg/random_seed rwk,
    owner @{HOME}/.gnupg/pubring.gpg{,~} rw,
    owner @{HOME}/.gnupg/secring.gpg rw,
    owner @{HOME}/.gnupg/trustdb.gpg rw,
    owner @{HOME}/.gnupg/*.gpg.{lock,tmp} rwl,
    owner @{HOME}/.gnupg/.gpg-*.lock rwl,
    owner @{HOME}/.gnupg/gnupg_spawn_*.lock rwl,
    owner @{HOME}/.gnupg/.#lk0x[0-9a-f]* rwl,
    owner @{HOME}/.gnupg/.gpg-v[0-9]*-migrated rw,
    owner @{HOME}/** r,
    owner @{PROC}/@{pids}/mountinfo r,

    # for inline pgp
    owner /tmp/encfile rw,
    owner /tmp/encfile-[0-9]* rw,

    # for signature generation
    owner /tmp/nsemail.eml w,
    owner /tmp/nsemail-[0-9]*.eml w,

    # for signature verifications
    owner /tmp/data.sig r,
    owner /tmp/data-[0-9]*.sig r,

    # for enigmails wizard key revocation cert
    owner @{HOME}/.icedove/*.default/*_rev.asc rw,

    owner /tmp/gpg-[a-zA-Z0-9]*/S.gpg-agent rw,
  }

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.bin.icedove>
}