I'd like to set up a hardened dockerDocker instance, mostly for running micro-services such as statically compiled golang applications. What I'm looking for is to protect the host OS from a rogue container and containers from one another. I tried to summarize the situation with the following scenario.
On this server runs a dockerDocker instance with 2 running containers, A and B and a volume V.
- The linux kernel has bugs but grsec is enough to cover that. Can't be an attack vector unless grsec is deactivated
- Grsec and SElinux don't have bugs and aren't mis-configured.
- A user root in the container is root outside the container (maybe some day this won't be true anymore...)
- Docker is a real-world dockerDocker. No known-bugs but has been affected by bugs in the past and it could happen again.
- A log system for future investigation is already properly set up.
goalGoal:
- Protect the flags. Probably not possible since we assume that dockerDocker has bugs.
- Reducing the attack surface.
- Make the attacker's life difficult.
- Set an alarm that trigger if the attacker tries to get the flags. Preferably way before he managed to get them.
- How realistic are my assumptions ?
- How would you achieve those goals ?
- How goods are my following suggestions ?
- Any general security advice for docker Docker?
myMy suggestions:
- Configure SElinux such as no user can write on A, and no user can execute files on V.
Configure SElinux such as no user can write on A, and no user can execute files on V.
- Use an extremely minimal docker image, without any userland. Something like:
Use an extremely minimal Docker image, without any userland. Something like:
FROM scratch COPY app / ENTRYPOINT ["/app"]
FROM scratch COPY app / ENTRYPOINT ["/app"] - De-escalate privilege before running the app. (Not sure what is the proper way to do that...)
De-escalate privilege before running the app. (Not sure what is the proper way to do that...)
- A fake busybox user-land ? Something that would trigger an alarm if we try to call /bin/sh, /bin/ls or anything like that.
A fake busybox user-land? Something that would trigger an alarm if we try to call
/bin/sh,/bin/lsor anything like that.