Merge lp://staging/~sdeziel/apparmor/usr.sbin.sshd-refresh into lp://staging/apparmor/2.12

Proposed by Simon Déziel
Status: Merged
Merged at revision: 3441
Proposed branch: lp://staging/~sdeziel/apparmor/usr.sbin.sshd-refresh
Merge into: lp://staging/apparmor/2.12
Diff against target: 285 lines (+109/-130)
2 files modified
profiles/apparmor.d/abstractions/libpam-systemd (+19/-0)
profiles/apparmor/profiles/extras/usr.sbin.sshd (+90/-130)
To merge this branch: bzr merge lp://staging/~sdeziel/apparmor/usr.sbin.sshd-refresh
Reviewer Review Type Date Requested Status
Seth Arnold Approve
Review via email: mp+282088@code.staging.launchpad.net

Description of the change

The proposed profile has been extensively tested on 14.04 (OpenSSH 6.6p1) and very recently also on 16.04 (OpenSSH 7.2p2). The proposed profile includes everything that was in [0]. Also in that thread, Seth Arnold suggested [1] to put the libpam-systemd rules into an abstraction. I hope I got this right.

I tried to break the profile update into smaller chunks but finally gave up because none of the individual commits would have been working on their own.

For those testing the profile, there is (and always have been AFAICT) a huge limitation with it: one cannot use other AA profiles from the resulting SSH shell. In short, the following wouldn't work:

  ssh root@localhost tcpdump -ni lo -c 10

As tcpdump (also confined by AA) would be unable to output to the console. For the curious, please refer to John Johansen's excellent explanation in [2].

Fortunately, I was able to find a (work|hack)around:

cat << "EOF" > /etc/profile.d/01-apparmor-pts-bug-workaround.sh
# kludge to change pts if PPID is contained by sshd's Apparmor profile
if echo "$-" | grep -qF i && [ -e "/proc/$PPID/attr/current" ] && \
     grep -qw '^/usr/sbin/sshd' "/proc/$PPID/attr/current"; then
  exec script --quiet --return --command "$SHELL -l" /dev/null
fi
EOF

Not pretty but it works.

Feedback/suggestions are welcome.

0: https://lists.ubuntu.com/archives/apparmor/2016-January/009059.html
1: https://lists.ubuntu.com/archives/apparmor/2016-January/009105.html
2: https://lists.ubuntu.com/archives/apparmor/2015-September/008624.html

To post a comment you must log in.
3271. By Simon Déziel

usr.sbin.sshd: add cgroup-related rules

3272. By Simon Déziel

usr.sbin.sshd: allow ptrace tracing to cope with recent kernel/AA changes

3273. By Simon Déziel

usr.sbin.sshd: remove commented-out hat related rules

3274. By Simon Déziel

usr.sbin.sshd: deny net_admin that is not strictly required

Matthew Dawson explained why:

> sshd doesn't actually require the net_admin capability. libpam-systemd tries
> to use it if available to set the send/receive buffers size, but will fall
> back to a non-privileged version if it fails.

https://lists.ubuntu.com/archives/apparmor/2016-April/009586.html

3275. By Simon Déziel

usr.sbin.sshd: allow reading blacklisted host keys

Revision history for this message
Simon Déziel (sdeziel) wrote :

ping?

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Looks good to me, but .. all those Ux permissions. I miss the apparmor privsep version.

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches