Re: [Spacewalk-devel] [PATCH] - BZ#688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
On 04/05/2011 11:16 AM, Jan Pazdziora wrote: > what was the resolution to this issue? Ahh, sorry, we continued on IRC with Marcelo, I forgot to post the resolution here... Commit: ab80c2974e4fa2261478bed2c6d8a99703671b4c -- Miroslav Suchy Red Hat Satellite Engineering ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] [PATCH] - BZ#688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
On Wed, Mar 23, 2011 at 05:13:36PM +0100, Miroslav Suchý wrote: > On 03/18/2011 08:54 AM, Michael Mraka wrote: > > Marcelo Moreira de Mello wrote: > > % Hello, > > > > Hi Marcelo, > > > > % Following as attached a patch which fixes the python exception when > > % comparing files using the web UI in RHEL6 when SELinux is disabled. > > % > > % The BZ# is flagged to RHN Satellite, but the same issue occurs in > > % Spacewalk. > > % > > % Thank you. > > % > > % Kind Regards, > > % Marcelo Moreira de Mello > > > > I applied your patch to spacewalk master, thanks for it. > > Well, > I have little problem with this patch. > I have no problem with client/tools/rhncfg/config_common/repository.py > part. But I have with client/tools/rhncfg/config_common/file_utils.py part. > > Lets do some exercise: > > [root@XXX190 ~]# ls -ldZ /root > drwxr-x--- root root root:object_r:user_home_dir_t:s0 /root > [root@XXX190 ~]# python > Python 2.4.3 (#1, Dec 10 2010, 17:24:32) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from selinux import lgetfilecon, is_selinux_enabled > >>> is_selinux_enabled() > 0 > >>> lgetfilecon('/root') > [33, 'root:object_r:user_home_dir_t:s0'] > >>> > [root@XXX190 ~]# getenforce > Disabled > > So with this patch the selinux content will not be used even if it has > some content. > Accoring my investigation lgetfilecon(path)[1] returns None (RHEL6, > python 2.4) or 'unlabeled' (Fedora14, python 2.7). > > I would like first see which problem in web UI we are solving. > > Isn't correct fix?: > if cur_sectx == None or cur_sectx == 'unlabeled': > cur_sectx = '' Mirek, what was the resolution to this issue? -- Jan Pazdziora Principal Software Engineer, Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] [PATCH] - BZ#688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
On 03/18/2011 08:54 AM, Michael Mraka wrote: > Marcelo Moreira de Mello wrote: > % Hello, > > Hi Marcelo, > > % Following as attached a patch which fixes the python exception when > % comparing files using the web UI in RHEL6 when SELinux is disabled. > % > % The BZ# is flagged to RHN Satellite, but the same issue occurs in > % Spacewalk. > % > % Thank you. > % > % Kind Regards, > % Marcelo Moreira de Mello > > I applied your patch to spacewalk master, thanks for it. Well, I have little problem with this patch. I have no problem with client/tools/rhncfg/config_common/repository.py part. But I have with client/tools/rhncfg/config_common/file_utils.py part. Lets do some exercise: [root@XXX190 ~]# ls -ldZ /root drwxr-x--- root root root:object_r:user_home_dir_t:s0 /root [root@XXX190 ~]# python Python 2.4.3 (#1, Dec 10 2010, 17:24:32) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from selinux import lgetfilecon, is_selinux_enabled >>> is_selinux_enabled() 0 >>> lgetfilecon('/root') [33, 'root:object_r:user_home_dir_t:s0'] >>> [root@XXX190 ~]# getenforce Disabled So with this patch the selinux content will not be used even if it has some content. Accoring my investigation lgetfilecon(path)[1] returns None (RHEL6, python 2.4) or 'unlabeled' (Fedora14, python 2.7). I would like first see which problem in web UI we are solving. Isn't correct fix?: if cur_sectx == None or cur_sectx == 'unlabeled': cur_sectx = '' -- Miroslav Suchy Red Hat Satellite Engineering ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] [PATCH] - BZ#688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
Marcelo Moreira de Mello wrote: % Hello, Hi Marcelo, % Following as attached a patch which fixes the python exception when % comparing files using the web UI in RHEL6 when SELinux is disabled. % % The BZ# is flagged to RHN Satellite, but the same issue occurs in % Spacewalk. % % Thank you. % % Kind Regards, % Marcelo Moreira de Mello I applied your patch to spacewalk master, thanks for it. Regards, -- Michael Mráka Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] - BZ#688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
Hello, Following as attached a patch which fixes the python exception when comparing files using the web UI in RHEL6 when SELinux is disabled. The BZ# is flagged to RHN Satellite, but the same issue occurs in Spacewalk. Thank you. Kind Regards, Marcelo Moreira de Mello -- Marcelo Moreira de Mello RHCA RHCSS RHCVA Software Maintenance Engineer/SEG gpg id: 2048R/FDB110E5 gpg fingerprint: 3BE7 EF71 4DD7 6812 D309 8F18 BD42 D095 FDB1 10E5 From: Marcelo Moreira de Mello Date: Thu, 17 Mar 2011 12:11:38 -0300 Subject: [PATCH] rhbz#688461 - fixed python exception when comparing files using web UI and SELinux disabled in RHEL6 --- client/tools/rhncfg/config_common/file_utils.py |9 +++-- client/tools/rhncfg/config_common/repository.py |2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py index c506337..7d34884 100644 --- a/client/tools/rhncfg/config_common/file_utils.py +++ b/client/tools/rhncfg/config_common/file_utils.py @@ -19,7 +19,7 @@ import tempfile import base64 import difflib try: -from selinux import lgetfilecon +from selinux import lgetfilecon, is_selinux_enabled except: # on rhel4 we do not support selinux def lgetfilecon(path): @@ -97,9 +97,14 @@ class FileProcessor: sectx_result = '' result = '' -cur_sectx = lgetfilecon(path)[1] +if is_selinux_enabled(): +cur_sectx = lgetfilecon(path)[1] +else: +cur_sectx = None + if cur_sectx == None: cur_sectx = '' + if file_struct.has_key('selinux_ctx') and file_struct['selinux_ctx']: if cur_sectx != file_struct['selinux_ctx']: sectx_result = "SELinux contexts differ: actual: [%s], expected: [%s]\n" % (cur_sectx, file_struct['selinux_ctx']) diff --git a/client/tools/rhncfg/config_common/repository.py b/client/tools/rhncfg/config_common/repository.py index 65eda11..3a50da4 100644 --- a/client/tools/rhncfg/config_common/repository.py +++ b/client/tools/rhncfg/config_common/repository.py @@ -144,6 +144,8 @@ class Repository: if is_selinux_enabled(): ret['selinux_ctx'] = selinux_ctx +else: +ret['selinux_ctx'] = '' return ret -- 1.7.1 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel