The snap format is part of Ubuntu Core, a modern software platform that includes the ability to define rich interfaces between snaps that control their security and confinement, comprehensive observation and control of system changes, completion and undoing of partial system changes across restarts/reboots/crashes, macaroon-based authentication for local access and store access, preliminary development mode, a polished filesystem layout and CLI experience, modern sequencing of revisions, and so forth.
The previous post in this series described the reassuring details behind how snappy does system changes. This post will now cover interfaces, the mechanism that controls the confinement and integration of snaps with other snaps and with the system itself.
A snap interface gives one snap the ability to use resources provided by another snap, including the operating system snap (ubuntu-core is itself a snap!). That’s quite vague, and intentionally so. Software interacts with other software for many reasons and in diverse ways, and Snappy is a platform that has to mediate all of that according to user needs.
In practice, though, the mechanism is straightforward and pleasant to deal with. Without any snaps in the system, there are no interfaces available:
% sudo snap interfaces error: no interfaces found
If we install the ubuntu-core snap alone (done implicitly when the first snap is installed), we can already see some interface slots being provided by it, but no plugs connected to them:
% sudo snap install ubuntu-core 75.88 MB / 75.88 MB [=====================] 100.00 % 355.56 KB/s % snap interfaces Slot Plug :firewall-control - :home - :locale-control - (...) :opengl - :timeserver-control - :timezone-control - :unity7 - :x11 -
The syntax is <snap>:<slot> and <snap>:<plug>. The lack of a snap name is a shorthand notation for slots and plugs on the operating system snap.
Now let’s install an application:
% sudo snap install ubuntu-calculator-app 120.01 MB / 120.01 MB [=====================] 100.00 % 328.88 KB/s % snap interfaces Slot Plug :firewall-control - :home - :locale-control - (...) :opengl ubuntu-calculator-app :timeserver-control - :timezone-control - :unity7 ubuntu-calculator-app :x11 -
At this point the application should work fine. But let’s instead see what happens if we take away one of these interfaces:
% sudo snap disconnect \ ubuntu-calculator-app:unity7 ubuntu-core:unity7 % /snap/bin/ubuntu-calculator-app.calculator QXcbConnection: Could not connect to display :0
The application installed depends on unity7 to be able to display itself properly, which is itself based on X11. When we disconnected the interface that gave it permission to be accessing these resources, the application was unable to touch them.
The security minded will observe that X11 is not in fact a secure protocol. A number of system abuses are possible when we hand an application this permission. Other interfaces such as home would give the snap access to every non-hidden file in the user’s $HOME directory (those that do not start with a dot), which means a malicious application might steal personal information and send it over the network (assuming it also defines a network plug).
Some might be surprised that this is the case, but this is a misunderstanding about the role of snaps and Snappy as a software platform. When you install software from the Ubuntu archive, that’s a statement of trust in the Ubuntu and Debian developers. When you install Google’s Chrome or MongoDB binaries from their respective archives, that’s a statement of trust in those developers (these have root on your system!). Snappy is not eliminating the need for that trust, as once you give a piece of software access to your personal files, web camera, microphone, etc, you need to believe that it won’t be using those allowances maliciously.
The point of Snappy’s confinement in that picture is to enable a software ecosystem that can control exactly what is allowed and to whom in a clear and observable way, in addition to the same procedural care that we’ve all learned to appreciate in the Linux world, not instead of it. Preventing people from using all relevant resources in the system would simply force them to use that same software over less secure mechanisms instead of fixing the problem.
And what we have today is just the beginning. These interfaces will soon become much richer and more fine grained, including resource selection (e.g. which serial port?), and some of them will disappear completely in favor of more secure choices (Unity 8, for instance).
These are exciting times for Ubuntu and the software world.
Ubuntu offers all the training, software infrastructure, tools, services and support you need for your public and private clouds.
Rigado customers will benefit from open source, cost-effective, secure software in their commercial IoT deployments London, UK – 21st February 2018 – Canonical, the company behind Ubuntu, today announced that Ubuntu Core will be deployed…
As details of the Meltdown and Spectre vulnerabilities1 have become clearer a number of statements have been published by the multiple vendors affected; Canonical has issued advisories and updates on fixes and mitigations, the latest of…
Canonical holds Ubuntu to the highest standards of security and quality. This week we published candidate Ubuntu kernels providing mitigation for CVE-2017-5715 and CVE-2017-5753 (ie, Spectre / Variants 1 & 2) to their respective…