-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security IMA: Fail to set xattr on catatonit #18064
Comments
@giuseppe PTAL |
The interesting thing is that Also, it seems that the binary is copied into the container, it's just that the xattr is not set. Started from alpine here instead of (125)dbadmin@qboro2:~/pgrozav_container_test $ podman stop -t0 pgrozav_test_ima ; podman rm pgrozav_test_ima
pgrozav_test_ima
d2f61db59d6698ab621fd44110108b7f2e7d8d4eaa1e4c5e9b244084718074f2
(0)dbadmin@qboro2:~/pgrozav_container_test $ podman run -d --name=pgrozav_test_ima docker.io/alpine:3.16.2 sleep infinity
479a1328e9b47276a16e1f8fbeabff6bad2646ff995a268dce01804a53326ac6
(0)dbadmin@qboro2:~/pgrozav_container_test $ podman cp /usr/libexec/podman/catatonit pgrozav_test_ima:/root/catatonit --log-level=debug
INFO[0000] podman filtering at log level debug
DEBU[0000] Called cp.PersistentPreRunE(podman cp /usr/libexec/podman/catatonit pgrozav_test_ima:/root/catatonit --log-level=debug)
DEBU[0000] Merged system config "/usr/share/containers/containers.conf"
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /qst/podman_root/dbadmin/libpod/bolt_state.db
DEBU[0000] systemd-logind: Unknown object '/'.
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /qst/podman_root/dbadmin
DEBU[0000] Using run root /run/user/2115/containers
DEBU[0000] Using static dir /qst/podman_root/dbadmin/libpod
DEBU[0000] Using tmp dir /run/user/2115/libpod/tmp
DEBU[0000] Using volume path /qst/podman_root/dbadmin/volumes
DEBU[0000] Set libpod namespace to ""
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that metacopy is not being used
DEBU[0000] Cached value indicated that native-diff is usable
DEBU[0000] backingFs=extfs, projectQuotaSupported=false, useNativeDiff=true, usingMetacopy=false
DEBU[0000] Initializing event backend file
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
INFO[0000] Setting parallel job count to 73
DEBU[0000] Container copy *to* "/root" (resolved: "/root") on container "pgrozav_test_ima" (ID: 479a1328e9b47276a16e1f8fbeabff6bad2646ff995a268dce01804a53326ac6)
Error: 1 error occurred:
* error copying to container: copier: put: error setting extended attributes on "/root/catatonit": error setting value of extended attribute "security.ima" on "/root/catatonit": operation not permitted
(125)dbadmin@qboro2:~/pgrozav_container_test $ podman inspect pgrozav_test_ima | grep UpperDir
"UpperDir": "/qst/podman_root/dbadmin/overlay/19f136657d516599e334b4af899c080760e438550ffa28063fae3d2fa4b93169/diff",
(0)dbadmin@qboro2:~/pgrozav_container_test $ ls -la /qst/podman_root/dbadmin/overlay/19f136657d516599e334b4af899c080760e438550ffa28063fae3d2fa4b93169/diff/root/
total 796
drwx------ 2 dbadmin dba 4096 Apr 5 17:54 .
dr-xr-xr-x 5 dbadmin dba 4096 Apr 5 17:54 ..
-rwxr-xr-x 1 dbadmin dba 806144 Apr 5 17:54 catatonit
(0)dbadmin@qboro2:~/pgrozav_container_test $ cp /usr/libexec/podman/catatonit /qst/podman_root/dbadmin/overlay/19f136657d516599e334b4af899c080760e438550ffa28063fae3d2fa4b93169/diff/root/catatonit
(0)dbadmin@qboro2:~/pgrozav_container_test $ ls -la /qst/podman_root/dbadmin/overlay/19f136657d516599e334b4af899c080760e438550ffa28063fae3d2fa4b93169/diff/root/
total 796
drwx------ 2 dbadmin dba 4096 Apr 5 17:54 .
dr-xr-xr-x 5 dbadmin dba 4096 Apr 5 17:54 ..
-rwxr-xr-x 1 dbadmin dba 806144 Apr 5 17:55 catatonit
(0)dbadmin@qboro2:~/pgrozav_container_test $ I also saw these flags in the code context: However, this command: # Fails on qboro2
(0)dbadmin@qboro2:~/pgrozav_container_test $ cp --preserve=xattr /usr/libexec/podman/catatonit /qst/podman_root/dbadmin/overlay/19f136657d516599e334b4af899c080760e438550ffa28063fae3d2fa4b93169/diff/root/catatonit
cp: setting attribute 'security.ima' for 'security.ima': Operation not permitted
# works in VM
[dbadmin@oracle-linux container]$ cp --preserve=xattr /usr/libexec/podman/catatonit ./catatonit
[dbadmin@oracle-linux container]$ And (0)dbadmin@qboro2:~/pgrozav_container_test $ setfattr -n 'security.ima' -v 'FOO' ./test
setfattr: ./test: Operation not permitted
[dbadmin@oracle-linux container]$ setfattr -n 'security.ima' -v 'FOO' ./catatonit
setfattr: ./catatonit: Operation not permitted Seems to be related to #5781 . |
Finally, I figured it out, why it's not reproduced on my VM(even though it seems to have IMA enabled): (0)dbadmin@qboro2:~ $ getfattr -dm- /usr/libexec/podman/catatonit
getfattr: Removing leading '/' from absolute path names
# file: usr/libexec/podman/catatonit
security.ima=0sAwIEmiKuyQIAmRIpCLtWAbiLXRd5nrJLWgpR9YFxvQAdhudVUSOi/+QRTw0T4b/mOgXT4Mz0CjdoApKgBkY0e9A3gfUHlC+n9+Do65pnONIofb6/ba60esak7gixy1dkArPLYj+CYenLZXk5bSoQkfKaur76ulpC3iAzzULiIiHAatsPW9hKkkfc1QVEyp+Suqd06oMoe7+aAGIDdx+RSi3Mq9wYXXncmTgyihvFAyWniUSGfvm0Kko+tlVjjqGVtRD2CTn2HXtqm4N2grDLT1UytDvP/byZngn7HVqgTuPLo9Gz3rvEDs7A87oI7Qr8LrG4jFZSn78zeBuK//wfseNMJIQ9e2gip0kSwLWjzuaGjMI5pUp5lEPhAkyK/Y/wn4bw2TbDFmGk6uCBbmIytaF54CZBvRcNgaS7QFI92iX+4/fN5YhZZcKO0+6Q5qmmFlJgIl6bKD77uyAnH8hc5WaakKXtOwT82lOvHBSq7NWS4/5cESTcr+omDjEXWeCAfJw77ALZfrOmiR3cCV7yZhyqFW/52un0W9BgOKnTguuXsWRqAi0/BYvx00NFqc/7jp068vFz/fokjQuO1U+90+Q4EyNmT5i7Gqkm6QGZcfoDkY3iIsRQBDDE17CpBOrGfSSAoXWUh45kNb1ARHdihluUy5Rsgi8Wxhfht94laXoWDiohAHyBKe4=
[dbadmin@oracle-linux container]$ getfattr -dm- /usr/libexec/podman/catatonit
[dbadmin@oracle-linux container]$ I was trying with So, I was not able to reproduce it because the file in my VM was not IMA signed. I guess the question that persists is: how can we configure podman to ignore xattr while copying(or continue if setting xattr fails). As a workaround, I managed to avoid the problem by saving the pause image from another machine(without an IMA signed catatonit), and loading it locally(on the machine with IMA signatures) [dbadmin@oracle-linux container]$ podman save -o pause.tgz localhost/podman-pause:4.2.0-1677582426
Copying blob 38af3032cde2 done
Copying config 4a0170bd2f done
Writing manifest to image destination
Storing signatures
# Then copied pause.tgz to qboro2 and loaded it
(0)dbadmin@qboro2:~ $ podman load -i pause.tgz
Getting image source signatures
Copying blob 38af3032cde2 done
Copying config 4a0170bd2f done
Writing manifest to image destination
Storing signatures
Loaded image: localhost/podman-pause:4.2.0-1677582426
(0)dbadmin@qboro2:~ $ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/podman-pause 4.2.0-1677582426 4a0170bd2fa6 18 hours ago 809 kB
docker.io/library/alpine 3.16.2 9c6f07244728 7 months ago 5.83 MB
# Then it finally worked to create a pod:
(0)dbadmin@qboro2:~ $ podman pod create --infra=true --publish=0.0.0.0:13306:3306 --publish=0.0.0.0:19104:9104 --name pod_fcm_db --log-level=debug
INFO[0000] podman filtering at log level debug
DEBU[0000] Called create.PersistentPreRunE(podman pod create --infra=true --publish=0.0.0.0:13306:3306 --publish=0.0.0.0:19104:9104 --name pod_fcm_db --log-level=debug)
DEBU[0000] Merged system config "/usr/share/containers/containers.conf"
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /qst/podman_root/dbadmin/libpod/bolt_state.db
DEBU[0000] systemd-logind: Unknown object '/'.
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /qst/podman_root/dbadmin
DEBU[0000] Using run root /run/user/2115/containers
DEBU[0000] Using static dir /qst/podman_root/dbadmin/libpod
DEBU[0000] Using tmp dir /run/user/2115/libpod/tmp
DEBU[0000] Using volume path /qst/podman_root/dbadmin/volumes
DEBU[0000] Set libpod namespace to ""
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] overlay: storage already configured with a mount-program
DEBU[0000] backingFs=extfs, projectQuotaSupported=false, useNativeDiff=false, usingMetacopy=false
DEBU[0000] Initializing event backend file
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
INFO[0000] Setting parallel job count to 73
DEBU[0000] Adding port mapping from 13306 to 3306 length 1 protocol ""
DEBU[0000] Adding port mapping from 19104 to 9104 length 1 protocol ""
DEBU[0000] Looking up image "localhost/podman-pause:4.2.0-1677582426" in local containers storage
DEBU[0000] Normalized platform linux/amd64 to {amd64 linux [] }
DEBU[0000] Trying "localhost/podman-pause:4.2.0-1677582426" ...
DEBU[0000] parsed reference into "[overlay@/qst/podman_root/dbadmin+/run/user/2115/containers]@4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Found image "localhost/podman-pause:4.2.0-1677582426" as "localhost/podman-pause:4.2.0-1677582426" in local containers storage
DEBU[0000] Found image "localhost/podman-pause:4.2.0-1677582426" as "localhost/podman-pause:4.2.0-1677582426" in local containers storage ([overlay@/qst/podman_root/dbadmin+/run/user/2115/containers]@4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933)
DEBU[0000] exporting opaque data as blob "sha256:4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Created cgroup path user.slice/user-libpod_pod_e355f6f2756a840cf859c54e9979748e6910049125263ed6fca4b18604488f52.slice for parent user.slice and name libpod_pod_e355f6f2756a840cf859c54e9979748e6910049125263ed6fca4b18604488f52
DEBU[0000] Created cgroup user.slice/user-libpod_pod_e355f6f2756a840cf859c54e9979748e6910049125263ed6fca4b18604488f52.slice
DEBU[0000] Got pod cgroup as user.slice/user-libpod_pod_e355f6f2756a840cf859c54e9979748e6910049125263ed6fca4b18604488f52.slice
DEBU[0000] Looking up image "localhost/podman-pause:4.2.0-1677582426" in local containers storage
DEBU[0000] Normalized platform linux/amd64 to {amd64 linux [] }
DEBU[0000] Trying "localhost/podman-pause:4.2.0-1677582426" ...
DEBU[0000] parsed reference into "[overlay@/qst/podman_root/dbadmin+/run/user/2115/containers]@4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Found image "localhost/podman-pause:4.2.0-1677582426" as "localhost/podman-pause:4.2.0-1677582426" in local containers storage
DEBU[0000] Found image "localhost/podman-pause:4.2.0-1677582426" as "localhost/podman-pause:4.2.0-1677582426" in local containers storage ([overlay@/qst/podman_root/dbadmin+/run/user/2115/containers]@4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933)
DEBU[0000] exporting opaque data as blob "sha256:4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Inspecting image 4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933
DEBU[0000] exporting opaque data as blob "sha256:4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] exporting opaque data as blob "sha256:4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Inspecting image 4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933
DEBU[0000] Inspecting image 4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933
DEBU[0000] Inspecting image 4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933
DEBU[0000] using systemd mode: false
DEBU[0000] setting container name e355f6f2756a-infra
DEBU[0000] Loading seccomp profile from "/usr/share/containers/seccomp.json"
DEBU[0000] Allocated lock 2 for container 8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201
DEBU[0000] parsed reference into "[overlay@/qst/podman_root/dbadmin+/run/user/2115/containers]@4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] exporting opaque data as blob "sha256:4a0170bd2fa6dbb0bd094e3dd7ec7c211b99fff127def0c6141f00c1db37e933"
DEBU[0000] Created container "8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201"
DEBU[0000] Container "8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201" has work directory "/qst/podman_root/dbadmin/overlay-containers/8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201/userdata"
DEBU[0000] Container "8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201" has run directory "/run/user/2115/containers/overlay-containers/8ad1e2b7246ed2cfea57cc917f47d1b2077424b469e2211778e3e80be7fd2201/userdata"
e355f6f2756a840cf859c54e9979748e6910049125263ed6fca4b18604488f52
DEBU[0000] Called create.PersistentPostRunE(podman pod create --infra=true --publish=0.0.0.0:13306:3306 --publish=0.0.0.0:19104:9104 --name pod_fcm_db --log-level=debug)
(0)dbadmin@qboro2:~ $ echo ${?}
0 by the way, can we pull this image from a registry ? Seems related to: #11256 . |
couldn't you copy the catatonit file somewhere else and use that (with |
My context (as in the oracle documentation) was Is there a way I could provide the "Path to the container-init binary" to Or, the alternative(with lower chances of success) would be to create the "infra" container using regular Maybe a possible alternative would be to somehow use I've tested the latter idea, and it seems to be working 😃 (0)dbadmin@qboro2:~ $ podman pod create --infra=true --infra-image=busybox:1.36.0 --infra-command="sleep infinity" --publish=0.0.0.0:8153:80 --name pgrozav_ima_test
c1d03e1539f733d4b782d3c0f72aa87b78bd5bc84d43865a0b763319b22d66dc
(0)dbadmin@qboro2:~ $ podman run --pod pgrozav_ima_test --name some-nginx -d docker.io/nginx:1.23.4
9666a89ceeadcd4de9c6cf5461743b8ffcd0d0e1b45f796abd3d15532014db9d
(0)dbadmin@qboro2:~ $ curl -vvv http://qboro2:8153/
* Trying 192.168.200.95:8153...
* Connected to qboro2 (192.168.200.95) port 8153 (#0)
> GET / HTTP/1.1
> Host: qboro2:8153
> User-Agent: curl/7.76.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.23.4
...
</html>
* Connection #0 to host qboro2 left intact
(0)dbadmin@qboro2:~ $ podman pod stop -t0 pgrozav_ima_test && podman pod rm pgrozav_ima_test
c1d03e1539f733d4b782d3c0f72aa87b78bd5bc84d43865a0b763319b22d66dc
c1d03e1539f733d4b782d3c0f72aa87b78bd5bc84d43865a0b763319b22d66dc So, at least we have a working solution even on Oracle :) - I'm not sure how important it is to run catatonit or that exact |
Issue Description
I can not create a pod (infra) on an Oracle Linux 9.1 UEK with IMA(Integrity Measurement Architecture).
This seems to be a known issue, and described by Oracle in their podman manual: https://docs.oracle.com/en/operating-systems/oracle-linux/podman/podman-KnownIssues.html#topic_efh_1n3_55b
From their manual:
Podman Pod Create Fails on Oracle Linux 9 For An Unprivileged User With IMA Enabled
On systems, such as Oracle Linux 9, where Integrity Measurement Architecture (IMA) is enabled and enforcing, running podman pod create as an unprivileged user can fail with an error similar to:
This issue occurs because the catatonit binary, used by Podman to provide init services to containers, is an IMA signed file and unprivileged users do not have permissions to set security extended attributes (xattrs) on the file system.
(Bug 34578553)
I'm not sure about the bug ID 34578553 - I guess it points to a bug in their internal(not open) issue tracking system.
I am pretty sure that this is an OS configuration issue, probably not podman's fault, but I couldn't find much info about this online, and I thought I should open a ticket on a public system.
Do you have any idea what I could change in the OS config to allow podman to work?
Also, I'm not sure if podman could skip applying xattrs on the copied binary (or maybe make it a non-fatal error?) - or if it is always important to keep the xattrs.
Steps to reproduce the issue
I have a similar VM and I can't reproduce the issue there 😞 - I'm not sure what's different. I will keep trying and come back with details as I have them.
Describe the results you received
While creating the podman-pause container image (from scratch) it tries to
COPY /usr/libexec/podman/catatonit /catatonit
and I guess it tries to keep the extended attributes by setting them on the destination binary(same as on the source binary).Although I can't see any xattrs on the source file either:
Describe the results you expected
I was hoping that it would create the pod - something similar to:
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
(0)dbadmin@server:~ $ cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.1"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.1"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:1:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.1
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.1
(0)dbadmin@server:~ $ uname -a
Linux qboro2 5.15.0-8.91.4.1.el9uek.x86_64 #2 SMP Tue Mar 7 21:03:42 PST 2023 x86_64 x86_64 x86_64 GNU/Linux
Additional information
The
podman pod create
command works on root, on the same system.I was also thinking about using a custom IMA policy to, somehow allow setting xattrs on a certain executable, or to a certain user - but I'm not sure if that's configurable through the IMA policy or would require mounting with
user_xattr
.I saw that podman is mounting with
userxattr
and both my partitions are missing that mount flag:The text was updated successfully, but these errors were encountered: