<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div>For reasons I don't understand, the install labelled /home with (I think, I'm offsite with no access) auto_fs_t as it is a mount point for autofs.</div><div><br></div><div>Roland</div>--<div>Roland Roberts, &nbsp;PhD</div><div>6818 Madeline Court</div><div>Brooklyn, &nbsp;NY 11220</div><br><br><br>-------- Original message --------<br>From: Daniel J Walsh &lt;dwalsh@redhat.com&gt; <br>Date: 05/28/2013  8:33 AM  (GMT-05:00) <br>To: Roland Roberts &lt;roland@astrofoto.org&gt; <br>Cc: Dominick Grift &lt;dominick.grift@gmail.com&gt;,selinux@lists.fedoraproject.org <br>Subject: Re: SELinux, NIS, NFS, and /home, trouble with Fedora 18 converting    user_home_dir_t to detault_t <br> <br><br>-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>On 05/28/2013 08:03 AM, Roland Roberts wrote:<br>&gt; Yet normally /home is home_root_t. And in my case /data is a mount point<br>&gt; for other things; the actual disk is mounted at /data/home, so I thought I<br>&gt; was doing the equivalent of what the man page says.<br>&gt; <br>&gt; Roland -- Roland Roberts,&nbsp; PhD 6818 Madeline Court Brooklyn,&nbsp; NY 11220<br>&gt; <br>&gt; <br>&gt; <br>&gt; -------- Original message -------- From: Dominick Grift<br>&gt; &lt;dominick.grift@gmail.com&gt; Date: 05/28/2013 4:13 AM (GMT-05:00) To: Roland<br>&gt; Roberts &lt;roland@astrofoto.org&gt; Cc: selinux@lists.fedoraproject.org Subject:<br>&gt; Re: SELinux, NIS, NFS, and /home, trouble with Fedora 18 converting <br>&gt; user_home_dir_t to detault_t<br>&gt; <br>&gt; <br>&gt; On Mon, 2013-05-27 at 19:01 -0400, Roland Roberts wrote:<br>&gt; <br>&gt; SELinux contexts for /home are treated a bit differently than other <br>&gt; locations.<br>&gt; <br>&gt; Try instead: (from: man semanage):<br>&gt; <br>&gt;&gt; For home directories under top level directory, for example /disk6/home, <br>&gt;&gt; execute the following commands. # semanage fcontext -a -t home_root_t<br>&gt;&gt; "/disk6" # semanage fcontext -a -e /home /disk6/home # restorecon -R -v<br>&gt;&gt; /disk6<br>&gt; <br>&gt; <br>&gt;&gt; I'm trying to clean up selinux contexts and having trouble. The system is<br>&gt;&gt; a new install of Fedora 18, but the home directories have been preserved<br>&gt;&gt; for a long time. Because the system runs boot on raid-1, it was installed<br>&gt;&gt; as Fedora 17 and then I used fedup to move to Fedora 18.<br>&gt;&gt; <br>&gt;&gt; My home directories are automounted via NFS and an NIS map. I mount them <br>&gt;&gt; on the clients with an explicit context:<br>&gt;&gt; <br>&gt;&gt; 270 roland&gt; ypcat auto.home <br>&gt;&gt; -rw,soft,intr,tcp,context="system_u:object_r:user_home_t:s0" <br>&gt;&gt; archos.rlent.pnet:/data/home/&amp;<br>&gt;&gt; <br>&gt;&gt; However, my troubles right now are confined to the server.<br>&gt;&gt; <br>&gt;&gt; The real home directory is /data/home so /data/home/roland is mounted on <br>&gt;&gt; /home/roland. All clients see the same mount point, even the server <br>&gt;&gt; remounts this way.<br>&gt;&gt; <br>&gt;&gt; Most of the selinux context information is wrong, probably because some <br>&gt;&gt; of these files have been hanging around roughly since RedHat 3.0.3. Yes, <br>&gt;&gt; really. Although the content has surely changed (e.g., .bashrc).<br>&gt;&gt; <br>&gt;&gt; To get started, I've done this<br>&gt;&gt; <br>&gt;&gt; semanage fcontext -a -t home_root_t /data/home semanage fcontext -a -t<br>&gt;&gt; user_home_dir_t '/data/home/(.*)' semanage fcontext -a -t lost_found_t<br>&gt;&gt; /data/home/lost+found restorecon -v -R /data/home<br>&gt;&gt; <br>&gt;&gt; That gave the surprising result of doing absolutely nothing. So I <br>&gt;&gt; brute-forced it and did<br>&gt;&gt; <br>&gt;&gt; semanage fcontext -a -t home_root_t /data/home semanage fcontext -a -t<br>&gt;&gt; lost_found_t /data/home/lost+found for D in $LIST; do semanage fcontext<br>&gt;&gt; -a -t user_home_dir_t /data/home/$D; done restorecon -v -R /data/home<br>&gt;&gt; <br>&gt;&gt; The above did not work for the lost+found directory. I haven't figured <br>&gt;&gt; out why. I tried deleting all the contexts I had set and starting over <br>&gt;&gt; and I tried setting the context just on lost+found repeatedly to no <br>&gt;&gt; avail. lost+found remains default_t.<br>&gt;&gt; <br>&gt;&gt; Next, I log in via ssh to my user account. Since I have X forwarding <br>&gt;&gt; turned on, this results in an .Xauthority file being created. If I run <br>&gt;&gt; (as root, from another window) restorecon, I get this<br>&gt;&gt; <br>&gt;&gt; [root@archos ~]# cd /data/home/roland [root@archos roland]# restorecon -v<br>&gt;&gt; -R /data/home/roland restorecon reset /data/home/roland/.Xauthority<br>&gt;&gt; context <br>&gt;&gt; unconfined_u:object_r:xauth_home_t:s0-&gt;unconfined_u:object_r:default_t:s0<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; <br>So the file was created with the correct context, but it gets zapped<br>&gt;&gt; with restorecon. I can create a new file via touch and it gets created <br>&gt;&gt; with the correct context<br>&gt;&gt; <br>&gt;&gt; 268 roland&gt; ls -Z foo -rw-rw-r--. roland roland<br>&gt;&gt; unconfined_u:object_r:user_home_t:s0 foo 269 roland&gt; ls -Zad . <br>&gt;&gt; drwxr-xr-x. roland roland system_u:object_r:user_home_dir_t:s0 .<br>&gt;&gt; <br>&gt;&gt; But again, if I run restorecon, it gets converted to default_t.<br>&gt;&gt; <br>&gt;&gt; I realize the whole NIS/NFS thing makes this problematic on the clients, <br>&gt;&gt; but all of the above is on the server. I was hoping to get the file <br>&gt;&gt; contexts fixed up, but even if I can get it to stop converting everything<br>&gt;&gt; back to default_t, I haven't got a clue about all the other contexts I<br>&gt;&gt; need to set (e.g., ssh_home_t for .ssh, but what else) and then I fear<br>&gt;&gt; they will just get reset, too.<br>&gt;&gt; <br>&gt;&gt; So, what's going on here and how do I stop it? Then after that, how do I <br>&gt;&gt; go about fixing all the default_t under my home directory to be what they<br>&gt;&gt; should be.<br>&gt;&gt; <br>&gt;&gt; roland<br>&gt;&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; -- selinux mailing list selinux@lists.fedoraproject.org <br>&gt; https://admin.fedoraproject.org/mailman/listinfo/selinux<br>&gt; <br><br>In this case you want to label /data/home as equivalent to /home<br>and you probably want to label data with a label that most apps can read like<br>usr_t.<br><br><br># semanage fcontext -a -t usr_t '/data(/.*)?'<br># semanage fcontext -a -e /home /data/home<br><br><br><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.13 (GNU/Linux)<br>Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/<br><br>iEYEARECAAYFAlGkpAIACgkQrlYvE4MpobMKdgCgyvOOSlMo+7wSO7qB52SMHFRT<br>vUwAoIXc15OzcmadYZC+NANqMxKRSCve<br>=EBci<br>-----END PGP SIGNATURE-----<br></body>