Hi Ben,
On Sat, 2017-11-11 at 18:22 +0100, 'Benedikt Niedermayr' via isar-users
wrote:
We already using such a wrapper, that does sort of what you want:
https://github.com/siemens/kas
It does not wrap around docker itself, but around bitbake and a ready
prepared docker container is available:
https://hub.docker.com/r/kasproject/kas-isar/
Patches and feature requests welcome.
> I know there are some problems getting a docker container secure,
> but
> maybe a focus on trying to get a docker based isar build secure, is
> easier to reach than the our current approaches?
>
> It is possible to drop some capabilities for docker in order to make
> it
> more secure (e.g. don't allow to create dev files).
>
> A mount command is also not required since, new versions of mkfs
> have
> the "-d" option included (specifiy a directory, which copied into
> the
> filesystem image). So no sys_admin capabilities would be needed.
>
> It is also possible to customize other things within the container
> to
> make it more secure:
>
> - Add only required commands to sudoers file.
Problem here are the additional layers that might add additional
programs that need to be run with root privileges. That is not
something that can be controlled easily.
>
> - Modify permissions to files/directories.
Who cares if the container gets corrupted, of course we should mount
every 'source' directory into the container read-only.
>
> - Think about which commands within isar really need root
> privileges,
> and drop those.
Don't think that really helps, because there are so many programs that
might require root privileges, depending on the custom recipe.
Also if 'postinst' is run as root, you could put any command there that
is run as root user.
>
> I think, if somebody seriously wants to exploit the container, he
> will
> also reach that with a non-root based build.
If we are giving up on trying to remove the root dependency of the
build, then I would rather go with preparing a vagrant file instead of
a container. We would have better isolation there and don't really need
to care about capabilities.
Otherwise I would still suggest to patch proot to support the
additional syscalls (chown, chmod, mknod, ...), save those into a file
and allow proot to load this file via a parameter. Then we would have
something like pseudo, but better. Since pseudo and fakeroot does not
work with static binaries. (And this is what I thought Alex was looking
into.)
Cheers,
Claudius
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone:
(+49)-8142-66989-54 Fax:
(+49)-8142-66989-80 Email:
c...@denx.de
PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
Keyserver: hkp://
pool.sks-keyservers.net