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

Changing file mode for secret volumes - required for ssh keys. #47

@hterik

Description

@hterik

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions