interfaces: add consoles interface #3051

Closed
wants to merge 14 commits into
from

Conversation

Projects
None yet
8 participants
Contributor

femdom commented Mar 17, 2017

To allow access to the /dev/tty0 and /dev/console

femdom added some commits Mar 17, 2017

@ogra1 ogra1 self-requested a review Mar 20, 2017

Contributor

ogra1 commented Mar 20, 2017

i dont think this will fly as is, most ubuntu-core installs will actually use a different console= option to run their IoT devices with serial console etc ... the apparmor managing code should better parse /proc/cmdline and grab the console= arg from there instead of hardcoding tty0
(hardcoding /dev/console seems fine OTOH)

We'll need to change at least the interface name to the singular ("console") as usual in most (all?) of the interfaces.

Also, can you please provide some more background so we can understand the demand for this interface, can take the appropriate action regarding what @ogra1 is pointing out?

Note that we can most likely be exactly precise, and open up access just the one correct console device.

We also need to be very careful with this interface, as it hands off access to what is being typed. We'll need a review from @jdstrand on those details.

Contributor

femdom commented Mar 24, 2017

@niemeyer

Also, can you please provide some more background so we can understand the demand for this interface, can take the appropriate action regarding what @ogra1 is pointing out?

Our software tries to access /dev/tty0 or /dev/console or /dev/tty qlinuxfbscreen.cpp

stolowski added some commits Mar 27, 2017

Contributor

stolowski commented Mar 27, 2017

@femdom FYI, I've updated this PR for the new API changes in master.

Contributor

femdom commented Mar 28, 2017

@stolowski, thank you!

Some comments.

interfaces/builtin/consoles.go
+ return "consoles"
+}
+
+func (iface *ConsolesInterface) String() string {
@zyga

zyga Mar 31, 2017

Contributor

I don't think we need the String method really

interfaces/builtin/consoles.go
+
+func (iface *ConsolesInterface) UdevConnectedPlug(spec *udev.Specification, plug *interfaces.Plug, slot *interfaces.Slot) error {
+ for appName := range plug.Apps {
+ tag := udevSnapSecurityName(plug.Snap.Name(), appName)
@zyga

zyga Mar 31, 2017

Contributor

This begs to be one function but this is not a material for this PR

interfaces/builtin/consoles.go
+
+ // Creation of the slot of this type
+ // is allowed only by a gadget or os snap
+ if !(slot.Snap.Type == "os") {
@mvo5

mvo5 Apr 3, 2017

Collaborator

I think we want snap.TypeOS here instead of hardcoding the string.

Contributor

jdstrand commented Apr 3, 2017

FYI, this interface is on my list for review but it will take a little while to get through everything.

Contributor

femdom commented Apr 25, 2017

Should I fix addressed issues?

Contributor

jdstrand commented Apr 25, 2017

Please feel free to address any review feedback, yes. It is still on my list to review and still will take quite a bit of time to get through everything. It has unfortunately fallen behind a number of other items, but we'll get there.

Contributor

niemeyer commented Apr 26, 2017

@jdstrand Any news here? We're making a push to get the queue clean this week:

https://forum.snapcraft.io/t/review-sprint-1/377

Contributor

jdstrand commented Apr 26, 2017

@niemeyer - I'd like to study the tty subsystem for this PR to better understand it. I mentioned yesterday that this PR has fallen behind other work-- that work is mostly items from https://forum.snapcraft.io/t/review-sprint-1/377 (atm, bash completion, but several others after that).

This PR won't be reviewed this week at this point.

Nitpick

interfaces/builtin/consoles.go
+
+ // Creation of the slot of this type
+ // is allowed only by a gadget or os snap
+ if !(slot.Snap.Type == "os") {
@zyga

zyga Apr 28, 2017

Contributor

Nitpick: can this please say if slot.Snap.Type != snap.TypeOS { ... } please?

Contributor

zyga commented May 8, 2017

I'll work on this first thing tomorrow. I'll review it again, apply all the feedback and get it ready for another review.

@zyga zyga added the Blocked label May 9, 2017

Contributor

zyga commented May 9, 2017

After discussing with @jdstrand I'm marking this interface as blocked. It requires additional research into the kernel tty layers to determine if the security is sensible.

zyga approved these changes May 11, 2017

zyga added some commits May 11, 2017

interfaces/builtin: apply lifting to the consoles interface
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/builtin: make ConsolesInterface private
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Member

chipaca commented Jul 10, 2017

What's the state of this PR?

@chipaca chipaca added the Decaying label Jul 10, 2017

Contributor

jdstrand commented Jul 10, 2017

@chipaca - still blocked behind other higher priority work, but it is in the queue and not lost.

Member

chipaca commented Jul 10, 2017

OK. It'll need some serious de-conflicting I fear.

Contributor

ogra1 commented Jul 11, 2017

can we please also have the sys_tty_config capability, something taking over the console might want to reconfigure the tty as well...

Contributor

zyga commented Jul 11, 2017

I just de-conflicted it, I will iterate some more to add modern meta-data and simplify a few things.

Contributor

jdstrand commented Jul 11, 2017

Since this continues to wait on me, I'm happy to deconflict it as needed (though I see @zyga did this already). For now I'm going to close this PR but will reopen when it is at the top of the queue.

@jdstrand jdstrand closed this Jul 11, 2017

zyga added some commits Jul 11, 2017

interfaces/builtin: discard consolesInterface.String
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/builtin: helpers for common sanitization tasks
The helpers do the interface<->{plug,slot} interface match chek
and that slot is reserved for OS snap (and is only defined on OS
snaps).

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/builtin: simplify consolesInterface.Sanitize{Plug,Slot}
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/buitlin: add summary to the consoles interfaces
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Contributor

zyga commented Jul 11, 2017

I'll re-open this briefly to push my changes :)

@zyga zyga reopened this Jul 11, 2017

Contributor

zyga commented Jul 11, 2017

Pushed, closing again :)

@zyga zyga closed this Jul 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment