This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Description
Trying to mount a private ssh key to a container using secret volume.
However the secret file is always mounted with mode 664. Which will cause SSH to reject the key with following error:
$ ssh -o BatchMode=yes -i /volumesecrets/key some.internal.host command
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/volumesecrets/key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/volumesecrets/key": bad permissions
Trying to change the mode from within the container does not work since the volume mount is readonly:
$ chmod 0400 /volumesecrets/key
chmod: changing permissions of '/volumesecrets/key': Read-only file system
Is there any way we can configure the chmod of the files mounted?