Commit f6a71c2
xenstored_t needs CAP_SYS_ADMIN for XENSTORETYPE=domain (bsc#1247875)
When `XENSTORETYPE=domain` and `XENSTORE_DOMAIN_KERNEL=/usr/libexec/xen/boot/xenstore-stubdom.gz`
are configured in `/etc/sysconfig/xencommons`, `/etc/xen/scripts/launch-xenstore` will
start `/usr/lib/xen/bin/init-xenstore-domain`.
Add a boolean `xenstored_use_store_type_domain` to allow that use case
and include rules from 543479a
in the boolean as well.
1. `/usr/lib/systemd/system/xenstored.service` starts `/etc/xen/scripts/launch-xenstore` as `xenstored_t`
2. which in turn starts `/usr/lib/xen/bin/init-xenstore-domain `(also running as `xenstored_t`)
3. init-xenstore-domain opens `/dev/xen/xenbus_backend`: https://github.com/xen-project/xen/blame/b99227347230281699b5d8b5e677829f91c6e199/tools/helpers/init-xenstore-domain.c#L102
4. this requires CAP_SYS_ADMIN: https://github.com/torvalds/linux/blob/320475fbd590dc94a0a3d9173f81e0797ee1a232/drivers/xen/xenbus/xenbus_dev_backend.c#L24
5. therefor allow xenstored_t sys_admin capabilities
Adresses:
```
type=AVC msg=audit(1757596406.536:40): avc: denied { sys_admin } for pid=1385 comm="init-xenstore-d" capability=21 scontext=system_u:system_r:xenstored_t:s0 tcontext=system_u:system_r:xenstored_t:s0 tclass=capability permissive=0
```
With full auditing:
```
----
type=PROCTITLE msg=audit(09/12/2025 11:05:27.943:50) : proctitle=/usr/lib/xen/bin/init-xenstore-domain --kernel /usr/lib/xen/boot/xenstore-stubdom.gz --memory 32 --maxmem 1/100
type=PATH msg=audit(09/12/2025 11:05:27.943:50) : item=0 name=/dev/xen/xenbus_backend inode=89 dev=00:06 mode=character,600 ouid=root ogid=root rdev=0a:103 obj=system_u:object_r:xen_device_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(09/12/2025 11:05:27.943:50) : cwd=/
type=SYSCALL msg=audit(09/12/2025 11:05:27.943:50) : arch=x86_64 syscall=openat success=no exit=EPERM(Operation not permitted) a0=AT_FDCWD a1=0x55b97a9050a1 a2=O_RDWR a3=0x0 items=1 ppid=1025 pid=1044 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=init-xenstore-d exe=/usr/lib/xen/bin/init-xenstore-domain subj=system_u:system_r:xenstored_t:s0 key=(null)
type=AVC msg=audit(09/12/2025 11:05:27.943:50) : avc: denied { sys_admin } for pid=1044 comm=init-xenstore-d capability=sys_admin scontext=system_u:system_r:xenstored_t:s0 tcontext=system_u:system_r:xenstored_t:s0 tclass=capability permissive=0
```1 parent aaa7ae7 commit f6a71c2
1 file changed
+14
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
421 | 428 | | |
422 | 429 | | |
423 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
424 | 438 | | |
425 | 439 | | |
426 | 440 | | |
| |||
449 | 463 | | |
450 | 464 | | |
451 | 465 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | 466 | | |
458 | 467 | | |
459 | 468 | | |
| |||
0 commit comments