<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hi All,<br><br>Still on the topic of transition between a file vmware_exec_t to vmware_t.<br><br>Under the vmware.if file, there is a:<br><br>domain_entry_file($1_vmware_t, vmware_exec_t)<br>role $3 types $1_vmware_t<br><br>Is this a rule that allows files marked with vmware_exec_t to transit to vmware_t? What does the $1,$2,$3 represent? Pardon my ignorance on this but i see these $1, $2 things appear in a lot of places which confuse me. Can anyone point me to a place to learn more about the substitutions?<br><br>For the transition to take place I'd probably need to add something like this:<br><br>domain_auto_trans(initrc_t, vmware_exec_t, vmware_t)<br><br>That is  following the suggestion below by Daniel to
 make the /usr/bin/vmplayer script initrc_exec_t.<br><br>But not too sure where to place this statement, in vmware.te? <br><br>I tried that but get a compilation error<br><br>vmware.te:13:ERROR: 'unknown type vmware_t' at token ';'<br><br>I thought vmware_t has been defined in vmware.if?<br><br>Thanks in Advance, <br>Best Regards,<br>Louis<br>  <br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Daniel J Walsh <dwalsh@redhat.com><br>To: Louis Lam <lshoujun@yahoo.com><br>Cc: Ken YANG <spng.yang@gmail.com>; fedora-selinux-list@redhat.com<br>Sent: Monday, July 16, 2007 1:24:00 PM<br>Subject: Re: Containing vmware player 2.0.0 with SELINUX<br><br><div>Louis Lam wrote:<br>> Hi All,<br>><br>> I managed to get the vmware host services e.g. vmnet-bridge, vmnet-dhcpd etc... to be running in<br>> vmware_host_t domain. I did it by modifying the net-services.sh as
 described in an earlier post.<br>><br>> Next I tried to get vmplayer (i'm using vmware player 2.0.0 but it is similar for vmware ws 6) to<br>> run in vmware_t domain. First i tried to chcon /usr/bin/vmplayer to<br>> system_u:object_r:vmware_exec_t. But it turns out that /usr/bin/vmplayer is a script that would in<br>> turn execute /usr/lib/vmware/bin/vmplayer. I have chcon /usr/lib/vmware/bin/vmplayer to<br>> system_u:object_r:vmware_exec_t but still it runs in unconfined_t when i launched it. I seems like<br>> the domain transition didn't take place. Please help.<br>><br>> 1. What should be the context for the /usr/bin/vmplayer script? Does it affect the transition of<br>> the actual executable /usr/lib/vmware/bin/vmplayer?<br>><br>> 2. For those who could get vmware workstation 6 to run how did you get it to run in vmware_t<br>> domain? <br>><br>>   <br>There is currently no transition from
 unconfined_t to vmware_t.   So the <br>only way to get<br>the transition to happen is through the initrc script.  You could label <br>the vmplayer script<br>initrc_exec_t and the transitions should happen properly. <br>> THanks,<br>> Louis<br>><br>> --- Daniel J Walsh <dwalsh@redhat.com> wrote:<br>><br>>   <br>>> Ken YANG wrote:<br>>>     <br>>>> Daniel J Walsh wrote:<br>>>>   <br>>>>       <br>>>>> Louis Lam wrote:<br>>>>>     <br>>>>>         <br>>>>>> Hi all,<br>>>>>><br>>>>>> At this point i'm still trying to use SELINUX to "contain" vmware<br>>>>>> player, making it run in<br>>>>>> targeted
 mode.<br>>>>>><br>>>>>> I'm still rather new to this but through the help of Ken, i've been<br>>>>>> able to manipulate modules and<br>>>>>> get it to "affect" the vmware player but at this point my vmware<br>>>>>> player is still "broken".<br>>>>>> Would anyone be able to share their configurations (.te,.fc,.if) file<br>>>>>> if you've managed to get it<br>>>>>> to work with vmware player or vmware-workstation 6 ? CUrrently i'm<br>>>>>> working with Fedora 7 but<br>>>>>> intend to port it back to RHEL 5.<br>>>>>><br>>>>>> I've downloaded the latest reference policy from oss and examined the<br>>>>>> vmware relevant files. From<br>>>>>> examining the vmware.fc  and<br>>>>>>
 "/etc/selinux/targeted/modules/active/file_context", seems like the<br>>>>>> vmware.fc file could have been written for an older/different version<br>>>>>> of vmware where the vmnet<br>>>>>> devices are at /dev/vmnet.* instead of /dev/vmnet* found in vmplayer<br>>>>>> 2/workstation 6. Which<br>>>>>> version was it written for?<br>>>>>><br>>>>>>   <br>>>>>>       <br>>>>>>           <br>>>>> There is vmware policy that we are starting to use in Rawhide (fc8)<br>>>>>     <br>>>>>         <br>>>>>> I went on to modify the vmware.fc file and managed to compile and load<br>>>>>> the vmware.pp module.
 But<br>>>>>> currently this affected the vmware services at startup, e.g.<br>>>>>> vmnet-dhcpd. For vmware, when<br>>>>>> something fails to start, it would ask me to rum vmware-config.pl<br>>>>>> again when i restart it. Doing<br>>>>>> this would recreate the /dev/vmnet* files over again but it will not<br>>>>>> have the right context,<br>>>>>> defaulting to "device_t" instead of "vmware_device_t" that i have<br>>>>>> modified. The line in my<br>>>>>> vmware.fc looks like this:<br>>>>>><br>>>>>> /dev/vmnet0  -- gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>>> /dev/vmnet1  -- gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>>> /dev/vmnet8  --
 gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>>><br>>>>>> I was thinking that if the script has created a new /dev/vmnet file it<br>>>>>> would automatically use the<br>>>>>> vmware_device_t context but it didn't. Did i miss out anything?<br>>>>>>   <br>>>>>>       <br>>>>>>           <br>>>>> The problem here is the script is running as initrc_t which has no rules<br>>>>> when creating devices in directories labeled device_t (/dev)  So it uses<br>>>>> the default and labels the devices the same as the directory.  Usually<br>>>>> when we have this situation, we just run restorecon /dev/XYZ after the<br>>>>> creation,<br>>>>> for
 example<br>>>>><br>>>>> mknod /dev/XYZ<br>>>>> chmod 666 /dev/XYZ<br>>>>> restorecon /dev/XYZ<br>>>>>     <br>>>>>         <br>>>> as tom said, it seemed that it's "$vmdb_answer_LIBDIR"/net-services.sh<br>>>> who create such devices:<br>>>><br>>>> <a target="_blank" href="http://marc.info/?l=fedora-selinux-list&m=118407622004161&w=2">http://marc.info/?l=fedora-selinux-list&m=118407622004161&w=2</a><br>>>><br>>>><br>>>> i notice "/dev" is tmpfs:<br>>>><br>>>> -(:14:45:$)-> cat /proc/mounts<br>>>> rootfs / rootfs rw 0 0<br>>>> /dev/root / ext3 rw,data=ordered 0 0<br>>>> /dev /dev tmpfs rw 0 0<br>>>> ......<br>>>><br>>>> i want to add rules in
 policy:<br>>>><br>>>> type_transition "vmware type" tmpfs_t : chr_file vmware_device_t;<br>>>><br>>>> additionally i don't know what type of the net-services.sh, now it is:<br>>>><br>>>> ... root root user_u:object_r:lib_t   /usr/lib/vmware/net-services.sh<br>>>><br>>>><br>>>> is this method appropriate?<br>>>><br>>>><br>>>><br>>>><br>>>>   <br>>>>       <br>>>>>> What is the two "--" on the line mean? are they significant?<br>>>>>>   <br>>>>>>       <br>>>>>>           <br>>>>> The -- indicates that this matches only files.<br>>>>><br>>>>> -d directories<br>>>>> -s
 sock_file<br>>>>> -l link file<br>>>>> -c char_file<br>>>>> ...<br>>>>><br>>>>> Second character matches the first character of the ls -l line<br>>>>><br>>>>> ls -l /dev/ttyS0<br>>>>> crw-rw---- 1 root uucp 4, 64 2007-07-11 19:07 /dev/ttyS0<br>>>>><br>>>>> If you have no option specified it would match any file type.<br>>>>><br>>>>> /dev/vmnet0  -- gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>> /dev/vmnet1  -- gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>> /dev/vmnet8  -- gen_context(system_u:object_r:vmware_device_t,s0)<br>>>>><br>>>>><br>>>>> Would match only "Regular files" with this labels.  So you would be<br>>>>> better off with -c (or -b if they are block
 devices).<br>>>>>     <br>>>>>         <br>>>>>> Sorry about the long post, any help or advice? Thanks.<br>>>>>><br>>>>>> Louis<br>>>>>> Send instant messages to your online friends<br>>>>>> <a target="_blank" href="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</a><br>>>>>> -- <br>>>>>> fedora-selinux-list mailing list<br>>>>>> fedora-selinux-list@redhat.com<br>>>>>> <a target="_blank" href="https://www.redhat.com/mailman/listinfo/fedora-selinux-list">https://www.redhat.com/mailman/listinfo/fedora-selinux-list</a><br>>>>>>   <br>>>>>>       <br>>>>>>           <br>>>>> --
 <br>>>>> fedora-selinux-list mailing list<br>>>>> fedora-selinux-list@redhat.com<br>>>>> <a target="_blank" href="https://www.redhat.com/mailman/listinfo/fedora-selinux-list">https://www.redhat.com/mailman/listinfo/fedora-selinux-list</a><br>>>>><br>>>>>     <br>>>>>         <br>>>>   <br>>>>       <br>>> One approach to this would be to label the /etc/init.d/vmware script <br>>> vmware_initrc_exec_t and then setup the proper transitions.<br>>><br>>> This is something we are considering for RBAC.  For example we want to <br>>> allow the webadm_t to be able to only restart/execute the httpd<br>>> script.  Currently we have to allow him to execute any initrc script, <br>>> although we can prevent him from
 starting other confined domains.<br>>> A cleaner solution might be to label the script differently and setup <br>>> another domain for the script to transition to.<br>>><br>>>     <br>><br>><br>> Send instant messages to your online friends <a target="_blank" href="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</a> <br>>   <br><br></div></div><br></div></div><br>Send instant messages to your online friends http://uk.messenger.yahoo.com </body></html>