<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;">My mistakes, apologies for the confusion, under part 2, I was trying to do domain_auto_trans instead of doman_entry_file, so...<br><br>2. Created a domain transition so that the vmware user programs e.g.
/usr/lib/vmplayer script, /usr/lib/vmware/bin/vmplayer that are
labelleled system_u:object_r:vmware_exec_t will transit to
system_u:object_r:vmware_t when executed. I put it also in vmware.te:<br><br>domain_auto_trans($1_t, vmware_exec_t, $1_vmware_t)<br><br>but
 on making the vmware.pp module I get this warning and error:<br><br>'syntax error' at token '1' on line 81143:<br>#line 13<br>    allow $1_t vmware_exec_t: file {getattr read execute};<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Thanks in advance,<br>Louis<br><br><br>----- Original Message ----<br>From: Louis Lam <lshoujun@yahoo.com><br>To: Daniel J Walsh <dwalsh@redhat.com><br>Cc: fedora-selinux-list@redhat.com<br>Sent: Friday, July 27, 2007 5:05:05 AM<br>Subject: Re: Containing vmware player 2.0.0 with SELINUX<br><br><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;">Thanks Daniel for the information, hi everyone<br><br>I've tried to make the following changes:<br><br>1. Defined the vmware_t type in vmware.te:<br>type vmware_t;<br><br>I need to do this since I'm trying to
 let the vmware user program run under vmware_t domain but this is not defined. In terms of overall code compliance is it correct to define here? or should be at the vmware.if?<br><br>2. Created a domain transition so that the vmware user programs e.g. /usr/lib/vmplayer script, /usr/lib/vmware/bin/vmplayer that are labelleled system_u:object_r:vmware_exec_t will transit to system_u:object_r:vmware_t when executed. I put it also in vmware.te:<br><br>domain_entry_file($1_t, vmware_exec_t, $1_vmware_t)<br><br>but
 on making the vmware.pp module I get this warning and error:<br><br>'syntax error' at token '1' on line 81143:<br>#line 13<br>    allow $1_t vmware_exec_t: file entrypoint;<br><br>Not very sure what this means and how it should be corrected.<br><br>Thanks in advance,<br>Louis<br><br><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: Wednesday, July 25, 2007 3:12:56 PM<br>Subject: Re: Containing vmware player 2.0.0 with SELINUX<br><br><div>Louis Lam wrote:<br>> 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 <br>> to vmware_t? What does the $1,$2,$3 represent? Pardon my ignorance on <br>> this but i see these $1, $2 things appear in a lot of places which <br>> confuse me. Can anyone point me to a place to learn more about the <br>> substitutions?<br>><br>This just says that files labeled vmware_exec_t can be used as <br>entrypoints into the $1_vmware_t, where $1 is a user type.  "user", <br>"staff", "guest", "xguest".  The next line specifies which roles can <br>reach the specified domain.  No transition rules have been defined.<br>> For the transition to take place I'd probably need to add something <br>> like this:<br>><br>> domain_auto_trans(initrc_t, vmware_exec_t, vmware_t)<br>><br>Yes this allows it to reach this particular domain.   But to reach the <br>user domains defined
 above.<br><br>domain_auto_trans($1_t, vmware_exec_t, $1_vmware_t)<br>or<br>domain_auto_trans(user_t, vmware_exec_t, user_vmware_t)<br>> That is  following the suggestion below by Daniel to make the <br>> /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>Yes I was mistaken.  That is not the way the policy is written.  ( I <br>guess I should read before I speak.)<br>If you want to get vmware to transition from unconfined_t  you will have <br>to write the transition rules from uncofined_t to unconfined_vmware_t.<br>> I thought vmware_t has been defined in vmware.if?<br>><br>> Thanks in Advance,<br>> Best Regards,<br>> Louis<br>><br>> ----- 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>> Louis Lam wrote:<br>> > Hi All,<br>> ><br>> > I managed to get the vmware host services e.g. vmnet-bridge, <br>> vmnet-dhcpd etc... to be running in<br>> > vmware_host_t domain. I did it by modifying the net-services.sh as <br>> described in an earlier post.<br>> ><br>> > Next I tried to get vmplayer (i'm using vmware player 2.0.0 but it <br>> 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 <br>> /usr/bin/vmplayer is a script that would in<br>> > turn execute
 /usr/lib/vmware/bin/vmplayer. I have chcon <br>> /usr/lib/vmware/bin/vmplayer to<br>> > system_u:object_r:vmware_exec_t but still it runs in unconfined_t <br>> 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 <br>> 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 <br>> 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) <br>> 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 <br>> 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 <br>> 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 <br>> 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 <br>> 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 <br>> no rules<br>> >>>> when creating devices in directories labeled device_t (/dev)  So <br>> it uses<br>> >>>> the default and labels the devices the same as the <br>> directory.  Usually<br>> >>>> when we have this situation, we just run restorecon /dev/XYZ <br>> 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 rel="nofollow" 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>> <<a rel="nofollow" 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 rel="nofollow" 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 rel="nofollow" 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 rel="nofollow" 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 <br>> <a rel="nofollow" target="_blank" href="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</a><br>> >  <br>><br>><br>><br>> Send instant messages to your online friends <br>> <a rel="nofollow" target="_blank" href="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</a> <br><br></div></div><br></div></div><br><span>Send instant messages to your online friends <a target="_blank" href="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</a> </span></div><br></div></div><br>Send instant messages to your online friends http://uk.messenger.yahoo.com </body></html>