Open xSmurf opened 7 years ago
For your reference:
Runc uses the following struct to define devices.
The DeviceFromPath(path, permissions string) (*configs.Device, error)
function in this file is useful for filling in that struct, if you know the path to a device.
Here are some default devices that should probably be allowed in order to get most programs to work:
Here is how we actually communicate with cgroups in order to allow those devices:
Basically, runc has these device structs with proper major and minor numbers (it is only the major and minor numbers that cgroups cares about) and then we write allow and deny commands to the cgroups devices file. The '*' symbol allows us to match all minor numbers.
So to do a proper whitelist, as per the last file listed, you start by telling cgroups to deny all devices:
writeFile(path, "devices.deny", "a")
You then follow up by explicitly allowing the devices you want to allow:
" writeFile(path, "devices.allow", dev.CgroupString())" https://github.com/opencontainers/runc/blob/52454cf90807727923b375afd7d84ac8fd523959/libcontainer/cgroups/fs/devices.go#L52 This is just for inspiration though. As far as I can tell, the current code is actually broken and wrong :P But it has enough working elements that it could save you time some time doing research...
Tim
On 02/26/2017 08:45 PM, xSmurf wrote:
Needed for subgraph/subgraph-os-issues#215 https://github.com/subgraph/subgraph-os-issues/issues/215
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/subgraph/oz/issues/94#issuecomment-282581429, or mute the thread https://github.com/notifications/unsubscribe-auth/ABU7-DDryBTLpGGoB1J4zUYn0_62qj0rks5rgdZegaJpZM4MMfU7.
Is there any workaround (ex: for specific situations like subgraph/subgraph-os-issues#215 ) or is device support comprehensively blocked on this issue? For instance: I see https://twitter.com/attractr/status/850776132307890181, but no documentation for how that's done.
I wrote code in Oz to do it, but it isn't finished. I should get on that. What I added was support for cgroups in sandboxes (to whitelist device major/minor numbers) and some very basic udev scripts to tell Oz when devices are plugged in. Oz would then create the device nodes in the sandboxes that "subscribe" to the device in their profile.
But it wasn't complete:
At that point I stopped temporarily. So, still some amount of work left to do to get this delivered for users. I intend to finish it..
For the screenshot I posted, I'd manually created the nodes in the sandbox (with a restrictive cgroup device whitelist configured by Oz).
We need cgroups and general device support for things like U2F.