Bug 3939 - SELinux module doesn't work on RHEL5
Summary: SELinux module doesn't work on RHEL5
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VSM Agent (show other bugs)
Version: 3.1.2
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.3.0
Assignee: Karl Mikaelsson
URL:
Keywords: ossman_tester, prosaic
Depends on:
Blocks:
 
Reported: 2011-08-09 14:10 CEST by Peter Åstrand
Modified: 2014-10-06 15:45 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Peter Åstrand cendio 2011-08-09 14:10:45 CEST
In principle, we should re-open bug 3791, but I refuse to delay the release any more due to stupid SELinux. In any case, this is what I get:


Error: Could not configure SELinux for ThinLinc. The error was:
Updating default context mappings...
Updating root context mappings...
Could not find template type. Using default fallback.
Compiling thinlinc policy module...
make: Entering directory `/tmp/tmp7tZrdz'
Compiling targeted thinlinc module
/usr/bin/checkmodule:  loading policy configuration from tmp/thinlinc.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 6) to tmp/thinlinc.mod
Creating targeted thinlinc.pp policy package
rm tmp/thinlinc.mod.fc tmp/thinlinc.mod
make: Leaving directory `/tmp/tmp7tZrdz'
Installing thinlinc policy module...
libsepol.print_missing_requirements: thinlinc's global requirements were not met: type/attribute xauth_home_t
libsemanage.semanage_link_sandbox: Link packages failed
semodule:  Failed!
Comment 1 Pierre Ossman cendio 2011-08-25 17:12:30 CEST
I think this can be solved easily. Will probably move otherwise...
Comment 2 Pierre Ossman cendio 2012-11-16 14:10:16 CET
The actual policy was easily fixed. Unfortunately we also used it in a file pattern, which are way less flexible. A hackish workaround has been committed in r26180. Long term we might want to ignore ancient versions of refpolicy (like RHEL 5 uses).


Tester should make sure that the RHEL 5 works (of course), but also that the xauth stuff is present on newer systems.
Comment 3 Peter Åstrand cendio 2013-05-29 14:10:47 CEST
# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel \r on an \m

# /opt/thinlinc/share/selinux/install
Updating default context mappings...
Updating root context mappings...
Compiling thinlinc policy module...
make: Entering directory `/tmp/tmpkDXEhD'
Compiling targeted thinlinc module
/usr/bin/checkmodule:  loading policy configuration from tmp/thinlinc.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 6) to tmp/thinlinc.mod
Creating targeted thinlinc.pp policy package
rm tmp/thinlinc.mod.fc tmp/thinlinc.mod
make: Leaving directory `/tmp/tmpkDXEhD'
Installing thinlinc policy module...
libsepol.print_missing_requirements: thinlinc's global requirements were not met: type/attribute xauth_t
libsemanage.semanage_link_sandbox: Link packages failed
semodule:  Failed!
Comment 4 Pierre Ossman cendio 2013-05-31 16:44:28 CEST
(In reply to comment #3)
> Installing thinlinc policy module...
> libsepol.print_missing_requirements: thinlinc's global requirements were not
> met: type/attribute xauth_t
> libsemanage.semanage_link_sandbox: Link packages failed
> semodule:  Failed!

Fixed in r27476 through r27478. Not sure how the hell I was testing on the first attempt. Now it works on RHEL 5, and a more modern system gets proper access and context:

[ossman@ossman]$ ls -Z /var/opt/thinlinc/sessions/ossman/last/Xauthority
-rw-------. ossman ossman unconfined_u:object_r:xauth_home_t:s0 /var/opt/thinlinc/sessions/ossman/last/Xauthority
Comment 5 Peter Åstrand cendio 2013-06-03 11:52:22 CEST
Installation succeeds but sessions cannot start:

2013-06-03 02:49:27 INFO vsmagent: VSM Agent version 4.0.0post build 3970 started
2013-06-03 02:49:27 INFO vsmagent: My public hostname is 172.16.217.128
/opt/thinlinc/libexec/tl-session: error while loading shared libraries: libpam.so.0: failed to map segment from shared object: Permission denied
Comment 6 Pierre Ossman cendio 2013-06-03 14:29:34 CEST
The rabbit hole goes deep with this one. The problem in comment 5 is caused by the fact that you have to explicitly allow dlopen() and friend with older refpolicy. That's easily fixed, but after that it just breaks even more.

Turns out that the domain transition from tl_session to tl_xinit isn't working, so everything is running in the restricted thinlinc_session_t context.

I can't see any obvious reason why this breaks, but we cannot justify spending more time on this for this old platform. We'll revert most/all of the changes and move this bug forward.
Comment 7 Pierre Ossman cendio 2013-06-03 14:30:11 CEST
For future reference, these were the needed lines to get PAM working:

# We need to be able to load PAM modules
# (only needed with older refpolicy as the newer does this for all domains)
optional_policy(`
	libs_use_ld_so(thinlinc_session_t)
	libs_use_shared_libs(thinlinc_session_t)
')
Comment 8 Pierre Ossman cendio 2013-06-03 14:57:57 CEST
Workaround reverted in r27484. Still kept some changes though.
Comment 9 Karl Mikaelsson cendio 2014-06-03 13:57:13 CEST
RHEL 5.10 x86_64 and ThinLinc 4.2.0 - the SELinux module won't even install.

tlsetup.log:

> 2014-06-03 13:48:22,254: Output (stdout):
> 2014-06-03 13:48:22,255:     Updating default context mappings...
> 2014-06-03 13:48:22,255:     Updating root context mappings...
> 2014-06-03 13:48:22,255:     Compiling thinlinc policy module...
> 2014-06-03 13:48:22,255:     make: Entering directory `/tmp/tmph-TIpN'
> 2014-06-03 13:48:22,255:     Compiling targeted thinlinc module
> 2014-06-03 13:48:22,255:     /usr/bin/checkmodule:  loading policy configuration from tmp/thinlinc.tmp
> 2014-06-03 13:48:22,255:     make: Leaving directory `/tmp/tmph-TIpN'
> 2014-06-03 13:48:22,255: Output (stderr):
> 2014-06-03 13:48:22,256:     Could not find template type. Using default fallback.
> 2014-06-03 13:48:22,256:     thinlinc.te:55:ERROR 'syntax error' at token 'ubac_constrained' on line 118821:
> 2014-06-03 13:48:22,256:      
> 2014-06-03 13:48:22,256:     ubac_constrained(thinlinc_user_t)
> 2014-06-03 13:48:22,256:     /usr/bin/checkmodule:  error(s) encountered while parsing configuration
> 2014-06-03 13:48:22,256:     make: *** [tmp/thinlinc.mod] Error 1
> 2014-06-03 13:48:22,256: SELinux configuration failed with error code 2
Comment 10 Pierre Ossman cendio 2014-06-10 10:35:47 CEST
We "solve" this by documenting that older policies are not supported.
Comment 11 Karl Mikaelsson cendio 2014-08-20 11:10:18 CEST
http://www.cendio.com/resources/docs/platforms/selinux.xhtml updated in r29275.
Comment 12 Pierre Ossman cendio 2014-09-19 11:16:40 CEST
Looks ok.

Note You need to log in before you can comment on or make changes to this bug.