-
Notifications
You must be signed in to change notification settings - Fork 275
Description
Tell us about your request
A configurable mechanism to have Docker unmount secrets when they're no longer needed.
Which service(s) is this request for?
Docker Swarm
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Currently, secrets are left mounted in the container for the lifetime of the container. This leaves secrets vulnerable if a container is compromised.
Additional context
A possible solution would be to add an unmount section to the long-form secrets definition in a service. An example might be:
services:
frontend:
image: example/webapp
secrets:
- source: server-certificate
target: server.cert
unmount_on:
condition: service_healthy
timeout: 1m
One umount clause might be sufficient, but unmounting on first matched clause would also make sense.
One issue is if a process reads a secret, but leaves the file open. This would presumably cause the unmount to fail. I'm not sure if this should just be logged as an error, or treated as a fatal event since the container would not be in the expected state with a secret left mounted.