Page MenuHomePhabricator

Write admission controller disabling mounting of unauthorized volumes
Closed, ResolvedPublic

Description

Pods should only be able to mount /data/project/, /data/scratch and /public (readonly). Nothing else.

Event Timeline

yuvipanda raised the priority of this task from to Needs Triage.
yuvipanda updated the task description. (Show Details)
yuvipanda added subscribers: Joe, Aklapper, yuvipanda.
yuvipanda moved this task from To do to Doing on the Labs-Sprint-115 board.
valhallasw subscribed.

Not sure if I agree with that. Projects can currently read other files on NFS if permissions allow, and I'm not sure if it should be different in k8s.

yuvipanda raised the priority of this task from Low to Medium.Oct 4 2015, 5:07 PM

Sure! But they still should be disallowed from mounting /etc as rw on the host, since there are otherwise ways to compromise the host machine :)

I think T116504 solves this now - since you can mount host volumes as much as you want but they won't be running as root so you can't do much damage.

Need to verify this, of course.

yuvipanda claimed this task.

Closed with https://phabricator.wikimedia.org/T116504 which is a more general and better solution.

This is actually necessary, since the containers still run with gid 0. Even though it doesn't have special privs unlike uid 0, lots of filesystem paths are owned by gid 0 and might accidentally be writeable by these. So let's write an admission controller to provide added defense in depth.

Change 288808 had a related patch set uploaded (by Yuvipanda):
tools: Enable HostPathEnforcer admission controller

https://gerrit.wikimedia.org/r/288808

Done and deployed!

Change 288808 merged by Yuvipanda:
tools: Enable HostPathEnforcer admission controller

https://gerrit.wikimedia.org/r/288808