-
Bug
-
Resolution: Unresolved
-
Normal
-
rhel-10.0.beta
-
None
-
selinux-policy-40.13.11-1.el10
-
None
-
Moderate
-
2
-
rhel-sst-security-selinux
-
ssg_security
-
15
-
1
-
QE ack
-
False
-
-
No
-
Red Hat Enterprise Linux
-
SELINUX 241016 - 241106, SELINUX 241106 - 241127
-
-
Fail
-
Automated
-
Bug Fix
-
-
Proposed
-
None
What were you trying to do that didn't work?
A customer wrote a service that executes nodejs /usr/bin/npm start command.
With RHEL8 and later, this fails because /usr/bin/npm is a symlink to /usr/lib/node_modules/npm/bin/npm-cli.js which is labeled with lib_t:
# ls -lZ /usr/bin/npm /usr/lib/node_modules/npm/bin/npm-cli.js lrwxrwxrwx. 1 root root system_u:object_r:bin_t:s0 38 Mar 5 07:14 /usr/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js -rwxr-xr-x. 1 root root system_u:object_r:lib_t:s0 50 Aug 9 2023 /usr/lib/node_modules/npm/bin/npm-cli.js
This hence prevents the transition from init_t to unconfined_service_t to occur, since there is no transition for lib_t context, which is the context of the target of the symlink /usr/bin/npm.
IMHO this is a bug in the policy, every location under /usr/lib/ having /bin/ directory should be labeled with bin_t by default.
Checking the policy, we can already see such locations, e.g.:
/usr/lib/ccache/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/debug/bin(/.*)? regular file system_u:object_r:bin_t:s0 /usr/lib/debug/usr/bin(/.*)? regular file system_u:object_r:bin_t:s0 /usr/lib/erlang/erts.*/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/libreoffice(/.*)?/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/mailman/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/news/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/portage/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/qt.*/bin(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/xen/bin(/.*)? all files system_u:object_r:bin_t:s0
There is even 2 specific locations for programs, but none for /bin/:
/usr/lib/.*/program(/.*)? all files system_u:object_r:bin_t:s0 /usr/lib/.*/scripts(/.*)? all files system_u:object_r:bin_t:s0
IMHO a new generic rule similar to the ones above should be added to the policy, and specific ones (e.g. for "portage", "qt", etc.) removed and replaced by this one below:
/usr/lib/.*/bin(/.*)? all files system_u:object_r:bin_t:s0
Please provide the package NVR for which bug is seen:
nodejs-22.4.1-3.el10.x86_64
nodejs-docs-22.4.1-3.el10.noarch
nodejs-full-i18n-22.4.1-3.el10.x86_64
nodejs-libs-22.4.1-3.el10.x86_64
nodejs-npm-10.8.1-1.22.4.1.3.el10.x86_64
selinux-policy-40.13.9-1.el10.noarch
selinux-policy-devel-40.13.9-1.el10.noarch
selinux-policy-mls-40.13.9-1.el10.noarch
selinux-policy-targeted-40.13.9-1.el10.noarch
How reproducible:
Always
Steps to reproduce
- Install nodejs
- Create a custom service starting nodejs
[Service] ExecStart=/usr/bin/npm start
- Start the service
Expected results
Starts properly
Actual results
Fails to start
- clones
-
RHEL-36587 nodejs executables in /usr/lib/node_modules/npm/bin are not properly labeled
- Closed
- links to
-
RHBA-2024:140162 selinux-policy bug fix and enhancement update