Commit graph

6183 commits

Author SHA1 Message Date
Christian Boltz
ab19f5599d Merge profiles/apparmor.d: update samba-dceprpc & samba-rpcd-* profiles
aarch64 needs some additional rules on tumbleweed to handle for
example

apparmor="DENIED" operation="file_mmap" profile="samba-dcerpcd" name="/usr/lib64/samba/samba-dcerpcd" pid=897 comm="samba-dcerpcd" requested_mask="m" denied_mask="m" fsuid=0 ouid=0

The other new rpcd_* services exhibit similar errors

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1198309

Signed-off-by: Noel Power <noel.power@suse.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/880
Approved-by: Christian Boltz <apparmor@cboltz.de> for 3.0 and master
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-05-11 19:44:43 +00:00
Noel Power
6a621616d9 profiles/apparmor.d: update samba-dceprpc & samba-rpcd-* profiles
aarch64 needs some additional rules on tumbleweed to handle for
example

apparmor="DENIED" operation="file_mmap" profile="samba-dcerpcd" name="/usr/lib64/samba/samba-dcerpcd" pid=897 comm="samba-dcerpcd" requested_mask="m" denied_mask="

The other new rpcd_* services exhibit similar errors

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1198309

Signed-off-by: Noel Power <noel.power@suse.com>
2022-05-11 15:55:01 +01:00
Mikhail Morfikov
a54409eb94
Update for the mesa abstraction
I noticed that some apps return the following errors when launched:

  kernel: audit: type=1400 audit(1651244478.255:5501): apparmor="DENIED" operation="open" profile="some_app" name="/sys/devices/pci0000:00/0000:00:02.0/revision" pid=1877976 comm="some_app" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
  kernel: audit: type=1400 audit(1651244478.255:5502): apparmor="DENIED" operation="open" profile="some_app" name="/sys/devices/pci0000:00/0000:00:02.0/config" pid=1877976 comm="some_app" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Blocking the files results in the following errors when the app is executed in a terminal:

  MESA: error: Failed to query drm device.
  libGL error: failed to create dri screen
  libGL error: failed to load driver: crocus
  MESA: error: Failed to query drm device.
  libGL error: failed to create dri screen
  libGL error: failed to load driver: crocus

Since they have something to do with MESA, I think the mesa abstraction should
be updated to fix the issue.
2022-04-29 22:58:37 +02:00
Christian Boltz
62bf2f773b Merge zgrep profile: also allow zstd
openSUSE works on extending zgrep to also support zstd-compressed files.

References: http://bugzilla.opensuse.org/show_bug.cgi?id=1198922

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/878
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-04-28 23:01:21 +00:00
Christian Boltz
c5a51a080f
zgrep profile: also allow zstd
openSUSE works on extending zgrep to also support zstd-compressed files.

