Skip to content

Document issues with podman/selinux #23623

Open
@mjlbach

Description

@mjlbach

Feature Description

I run Fedora/CoreOS and as such was following along the docker rootless tutorial using podman.

After following the section on enabling ssh passthrough, it will silently fail due to selinux permission issues.

If you try to clone a git repo:

❯ git clone git@git.test.com:mjlbach/test.git
Cloning into 'test'...
git@git.test.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

As seen in systemd-journal with sudo journalctl -feu sshd:

Mar 21 17:55:17 nomad sshd[9212]: error: AuthorizedKeysCommand execve "/usr/bin/podman exec -i systemd-gitea /usr/local/bin/gitea keys -c /etc/gitea/app.ini -e git -u git -t ssh-ed25519 -k REDACTED": Permission denied
Mar 21 17:55:17 nomad sshd[9210]: AuthorizedKeysCommand /usr/bin/podman exec -i systemd-gitea /usr/local/bin/gitea keys -c /etc/gitea/app.ini -e git -u git -t ssh-ed25519 -k REDACTED failed, status 127
Mar 21 17:55:17 nomad sshd[9210]: Connection closed by authenticating user git REDACTED port 51284 [preauth]

The underlying culprit can be viewed in the SELinux logs:

❯ sudo ausearch -c 'sshd' --raw
type=AVC msg=audit(1679432260.930:359): avc:  denied  { execute } for  pid=2081 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679432388.316:426): avc:  denied  { execute } for  pid=2305 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=1
type=AVC msg=audit(1679432388.316:427): avc:  denied  { read open } for  pid=2305 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=1
type=AVC msg=audit(1679432388.316:428): avc:  denied  { execute_no_trans } for  pid=2305 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=1
type=AVC msg=audit(1679432821.749:329): avc:  denied  { execute } for  pid=2005 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679432921.520:370): avc:  denied  { read open } for  pid=2119 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679432945.018:239): avc:  denied  { read open } for  pid=1374 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679433004.809:339): avc:  denied  { read open } for  pid=1831 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679433022.644:374): avc:  denied  { read open } for  pid=2034 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679433191.667:323): avc:  denied  { execute_no_trans } for  pid=1980 comm="sshd" path="/usr/bin/podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679446517.354:8485): avc:  denied  { execute } for  pid=9212 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679446521.233:8497): avc:  denied  { execute } for  pid=9223 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0
type=AVC msg=audit(1679448352.006:8605): avc:  denied  { execute } for  pid=9973 comm="sshd" name="podman" dev="vda4" ino=36775453 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_runtime_exec_t:s0 tclass=file permissive=0

I'm opening this issue for visibility incase others attempt to use rootless podman with ssh forwarding. I've also opened an issue with podman: containers/podman#17883. I'm trying to debug this/come up with a good workaround (or installable selinux policy). Feel free to close, but I'll also document here how to use gitea/podman/coreos once I figure it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/distributionThis PR changes something about the packaging of Giteatype/bugtype/docsThis PR mainly updates/creates documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions