mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-19 08:52:15 +00:00
fix(xcat-core): three paths the file contexts get wrong
The wrapper /opt/xcat/bin/genimage carried the image entrypoint, so a command that writes a request to the socket ran with the authority to relabel every type. It is now a client. The build still reaches xcat_image_t: the plugin, and the --interactive mode of the wrapper, run the per-OS program through a shell, and that exec transitions from either caller domain. The per-OS geninitrd gets its own line, because most of those names are symlinks to their sibling genimage but netboot/fedora12/geninitrd is a real program, and the genimage glob never matches it. /opt/xcat/bin/xcatDBcmds is labelled as a client. It is the third dispatcher, reached by 12 symlinks including lsdef, chdef, mkdef and rmdef, and without this they ran in the caller's domain while rpower ran in xcat_t. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
/opt/xcat/sbin/xcatd -- gen_context(system_u:object_r:xcatd_exec_t,s0)
|
||||
/opt/xcat/bin/xcatclient -- gen_context(system_u:object_r:xcat_client_exec_t,s0)
|
||||
/opt/xcat/bin/xcatclientnnr -- gen_context(system_u:object_r:xcat_client_exec_t,s0)
|
||||
/opt/xcat/bin/xcatDBcmds -- gen_context(system_u:object_r:xcat_client_exec_t,s0)
|
||||
/opt/xcat/bin/genimage -- gen_context(system_u:object_r:xcat_client_exec_t,s0)
|
||||
|
||||
# The entrypoints of the image build. The wrapper and the per-OS program are
|
||||
# both real files; packimage and liteimg are symlinks to xcatclientnnr, so the
|
||||
# work they ask for runs in xcat_t.
|
||||
/opt/xcat/bin/genimage -- gen_context(system_u:object_r:xcat_image_exec_t,s0)
|
||||
# The entrypoints of the image build are the per-OS programs. The geninitrd
|
||||
# name needs its own line: most are symlinks to their sibling genimage, but
|
||||
# netboot/fedora12/geninitrd is a real program. packimage and liteimg are
|
||||
# symlinks to xcatclientnnr, so the work they ask for runs in xcat_t.
|
||||
/opt/xcat/share/xcat/netboot/[^/]+/genimage -- gen_context(system_u:object_r:xcat_image_exec_t,s0)
|
||||
/opt/xcat/share/xcat/netboot/[^/]+/geninitrd -- gen_context(system_u:object_r:xcat_image_exec_t,s0)
|
||||
|
||||
/install(/.*)? gen_context(system_u:object_r:public_content_t,s0)
|
||||
|
||||
|
||||
@@ -273,8 +273,8 @@ like($te, qr/^\s*role unconfined_r types xcat_image_t;$/m,
|
||||
# (xCAT-client/bin/genimage:453), which transitions on its own. Labelling the
|
||||
# wrapper gave a dispatching client the authority of the image domain.
|
||||
is_deeply([ grep { fc_type($_) eq 'xcat_image_exec_t' } sort keys %fc ],
|
||||
[ '/opt/xcat/share/xcat/netboot/[^/]+/geninitrd',
|
||||
'/opt/xcat/share/xcat/netboot/[^/]+/genimage' ],
|
||||
[ '/opt/xcat/share/xcat/netboot/[^/]+/genimage',
|
||||
'/opt/xcat/share/xcat/netboot/[^/]+/geninitrd' ],
|
||||
'only the per-OS build programs carry the image entrypoint');
|
||||
is(fc_type('/opt/xcat/bin/genimage'), 'xcat_client_exec_t',
|
||||
'the genimage wrapper is a client, like every other dispatching command');
|
||||
|
||||
Reference in New Issue
Block a user