References: http://bugzilla.opensuse.org/show_bug.cgi?id=1198922
2022-04-27 22:15:17 +02:00
John Johansen
c7d060a7dd Merge Add some empty and cut-off bad abi rules
Credits go to Seth who proposed these tests in
https://gitlab.com/apparmor/apparmor/merge_requests/196#note_108500403

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/875
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-19 18:54:51 +00:00
John Johansen
3083ce7a39 Merge Allow reading all of /etc/php[578]/** in abstractions/php
... and with that, make a rule in the php-fpm profile (which missed
php8) superfluous.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/229
Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1186267#c11
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/876
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-19 18:43:19 +00:00
John Johansen
bfa67b369d Merge profiles: update snap_browsers permissions
The snap_browsers abstraction requires more permissions
due to updates on snaps.
    
Some of the permissions are not required in older versions of
Ubuntu that use 2.12 and 2.13, but are introduced for unification
and ease of maintenance purposes. These include:
```
    all dbus permissions,
    @{PROC}/sys/kernel/random/uuid r,
    owner @{PROC}/@{pid}/cgroup r,
    /var/lib/snapd/sequence/{chromium,firefox,opera}.json r,
```


I also propose a cherry-pick of this commit to 2.12, 2.13 and 3.0

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/877
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-19 18:35:52 +00:00
Georgia Garcia
eb828dde6f profiles: update snap_browsers permissions
The snap_browsers abstraction requires more permissions
due to updates on snaps.

Some of the permissions are not required in older versions of
Ubuntu that use 2.12 and 2.13, but are introduced for unification
and ease of maintenance purposes. These include:
all dbus permissions,
@{PROC}/sys/kernel/random/uuid r,
owner @{PROC}/@{pid}/cgroup r,
/var/lib/snapd/sequence/{chromium,firefox,opera}.json r,

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2022-04-18 21:18:26 -03:00
Christian Boltz
c946f0bf75
Allow reading all of /etc/php[578]/** in abstractions/php
... and with that, make a rule in the php-fpm profile (which missed
php8) superfluous.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/229

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1186267#c11
2022-04-18 20:52:39 +02:00
Christian Boltz
69302067b0 Merge tools.py: inline check_profile_dir() into __init__()
... which was the only caller of this tiny function.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/874
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-04-18 11:47:22 +00:00
Christian Boltz
a2ff041e98 Merge zgrep profile: allow executing /usr/bin/expr
expr is used for parsing commandline options in zgrep.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1198531

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/873
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-04-18 11:46:52 +00:00
Christian Boltz
8cb81ec25f
Add some empty and cut-off bad abi rules
Credits go to Seth who proposed these tests in
https://gitlab.com/apparmor/apparmor/merge_requests/196#note_108500403
2022-04-17 00:38:18 +02:00
Christian Boltz
484247355e
tools.py: inline check_profile_dir() into __init__()
... which was the only caller of this tiny function.
2022-04-16 23:38:17 +02:00
Christian Boltz
ad8c5f0be3
zgrep profile: allow executing /usr/bin/expr
expr is used for parsing commandline options in zgrep.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1198531
2022-04-16 22:32:01 +02:00
Christian Boltz
3d27977b1c Merge profiles/apparmor.d: Add new profiles needed for samba-4.16
samba-4.16 has a completely new dcerpc subsystem, services that
used to be built into the smbd daemon itself (and deployed in forked
instances) are now hosted in standalone binaries. The following new
binaries now need new profiles

  rpcd_classic
  rpcd_epmapper
  rpcd_fsrvp
  rpcd_lsad
  rpcd_mdssvc
  rpcd_rpcecho
  rpcd_spoolss
  rpcd_winreg
  samba-dcerpcd

Additionally smbd & winbindd need new entries because the exec
samba-dcerpcd

Signed-off-by: Noel Power <noel.power@suse.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/871
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-04-15 12:52:19 +00:00
Noel Power
c785bcbe47 profiles/apparmor.d: Add new profiles needed for samba-4.16
samba-4.16 has a completely new dcerpc subsystem, services that
used to be built into the smbd daemon itself (and deployed in forked
instances) are now hosted in standalone binaries. The following new
binaries now need new profiles

  rpcd_classic
  rpcd_epmapper
  rpcd_fsrvp
  rpcd_lsad
  rpcd_mdssvc
  rpcd_rpcecho
  rpcd_spoolss
  rpcd_winreg
  samba-dcerpcd

Mostly these are captured in a single common profile 'samba-rpcd'

Additionally smbd & winbindd need new entries because they exec
samba-dcerpcd

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1198309

Signed-off-by: Noel Power <noel.power@suse.com>
2022-04-15 12:10:07 +01:00
John Johansen
41b4436710 Merge Add zgrep and xzgrep profile
This prevents exploiting https://www.openwall.com/lists/oss-security/2022/04/08/2
aka CVE-2022-1271 (file write and code execution via "funny" filenames)

I propose this addition for 3.0 and master.

(Tested on openSUSE Tumbleweed - tests on other distros welcome ;-)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/870
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2022-04-12 05:18:11 +00:00
John Johansen
52e82516d7 Merge add a common reload_profile() function to aa.py
This function is based on reload_profile() in tools.py, but also
replaces most of reload_base() in aa.py.

For bonus points, we get rid of shell=True when calling apparmor_parser.

Note: This slightly changes the behaviour of aa-logprof and aa-genprof -
if the parser errors out ($? > 0), the output no longer gets hidden.
However, this will not raise an exception, and aa-logprof and aa-genprof
won't abort on parser errors.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/855
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-12 05:17:50 +00:00
John Johansen
103603277a Merge sbin.rpc.statd: add hosts_access abstraction, /etc/nfs.conf{,.d/}
Observed these denials on an Ubuntu jammy system, when a user with an NFS homedir logs in:
```
Mar 29 06:57:14 darkstar kernel: [ 5988.206958] audit: type=1400 audit(1648551434.502:72): apparmor="DENIED" operation="open" profile="rpc.statd" name="/etc/nfs.conf" pid=3195 comm="rpc.statd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Mar 29 06:57:14 darkstar kernel: [ 5988.207023] audit: type=1400 audit(1648551434.502:73): apparmor="DENIED" operation="open" profile="rpc.statd" name="/etc/nfs.conf.d/" pid=3195 comm="rpc.statd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Mar 29 10:48:49 darkstar kernel: [19883.319957] audit: type=1400 audit(1648565329.710:74): apparmor="DENIED" operation="open" profile="rpc.statd" name="/etc/hosts.allow" pid=3196 comm="rpc.statd" requested_mask="r" denied_mask="r" fsuid=111 ouid=0
Mar 29 10:48:49 darkstar kernel: [19883.320016] audit: type=1400 audit(1648565329.710:75): apparmor="DENIED" operation="open" profile="rpc.statd" name="/etc/hosts.deny" pid=3196 comm="rpc.statd" requested_mask="r" denied_mask="r" fsuid=111 ouid=0
Mar 29 17:07:33 darkstar kernel: [  162.642366] audit: type=1400 audit(1648588053.026:72): apparmor="DENIED" operation="file_lock" profile="rpc.statd" name="/etc/nfs.conf" pid=1697 comm="rpc.statd" requested_mask="k" denied_mask="k" fsuid=0 ouid=0
```

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/866
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-12 05:16:23 +00:00
John Johansen
4537a5014b Merge profiles/apparmor.d/abstraction: Squash noisey setsockopt calls.
systemd will attempt to force socket buffer size using setsockopt
and param SO_SNDBUFFORCE (which require net_admin cap) if it's previous
attempt to set size was clipped by kernel limit.

- Silence 'type=AVC msg=audit(1648725005.727:201): apparmor="DENIED" operation="capable" profile="smbd" pid=3054 comm="smbd" capability=12  capname="net_admin"'

type entries.

Signed-off-by: Noel Power <noel.power@suse.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/867
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-04-12 05:14:24 +00:00
Christian Boltz
4c853dc74d
Add zgrep and xzgrep profile
This prevents exploiting https://www.openwall.com/lists/oss-security/2022/04/08/2
aka CVE-2022-1271 (file write and code execution via "funny" filenames)
2022-04-12 00:04:22 +02:00
Christian Boltz
52b6b97c98 Merge dirtest.sh: error out on unexpected success
... if a test is expected to fail, but succeeds.

Also fix the copyright year - the test was created in 2022, not in 2013.

This fixes my comments on
bd78b6b292

The original MR !850 was merged into 3.0 and master, therefore I also propose this patch for 3.0 and master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/868
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-04-04 11:14:15 +00:00
Christian Boltz
2036f6fa9d
dirtest.sh: error out on unexpected success
... if a test is expected to fail, but succeeds.

Also fix the copyright year - the test was created in 2022, not in 2013.

This fixes my comments on
bd78b6b292
2022-04-03 17:45:24 +02:00
Noel Power
90f97357af profiles/apparmor.d/abstraction: Squash noisey setsockopt calls.
systemd will attempt to force socket buffer size using setsockopt
and param SO_SNDBUFFORCE (which require net_admin cap) if it's previous
attempt to set size was clipped by kernel limit.

- Silence 'type=AVC msg=audit(1648725005.727:201): apparmor="DENIED" operation="capable" profile="smbd" pid=3054 comm="smbd" capability=12  capname="net_admin"'

type entries.

Signed-off-by: Noel Power <noel.power@suse.com>
2022-03-31 12:23:00 +01:00
Daniel Richard G
8e845c2e7f sbin.rpc.statd: add hosts_access abstraction, /etc/nfs.conf{,.d/}
Also update to use @{run}
2022-03-30 01:04:26 -04:00
Christian Boltz
83685ba703 Merge Allow dovecot to use all signals
similar to commit 2f9d172c64
we discovered that there was a service outage
when dovecot tried to send a usr1 signal

type=AVC msg=audit(1648024138.249:184964): apparmor="DENIED" operation="signal" profile="dovecot" pid=1690 comm="dovecot" requested_mask="send" denied_mask="send" signal=usr1 peer="dovecot-imap-login"

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/865
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-03-25 20:52:49 +00:00
Christian Boltz
ff9e457189 Merge abstractions/ssh_certs: extend pki/trust directories
- add pki/blacklist and pki/blocklist
- add /usr/share/pki/ in adddition to /etc/pki/

pki/blocklist was suggested by @darix, the other changes are things I noticed while adding it.

I propose this patch for 3.0 and master. (`abstractions/ssl_certs` on 2.x branches is quite different and needs a manual backport (or more cherry-picks) if you want to backport this MR.)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/864
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-03-23 20:34:02 +00:00
Bernhard M. Wiedemann
f0919f83f1
Allow dovecot to use all signals
similar to commit 2f9d172c64
we discovered that there was a service outage
when dovecot tried to send a usr1 signal

type=AVC msg=audit(1648024138.249:184964): apparmor="DENIED" operation="signal" profile="dovecot" pid=1690 comm="dovecot" requested_mask="send" denied_mask="send" signal=usr1 peer="dovecot-imap-login"
2022-03-23 14:27:13 +01:00
Christian Boltz
32cd90eb88
abstractions/ssh_certs: extend pki/trust directories
- add pki/blacklist and pki/blocklist
- add /usr/share/pki/ in adddition to /etc/pki/

pki/blocklist was suggested by @darix, the other changes are things I noticed while adding it.
2022-03-22 12:36:42 +01:00
Christian Boltz
e2319167d0 Merge profiles/apparmor.d: Fix read access denied on /proc/*/fd bsc#1196850
- Fix "type=AVC msg=audit(1646702374.347:182): apparmor="DENIED"
       operation="open" profile="samba-bgqd" name="/proc/1933/fd/"
       pid=1933 comm="samba-bgqd" requested_mask="r" denied_mask="r"
       fsuid=0 ouid=0"

