Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
create mir interface #1299
Conversation
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
@kgunn can you please document your test in integration-tests/manual-tests.md ? |
zyga
reviewed
Jun 9, 2016
| @@ -29,6 +29,7 @@ var allInterfaces = []interfaces.Interface{ | ||
| &LocationControlInterface{}, | ||
| &LocationObserveInterface{}, | ||
| &NetworkManagerInterface{}, | ||
| + &MirInterface{}, |
zyga
reviewed
Jun 9, 2016
| +/run/udev/data/* r, | ||
| +/run/udev/** rw, | ||
| + | ||
| +ptrace peer=**, |
jdstrand
Jun 9, 2016
Contributor
If mir server needs ptrace, it should be more fine-grained than this and only ptrace for connected clients. Please use something like this in mirConnectedPlugAppArmor:
ptrace (tracedby) peer=###SLOT_SECURITY_TAGS###,
Then the mirConnectedSlotAppArmor would have:
ptrace (trace) peer=###PLUG_SECURITY_TAGS###,
The above assumes you need 'trace' Can you paste the apparmor denial that prompted this rule?
kgunnfront
Jun 13, 2016
removed ptrace references, i know we add these long ago, but appearantly they are not needed
zyga
reviewed
Jun 9, 2016
| +capability sys_admin, | ||
| + | ||
| +unix (receive, send) type=seqpacket addr=none, | ||
| +/tmp/mir_socket rw, |
zyga
Jun 9, 2016
Contributor
Why is the socket in /tmp and not in /run? /tmp is private and per-app and won't work with snaps
zyga
reviewed
Jun 9, 2016
| +unix (receive, send) type=seqpacket addr=none, | ||
| +/tmp/mir_socket rw, | ||
| +/dev/dri/card0 rw, | ||
| +/dev/shm/\#* rw, |
zyga
Jun 9, 2016
Contributor
What does \# mean there?
Could mir use shm entries that follow /dev/shm/snap.$SNAP_NAME?
kgunnfront
Jun 13, 2016
in this instance the # is actually the # in part of the directory name. for instance if i remove this line, I get the denial in the following way
apparmor="DENIED" operation="open" profile="snap.mir-server.mir-server" name="/dev/shm/#3" pid=5217 comm="mir-server" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
also, mir is all server side allocated, so not sure the snap.$SNAP_NAME would work
zyga
reviewed
Jun 9, 2016
| +/sbin/killall5 ixr, | ||
| +/usr/bin/expr ixr, | ||
| +/usr/bin/chmod ixr, | ||
| +/bin/chmod ixr, |
zyga
Jun 9, 2016
Contributor
Are all of those commands guaranteed to exist in the image? Should mir ship those tools internally?
jdstrand
Jun 9, 2016
Contributor
All of these commands can be removed. They are in the default policy (interfaces/apparmor/template.go).
zyga
reviewed
Jun 9, 2016
| +capability sys_ptrace, | ||
| + | ||
| +network netlink raw, | ||
| +/run/mir_socket rw, |
zyga
reviewed
Jun 9, 2016
| +mmap2 | ||
| +mprotect | ||
| + | ||
| +# LP: #1448184 - these aren't currently mediated by AppArmor. Deny for now |
zyga
reviewed
Jun 9, 2016
| +capability sys_admin, | ||
| + | ||
| +unix (receive, send) type=seqpacket addr=none, | ||
| +/tmp/mir_socket rw, |
zyga
Jun 9, 2016
Contributor
This won't work, you have you use /run as each process gets a private /tmp that is invisible to anyone else.
zyga
reviewed
Jun 9, 2016
| +unix (receive, send) type=seqpacket addr=none, | ||
| +/tmp/mir_socket rw, | ||
| +/dev/dri/card0 rw, | ||
| +/dev/shm/\#* rw, |
zyga
Jun 9, 2016
Contributor
Can this be made so that it is specific to the snap? Ideally mir would create buffers here that cannot be opened by any other process except the one that mir is talking to (so client A cannot look at shared objects of client B).
zyga
reviewed
Jun 9, 2016
| +/run/udev/data/* r, | ||
| +/run/udev/** rw, | ||
| + | ||
| +ptrace peer=**, |
zyga
reviewed
Jun 9, 2016
| +/run/udev/** rw, | ||
| + | ||
| +ptrace peer=**, | ||
| +/bin/sleep mrix, |
zyga
Jun 9, 2016
Contributor
Mir cliends should not run those applications. Can you expand on why they are here.
zyga
reviewed
Jun 9, 2016
| +/proc/*/cmdline r, | ||
| +/sys/bus/ r, | ||
| +/sys/class/ r, | ||
| +/sys/class/input/ r, |
zyga
Jun 9, 2016
Contributor
Why do mir clients needs to read this? It seems like something mir server does
jdstrand
Jun 9, 2016
Contributor
@zyga - I'm reading this as part of mirPermanentSlotAppArmor, so should just be the server.
zyga
reviewed
Jun 9, 2016
| +/sys/class/drm/ r, | ||
| +/etc/udev/udev.conf r, | ||
| +capability sys_ptrace, | ||
| +capability chown, |
jdstrand
Jun 9, 2016
Contributor
Again, this is the server, but I can't recall why the server needs to chown either. Can you comment in the code with a 'Note:'.
zyga
reviewed
Jun 9, 2016
| +capability sys_ptrace, | ||
| +capability chown, | ||
| +capability fowner, | ||
| +capability sys_ptrace, |
zyga
reviewed
Jun 9, 2016
| + | ||
| +var mirConnectedPlugSecComp = []byte(` | ||
| +# Description: Allow operating as the mir service. Reserved because this | ||
| +# gives privileged access to the system. |
zyga
Jun 9, 2016
Contributor
To be clear this should be different. The mir slot is restricted and can be only used by mir itself. The mir plug should not be restricted because mir is supposed to be more secure than X11.
jdstrand
Jun 9, 2016
Contributor
In addition to what zyga said, this should have something in it besides the comment. It should contain something along the lines of what was in mir_client for seccomp on 15.04.
zyga
reviewed
Jun 9, 2016
| + return "mir" | ||
| +} | ||
| + | ||
| +func (iface *MirInterface) PermanentPlugSnippet( |
zyga
reviewed
Jun 9, 2016
| + slot *interfaces.Slot, | ||
| + securitySystem interfaces.SecuritySystem) ([]byte, error) { | ||
| + switch securitySystem { | ||
| + case interfaces.SecurityAppArmor: |
jdstrand
Jun 9, 2016
Contributor
Ah, this is probably why Kevin had the policy in both places and had trouble. @kgunn, anywhere you defined AppArmor or Seccomp above you need to return non-nil in the corresponding snippets. So, this is ConnectedPlugSnippet, and you provided mirConnectedPlugAppArmor and mirConnectedPlugSeccomp above, so interfaces.SecurityAppArmor and interfaces.SecuritySeComp should return non-nil here.
kgunnfront
Jun 16, 2016
correct, after lots and lots of experimenting - returning the seccomp and aa profiles for mir server on PermanentPlugSnippet is what worked, returning on any other (PermSlotSnippet, ConnectedSlotSnippet, ConnectedPlugSnippet did not work and i tested each). Which honestly was not what i thought would occur - I believed that for Mir server it should have reported on PermanentSlot
kgunnfront
Aug 4, 2016
ok, this was related to me mistakenly using wrong label in yaml - so this is now correct
zyga
reviewed
Jun 9, 2016
| + } | ||
| +} | ||
| + | ||
| +func (iface *MirInterface) PermanentSlotSnippet( |
zyga
reviewed
Jun 9, 2016
| + return nil | ||
| +} | ||
| + | ||
| +func (iface *MirInterface) AutoConnect() bool { |
jdstrand
Jun 9, 2016
Contributor
We've said the slot side should autoconnect, yes, and the plugs side of Mir is supposed to be safe for anyone, so yes, autoconnect.
zyga
reviewed
Jun 9, 2016
| @@ -0,0 +1,95 @@ | ||
| +// -*- Mode: Go; indent-tabs-mode: t -*- | ||
| + |
kgunnfront
Jun 16, 2016
ok, zyga/jamie - i think it's probably ready for another round, spend large amount of today/y'day cleaning up
zyga
added
the
Reviewed
label
Jun 9, 2016
|
Please fix the mentioned bits and answer the few questions I've asked. Thank you for submitting this, one step closer to not having to use X11 |
jdstrand
reviewed
Jun 9, 2016
| + | ||
| +unix (receive, send) type=seqpacket addr=none, | ||
| +/tmp/mir_socket rw, | ||
| +/dev/dri/card0 rw, |
jdstrand
reviewed
Jun 9, 2016
| +capability sys_tty_config, | ||
| +capability sys_admin, | ||
| + | ||
| +unix (receive, send) type=seqpacket addr=none, |
jdstrand
Jun 9, 2016
Contributor
IIRC, this was going to be investigated and, again IIRC, @vosst said that Mir shouldn't be using these. Can someone confirm? If we need it, we should have a unix peer=(label=...) rule, likely one for slot and plug side. Can you post the denial that prompted this rule?
kgunnfront
Jun 16, 2016
commenting out "unix (receive, send) type=seqpacket addr=none,"
results in the following upon trying to run the client app
Jun 16 20:56:11 localhost ubuntu-core-launcher[4427]: Loading module: 'libubuntu_application_api_desktop_mirclient.so.3.0.0'
Jun 16 20:56:12 localhost kernel: [ 3126.446100] audit: type=1400 audit(1466110572.256:20): apparmor="DENIED" operation="open" profile="snap.mir-client.client-start" name="/usr/share/applications/" pid=4429 comm="clocks" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
jdstrand
Jul 8, 2016
Contributor
That denial is for something unrelated and is a noisy denial that shouldn't affect the app's functionality. Please leave out the seqpacket line.
jdstrand
Aug 2, 2016
Contributor
Ping regarding: my question regarding 'unix (receive, send) type=seqpacket addr=none,'
jdstrand
reviewed
Jun 9, 2016
| +# Usage: reserved | ||
| + | ||
| + | ||
| +capability dac_override, |
kgunnfront
Jun 16, 2016
without it the following occurs on server launch
Jun 16 21:19:13 localhost ./devtools.snapd[5034]: taskrunner.go:238: DEBUG: Running task 100 on Do: Make snap "mir-server" available to the system
Jun 16 21:19:13 localhost systemd[1]: Reloading.
Jun 16 21:19:14 localhost systemd[1]: snapd.refresh.timer: Adding 1h 9min 46.277746s random time.
Jun 16 21:19:14 localhost systemd[1]: Reloading.
Jun 16 21:19:14 localhost systemd[1]: snapd.refresh.timer: Adding 9min 58.505083s random time.
Jun 16 21:19:14 localhost systemd[1]: Started Service for snap application mir-server.mir-server.
Jun 16 21:19:14 localhost ./devtools.snapd[5034]: daemon.go:181: DEBUG: uid=0;@ GET /v2/snaps 1.126997ms 200
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: Mir server snap started
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.438531] mirplatform: Found graphics driver: mir:mesa-kms (version 0.23.0)
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.455655] mirplatform: Found graphics driver: mir:mesa-x11 (version 0.23.0)
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.460754] mirserver: Starting
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.461495] mircommon: Loading modules from: /snap/mir-server/x1/usr/lib/x86_64-linux-gnu/mir/server-platform
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.461990] mircommon: Loading module: /snap/mir-server/x1/usr/lib/x86_64-linux-gnu/mir/server-platform/graphics-mesa-kms.so.9
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.462408] mircommon: Loading module: /snap/mir-server/x1/usr/lib/x86_64-linux-gnu/mir/server-platform/server-mesa-x11.so.9
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.463333] mircommon: Loading module: /snap/mir-server/x1/usr/lib/x86_64-linux-gnu/mir/server-platform/input-evdev.so.5
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.465184] mirplatform: Found graphics driver: mir:mesa-kms (version 0.23.0)
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.465662] mirplatform: Found graphics driver: mir:mesa-x11 (version 0.23.0)
Jun 16 21:19:14 localhost ubuntu-core-launcher[5138]: [2016-06-16 21:19:14.466394] mirserver: Selected driver: mir:mesa-kms (version 0.23.0)
Jun 16 21:19:14 localhost kernel: [ 4508.651864] audit: type=1400 audit(1466111954.459:24): apparmor="DENIED" operation="capable" profile="snap.mir-server.mir-server" pid=5140 comm="mir-server" capability=1 capname="dac_override"
Jun 16 21:19:14 localhost kernel: [ 4508.651871] audit: type=1400 audit(1466111954.459:25): apparmor="DENIED" operation="capable" profile="snap.mir-server.mir-server" pid=5140 comm="mir-server" capability=2 capname="dac_read_search"
jdstrand
reviewed
Jun 9, 2016
| + | ||
| +capability dac_override, | ||
| +capability sys_tty_config, | ||
| +capability sys_admin, |
jdstrand
reviewed
Jun 9, 2016
| +/dev/shm/\#* rw, | ||
| + | ||
| +/sys/devices/**/uevent rw, | ||
| +/sys/devices/**/ r, |
jdstrand
Jun 9, 2016
Contributor
This is very broad and gets back to the udev querying I've detailed in the opengl interface.
jdstrand
reviewed
Jun 9, 2016
| + | ||
| +/sys/devices/**/uevent rw, | ||
| +/sys/devices/**/ r, | ||
| +/dev/input/* rw, |
jdstrand
Jun 9, 2016
Contributor
Can you add a comment: Note: this allows reading and inserting all input events
jdstrand
reviewed
Jun 9, 2016
| +/dev/tty* wr, | ||
| +/run/udev/data/* r, | ||
| +/run/udev/** rw, | ||
| + |
jdstrand
Jun 9, 2016
Contributor
These udev get back to the udev querying as detailed in the opengl interface.
jdstrand
reviewed
Jun 9, 2016
| +/usr/bin/expr ixr, | ||
| +/usr/bin/chmod ixr, | ||
| +/bin/chmod ixr, | ||
| +/proc/ r, |
jdstrand
reviewed
Jun 9, 2016
| +/usr/bin/chmod ixr, | ||
| +/bin/chmod ixr, | ||
| +/proc/ r, | ||
| +/proc/*/stat r, |
jdstrand
reviewed
Jun 9, 2016
| +/bin/chmod ixr, | ||
| +/proc/ r, | ||
| +/proc/*/stat r, | ||
| +/proc/*/cmdline r, |
jdstrand
reviewed
Jun 9, 2016
| +/dev/dri/card0 rw, | ||
| +/dev/shm/\#* rw, | ||
| + | ||
| +/sys/devices/**/uevent rw, |
jdstrand
Jun 9, 2016
Contributor
'r' is allowed by the default policy. You actually need 'w' to /sys/devices? Why?
jdstrand
reviewed
Jun 9, 2016
| +/sys/class/ r, | ||
| +/sys/class/input/ r, | ||
| +/sys/class/drm/ r, | ||
| +/etc/udev/udev.conf r, |
jdstrand
reviewed
Jun 9, 2016
| +/sys/bus/ r, | ||
| +/sys/class/ r, | ||
| +/sys/class/input/ r, | ||
| +/sys/class/drm/ r, |
jdstrand
reviewed
Jun 9, 2016
| +/sys/class/input/ r, | ||
| +/sys/class/drm/ r, | ||
| +/etc/udev/udev.conf r, | ||
| +capability sys_ptrace, |
jdstrand
reviewed
Jun 9, 2016
| +pwrite | ||
| +pwrite64 | ||
| +pwritev | ||
| +`) |
jdstrand
Jun 9, 2016
Contributor
This looks like the default policy in interfaces/seccomp/template.go. Can you list here only what isn't included there?
jdstrand
reviewed
Jun 9, 2016
| +capability chown, | ||
| +capability fowner, | ||
| +capability sys_ptrace, | ||
| +`) |
jdstrand
Jun 9, 2016
•
Contributor
The policy for mirConnectedPlugAppArmor is wrong. It should contain what the client needs, but this is all the privileged policy of the server. This should contain something along the lines of what was in mir_client for apparmor on 15.04.
kgunn
added some commits
Jun 10, 2016
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
kgunn
added some commits
Jun 14, 2016
kgunn
added some commits
Jul 20, 2016
jdstrand
reviewed
Aug 2, 2016
| @@ -8,7 +8,6 @@ github.com/jessevdk/go-flags git 6b9493b3cb60367edd942144879646604089e3f7 2016-0 | ||
| github.com/kr/pty git 05017fcccf23c823bfdea560dcc958a136e54fb7 2014-12-17T21:19:37Z | ||
| github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z | ||
| github.com/mvo5/uboot-go git 361f6ebcbb54f389d15dc9faefa000e996ba3e37 2015-07-22T06:53:46Z | ||
| -github.com/peterh/liner git 1bb0d1c1a25ed393d8feb09bab039b2b1b1fbced 2015-04-02T04:04:07Z |
jdstrand
reviewed
Aug 2, 2016
| @@ -32,6 +32,7 @@ var allInterfaces = []interfaces.Interface{ | ||
| &ModemManagerInterface{}, | ||
| &MprisInterface{}, | ||
| &NetworkManagerInterface{}, | ||
| + &MirInterface{}, |
jdstrand
reviewed
Aug 2, 2016
| +/dev/dri/card0 rw, | ||
| +/dev/shm/\#* rw, | ||
| +/dev/tty* wr, | ||
| +/run/udev/data/* r, |
jdstrand
Aug 2, 2016
Contributor
I suspect this can be limited based on https://www.kernel.org/doc/Documentation/devices.txt. What files is it accessing in /run/udev/data/?
kgunnfront
Aug 4, 2016
When I remove /run/udev/data/* r, the server will receive these denials
Aug 4 20:19:13 localhost ubuntu-core-launcher[1499]: [2016-08-04 20:19:13.694297] mirplatform: Found graphics driver: mir:mesa-x11 (version 0.23.5)
Aug 4 20:19:13 localhost ubuntu-core-launcher[1499]: Unknown command line options: --vt 1
Aug 4 20:19:13 localhost kernel: [ 589.117731] audit: type=1400 audit(1470341953.690:15): apparmor="DENIED" operation="open" profile="snap.mir-server.mir-server" name="/run/udev/data/+drm:card0-Virtual-1" pid=1501 comm="mir-server" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Aug 4 20:19:13 localhost kernel: [ 589.117859] audit: type=1400 audit(1470341953.690:16): apparmor="DENIED" operation="open" profile="snap.mir-server.mir-server" name="/run/udev/data/+drm:card0-Virtual-2" pid=1501 comm="mir-server" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Aug 4 20:19:13 localhost kernel: [ 589.117948] audit: type=1400 audit(1470341953.690:17): apparmor="DENIED" operation="open" profile="snap.mir-server.mir-server" name="/run/udev/data/+drm:card0-Virtual-3" pid=1501 comm="mir-server" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
So is there some alternative?
note, i already have /dev/dri/card0 rw, in the list
jdstrand
Aug 4, 2016
•
Contributor
You should probably just 'plugs: [ opengl ]' in the server, though I think you'll need to change snap/implicit.go to move opengl out of implicitClassicSlots and into implicitSlots. I think you'd also want to move /dev/dri/card0 rw, into opengl too. Not sure why it isn't there now....
If this is undesirable, can copy this from the opengl interface:
# FIXME: this is an information leak and snapd should instead query udev for
# the specific accesses associated with the above devices.
/sys/bus/pci/devices/** r,
/run/udev/data/+drm:card* r,
/run/udev/data/+pci:[0-9]* r,
# FIXME: for each device in /dev that this policy references, lookup the
# device type, major and minor and create rules of this form:
# /run/udev/data/<type><major>:<minor> r,
# For now, allow 'c'haracter devices and 'b'lock devices based on
# https://www.kernel.org/doc/Documentation/devices.txt
/run/udev/data/c226:[0-9]* r, # 226 drm
jdstrand
Aug 8, 2016
Contributor
@niemeyer mentioned this is ready for re-review.
@kgunn - please respond to my questions regarding opengrl, /deg/dri/card0 and /run/udev/data
kgunnfront
Aug 9, 2016
OK, I rearrange to rely on the opengl i/f for the relevant paths.
I also made opengl part of implicitSlots
jdstrand
reviewed
Aug 2, 2016
| + | ||
| +/usr/share/applications/ r, | ||
| +/run/mir_socket rw, | ||
| +/run/user/*/mir_socket rw, |
jdstrand
reviewed
Aug 2, 2016
| +# Description: Permit clients to use Mir | ||
| +# Usage: reserver | ||
| + | ||
| +/usr/share/applications/ r, |
jdstrand
reviewed
Aug 2, 2016
| +getsockopt | ||
| +recvmsg | ||
| +sendmsg | ||
| + |
jdstrand
reviewed
Aug 2, 2016
| +/run/user/*/mir_socket rw, | ||
| +unix (send, receive) peer=(label=###PLUG_SECURITY_TAGS###) | ||
| + | ||
| +`) |
jdstrand
Aug 2, 2016
•
Contributor
This is a bit broad. What is it for, anonymous sockets? Also, please remove the empty line.
kgunnfront
Aug 4, 2016
so for the kiosk style server, it uses /run/mir_socket
and empty line removed
jdstrand
reviewed
Aug 2, 2016
| +/usr/share/applications/ r, | ||
| +/run/mir_socket rw, | ||
| +/run/user/*/mir_socket rw, | ||
| +unix (send, receive) peer=(label=###SLOT_SECURITY_TAGS###) |
jdstrand
reviewed
Aug 2, 2016
| +# Description: Permit clients to use Mir | ||
| +# Usage: reserver | ||
| + | ||
| +/usr/share/applications/ r, |
jdstrand
Aug 2, 2016
Contributor
This is weird-- why would the client need to look in /usr/share/applications/ for connecting to mir?
jdstrand
reviewed
Aug 2, 2016
| + | ||
| +var mirConnectedPlugAppArmor = []byte(` | ||
| +# Description: Permit clients to use Mir | ||
| +# Usage: reserver |
jdstrand
reviewed
Aug 2, 2016
| + | ||
| +capability dac_override, | ||
| +capability sys_tty_config, | ||
| +capability sys_admin, |
jdstrand
reviewed
Aug 2, 2016
| + | ||
| +var mirConnectedSlotAppArmor = []byte(` | ||
| +# Description: Permit clients to use Mir | ||
| +# Usage: reserver |
jdstrand
reviewed
Aug 2, 2016
| + | ||
| +var mirConnectedPlugSecComp = []byte(` | ||
| +# Description: Permit clients to use Mir | ||
| +# Usage: reserver |
jdstrand
Aug 5, 2016
Contributor
You have "# Usage: reserver" (mispelled) for mirConnectedPlugSecComp and mirConnectedPlugAppArmor. This should be "# Usage: common"
jdstrand
reviewed
Aug 2, 2016
| + plug *interfaces.Plug, | ||
| + securitySystem interfaces.SecuritySystem) ([]byte, error) { | ||
| + switch securitySystem { | ||
| + case interfaces.SecurityAppArmor, interfaces.SecuritySecComp, |
jdstrand
Aug 2, 2016
Contributor
You need go fmt on the files again. This case statement is indented too much.
|
Thanks for the updates! This is getting really close in terms of security policy generation and the policy itself. Please see my comments from a few minutes ago. |
pedronis
removed
the
Reviewed
label
Aug 2, 2016
kgunn
added some commits
Aug 3, 2016
|
Please respond to the points individually so we can track what has been done and what is still pending. Marking as Reviewed. |
niemeyer
added
the
Reviewed
label
Aug 4, 2016
kgunn
added some commits
Aug 4, 2016
|
@jdstrand This is ready for a re-review I think. |
jdstrand
reviewed
Aug 8, 2016
| +# Usage: reserved | ||
| +# needed since Mir is the display server, to configure tty devices | ||
| +capability sys_tty_config, | ||
| +unix (receive, send) type=seqpacket addr=none, |
jdstrand
Aug 8, 2016
Contributor
unix (receive, send) type=seqpacket addr=none, should move to mirConnectedSlotAppArmor and be: unix (receive, send) type=seqpacket addr=none peer=(label=###PLUG_SECURITY_TAGS###), then you need to adjust mirConnectedSlotAppArmor to substitute ###PLUG_SECURITY_TAGS### like you do ###SLOT_SECURITY_TAGS### in mirConnectedPlugAppArmor
jdstrand
Aug 8, 2016
Contributor
Actually, I see you already have done that. Can you not just remove unix (receive, send) type=seqpacket addr=none, from mirPermanentSlotAppArmor() altogether?
kgunnfront
Aug 9, 2016
yep, removed the redundant unix (receive, send) type=seqpacket addr=none, from permanent slot
|
@niemeyer - done. Two remaining open questions. |
kgunn
added some commits
Aug 9, 2016
jdstrand
reviewed
Aug 11, 2016
| +# needed since Mir is the display server, to configure tty devices | ||
| +capability sys_tty_config, | ||
| +/dev/shm/\#* rw, | ||
| +/dev/tty* wr, |
jdstrand
Aug 11, 2016
•
Contributor
For consistency, it would be nice if this was 'rw' instead of 'wr' (makes no difference to the policy).
However, /dev/tty* is, I think, too broad since USB serial devices might be found at /dev/ttyUSB*. Assuming you don't intend for mir to configure USN ttys, can you adjust this to be: /dev/tty[0-9]* rw,
(sorry I didn't notice this before).
jdstrand
reviewed
Aug 11, 2016
| +`) | ||
| + | ||
| +var mirPermanentSlotSecComp = []byte(` | ||
| +# Description: Allow operating as the mir service. Reserved because this |
jdstrand
Aug 11, 2016
Contributor
"Description: Allow operating as the mir service." - please s/service/server/ so it is consistent with mirPermanentSlotAppArmor.
jdstrand
reviewed
Aug 11, 2016
| + snippet, err = s.iface.ConnectedSlotSnippet(s.plug, s.slot, "foo") | ||
| + c.Assert(err, Equals, interfaces.ErrUnknownSecurity) | ||
| + c.Assert(snippet, IsNil) | ||
| +} |
jdstrand
Aug 11, 2016
Contributor
Can you add an AutoConnect test?
func (s *NetworkInterfaceSuite) TestAutoConnect(c *C) {
c.Check(s.iface.AutoConnect(), Equals, true)
}
jdstrand
reviewed
Aug 11, 2016
| @@ -34,11 +34,13 @@ var implicitSlots = []string{ | ||
| "hardware-observe", | ||
| "locale-control", | ||
| "log-observe", | ||
| + "mir", |
jdstrand
Aug 11, 2016
Contributor
I think mir should be in implicitClassicSlots, no? On an all snaps system mir is provided as a snap (therefore not needed in implicitSlots) but on a classic system (eg, one with unity8) then mir would be part of the system (that said, there are I think changes that are needed to make this interface work on classic for the unix label rules, but those can be fixed in a later PR). If this is only for kiosks on all-snaps systems (or at least this PR is), perhaps don't have mir be an implicit slot at all.
kgunnfront
Aug 11, 2016
agreed, simply removed until we know more wrt personal and the future, will work through the classic case next
jdstrand
reviewed
Aug 11, 2016
| +# needed since Mir is the display server, to configure tty devices | ||
| +capability sys_tty_config, | ||
| +/dev/shm/\#* rw, | ||
| +/dev/tty[0-9] rw, |
jdstrand
Aug 11, 2016
•
Contributor
Whoops, I think github masked the '*' in my last comment. This should be:
/dev/tty[0-9]* rw,
|
+1 assuming the tests pass. |
|
This looks good now, thank you. |
kgunnfront commentedJun 9, 2016
first cut at mir interface, i tested this locally based on the latest snapd & this wiki for the mir aspect https://developer.ubuntu.com/en/snappy/guides/mir-snaps/