entries appearing in SLE15-SP4

Signed-off-by: Noel Power <noel.power@suse.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/860
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-03-14 12:16:20 +00:00
Noel Power
6b83ba91c1 profiles/apparmor.d: Fix read access denied on /proc/*/fd bsc#1196850
- Fix "type=AVC msg=audit(1646702374.347:182): apparmor="DENIED"
       operation="open" profile="samba-bgqd" name="/proc/1933/fd/"
       pid=1933 comm="samba-bgqd" requested_mask="r" denied_mask="r"
       fsuid=0 ouid=0"

entries appearing in SLE15-SP4

Signed-off-by: Noel Power <noel.power@suse.com>
2022-03-14 10:30:03 +00:00
John Johansen
c3f64513f2 Merge smbd, samba-bgqd: allow reading openssl.cnf
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1195463#c10

I propose this patch for 3.0 and master. (<= 2.13 don't have the samba-bgpd profile - if we want to backport to 2.x, we'll have to pick only the smbd part.)

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1195463#c10
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/862
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-03-13 15:05:46 +00:00
Christian Boltz
16444e9c29
smbd, samba-bgqd: allow reading openssl.cnf
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1195463#c10
2022-03-13 11:24:35 +01:00
John Johansen
8f7768cd02 Merge abstractions/nss-systemd: Allow access for systemd-machined names
See downstream bug at
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1964325

Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/861
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-03-10 04:07:56 +00:00
Alex Murray
9e260a8d79
abstractions/nss-systemd: Allow access for systemd-machined names
See downstream bug at
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1964325

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2022-03-10 11:57:13 +10:30
John Johansen
bd78b6b292 parser: dirtest that was supposed to be part of the previous commit
libapparmor: fix handling of failed symlink traversal, fixed a couple
of directory walk issues that could cause failures. The test included
in this commit was supposed to be included in the previous commit,
but was accidentally dropped. Even worse the make file changes did
make it causing the previous commit to break the CI.

Fixes: MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/85
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-02-27 01:03:22 -08:00
John Johansen
acc6ba1cb7 libapparmor: fix handling of failed symlink traversal
Ideally we would have a flag or something so the caller could choose
to handle symlinks, or traverse them. But since all callers currently
don't handle symlinks just handle them in the iterator.

Beyond fixing the early termination due to a failed symlink this also
fixes another case of failure in one job cause dir based loads to
terminate early. Which can result in partial loads.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/215
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/850
Signed-off-by: John Johansen <john.johansen@canonical.com>
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
2022-02-27 00:55:41 -08:00
John Johansen
6f18326232 Merge GTK abstraction: add support for gtk4.
The recently added gtk abstraction (!825) lack the support for the new gtk4.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/857
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2022-02-22 19:53:48 +00:00
Alexandre Pujol
8074ff4fd1
GTK abstraction: add support for gtk4. 2022-02-22 19:34:59 +00:00
Christian Boltz
7c725782a3 Merge aa-genprof: reduce and improve subprocess calls
Get rid of subprocess with shell=True

Simplify logmark used in syslog.

Instead of using `date | md5sum` and parsing the output to get the actual md5sum (without the stdin filename), use the current unixtime with a `logmark-` prefix.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/856
Acked-by: Seth Arnold <seth.arnold@gmail.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-02-21 22:10:27 +00:00
Christian Boltz
95d89dfbac
Simplify logmark used in syslog
Instead of using `date | md5sum` and parsing the output to get the
actual md5sum (without the stdin filename), use the current unixtime
with a `logmark-` prefix.
2022-02-21 22:52:14 +01:00
Christian Boltz
c0734411ee
aa-genprof: get rid of subprocess with shell=True 2022-02-21 22:43:29 +01:00
Christian Boltz
c6dabdf1e8
add a common reload_profile() function to aa.py
This function is based on reload_profile() in tools.py, but also
replaces most of reload_base() in aa.py.

For bonus points, we get rid of shell=True when calling apparmor_parser.

Note: This slightly changes the behaviour of aa-logprof and aa-genprof -
if the parser errors out ($? > 0), the output no longer gets hidden.
However, this will not raise an exception, and aa-logprof and aa-genprof
won't abort on parser errors.
2022-02-21 22:05:59 +01:00
John Johansen
6e5fdb5c05 Merge smbd: allow reading under /usr/share/samba
Today, a normal user connected and did something (dunno what) that caused smbd to try to `/usr/share/samba/mdssvc/elasticsearch_mappings.json`:

Samba logs:

```
root@smb:~# journalctl -b0 -u smbd
-- Logs begin at Fri 2022-01-21 14:17:01 UTC, end at Thu 2022-02-17 23:56:02 UTC. --
Feb 17 14:01:20 smb systemd[1]: Starting Samba SMB Daemon...
Feb 17 14:01:26 smb smbd[113]: [2022/02/17 14:01:26.904865,  0] ../../lib/util/become_daemon.c:135(daemon_ready)
Feb 17 14:01:26 smb systemd[1]: Started Samba SMB Daemon.
Feb 17 14:01:26 smb smbd[113]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
Feb 17 21:05:35 smb smbd[3084]: pam_unix(samba:session): session opened for user jdoe by (uid=0)
Feb 17 21:05:37 smb smbd[3084]: [2022/02/17 21:05:37.735182,  0] ../../source3/rpc_server/mdssvc/mdssvc_es.c:92(mdssvc_es_init)
Feb 17 21:05:37 smb smbd[3084]:   mdssvc_es_init: Opening mapping file [/usr/share/samba/mdssvc/elasticsearch_mappings.json] failed: unable to open /usr/share/samba/mdssvc/elasticsearch_mappings.json: Permission denied
Feb 17 21:05:37 smb smbd[3084]: [2022/02/17 21:05:37.735436,  0] ../../source3/rpc_server/mdssvc/mdssvc.c:1490(mdssvc_init)
Feb 17 21:05:37 smb smbd[3084]:   mdssvc_init: backend init failed
Feb 17 21:05:37 smb smbd[3084]: [2022/02/17 21:05:37.735562,  0] ../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:152(_mdssvc_open)
Feb 17 21:05:37 smb smbd[3084]:   _mdssvc_open: Couldn't create policy handle for partage
Feb 17 23:56:02 smb smbd[3084]: pam_unix(samba:session): session closed for user jdoe
```

Since the 'smb' machine is a container, the Apparmor denial ended up in the host's log:

```
$ journalctl -o cat --grep samba -k --since today | cat
audit: type=1400 audit(1645131937.730:98): apparmor="DENIED" operation="open" namespace="root//lxd-smb_<var-snap-lxd-common-lxd>" profile="smbd" name="/usr/share/samba/mdssvc/elasticsearch_mappings.json" pid=35359 comm="smbd" requested_mask="r" denied_mask="r" fsuid=166549 ouid=165536

```

It is the first time it occurs in years of use but it seems legitimate as:

1) this file is installed by the package
2) `git grep -F elasticsearch_mappings` in Debian samba's source shows many hits:
```
$ git grep -F elasticsearch_mappings
debian/samba.install:usr/share/samba/mdssvc/elasticsearch_mappings.json
docs-xml/manpages/mdsearch.1.xml:         <filename>/usr/share/samba/mdssvc/elasticsearch_mappings.json</filename>
docs-xml/smbdotconf/misc/elasticsearchmappings.xml:  <value type="default">&pathconfig.SAMBA_DATADIR;/elasticsearch_mappings.json</value>
docs/manpages/mdfind.1:/usr/share/samba/mdssvc/elasticsearch_mappings\&.json
docs/manpages/smb.conf.5:\fI\fIelasticsearch:mappings\fR\fR\fI = \fR\fI${prefix}/var/samba/elasticsearch_mappings\&.json\fR\fI \fR
selftest/selftest.pl:   elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json
selftest/target/Samba3.pm:      elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json
source3/rpc_server/mdssvc/es_parser_test.c:             "%s/mdssvc/elasticsearch_mappings.json",
source3/rpc_server/mdssvc/mdssvc_es.c:          "%s/mdssvc/elasticsearch_mappings.json",
source3/rpc_server/wscript_build:                          'mdssvc/elasticsearch_mappings.json')
```

While only the `mdssvc` sub-dir could be authorized, the whole dir content seemed OK for read access anyway:

```
root@smb:~# ll /usr/share/samba/
total 53
drwxr-xr-x  5 root root   10 Feb  1 14:08 ./
drwxr-xr-x 67 root root   67 Jun 22  2021 ../
-rwxr-xr-x  1 root root 1163 Jan 31 13:11 addshare.py*
drwxr-xr-x  3 root root    4 Feb  1 14:08 admx/
drwxr-xr-x  2 root root    3 Feb  1 14:08 mdssvc/
-rwxr-xr-x  1 root root 2059 Jan 31 13:11 panic-action*
-rwxr-xr-x  1 root root 1333 Jan 31 13:11 setoption.py*
drwxr-xr-x  5 root root   57 Feb  1 14:08 setup/
-rw-r--r--  1 root root 8942 Jan 31 13:11 smb.conf
-rwxr-xr-x  1 root root 2682 Jan 31 13:11 update-apparmor-samba-profile*
```

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/853
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-02-21 20:04:49 +00:00
John Johansen
40402e2436 Merge Revert "gitlab: testing: temporarily disable secret-detect"
It appears secret detection is failing if the master branch in the tree a merge request is being made from is too (some unknown value) far behind the branch of the tree it is being merged into.

This is problematic as it is not started practice to refresh the upstream branches of forked trees, but to keep multiple remotes in a single local tree, branch from mainline master, work on the branch and push to the fork for the merge request. This will require contributors to refresh their forked trees in secret-detection fails. Which may be problematic for some contributors, but since we don't know how bad this is going to be, for now re-enable secret detection.

This reverts commit 8b4344c17b.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/854
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2022-02-21 19:58:36 +00:00
John Johansen
51615755f8 Revert "gitlab: testing: temporarily disable secret-detect"
This reverts commit 8b4344c17b.
2022-02-21 11:31:44 -08:00
John Johansen
8b4344c17b gitlab: testing: temporarily disable secret-detect
Unfortunately secret detection is failing with
   fatal: error in object: unshallow sha1

and blocking merge requests. Unfortuntely all suggested work arounds
from https://gitlab.com/gitlab-org/gitlab/-/issues/351976 failed to
work.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-02-18 00:19:31 -08:00
Simon Deziel
9e0adcfd07 smbd: allow reading under /usr/share/samba
Signed-off-by: Simon Deziel <simon@sdeziel.info>
2022-02-17 18:54:54 -05:00
Georgia Garcia
5001431cdf Merge parser: fix building with link time optimization (lto)
Libapparmor was fixed for lto builds on commit 7cde91f5 but
the parser was also failing due to the same reasons when lto
was enabled.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/214
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

Closes #214
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/851
Acked-by: Approved-by: John Johansen <john@jjmx.net>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2022-02-17 17:09:13 +00:00