Re: SELinuxEnabled in rpm.Transaction ()

Paul Nasrat <[email protected]> Fri, 02 Dec 2005 14:42:01 -0500
Newsgroups gmane.linux.redhat.rpm.python
Organization Red Hat, Inc.
Message-ID <[email protected]>
On Fri, 2005-12-02 at 11:33 -0800, Mitko Haralanov wrote:
> 	Hi, I am new to the list and I have a question about
> the Python RPM bindings.
> 	Just so I don't post duplicates I search through the
> archives but did not find anything relevant.
> 
> 	I am trying to duplicate the rpm --verify functionality with
> Python and I am almost done re-writing the rpmVerifyFile function from
> rpm in Python.
> 	However, I am having a major problem when comparing the modes
> of the individual files (RPMVERIFY_MODE) and while trying to debug it,
> I noticed that rpm checks the SELinux security contexts (which
> changes the file mode) before comparing the modes of the file and the
> one stored in the header.
> 
> 	My question is: does the rpm.ts class have a way to check
> whether SELinux is enabled (in rpm they use rpmtsSELinuxEnabled (ts))? 

you can check the return from /usr/sbin/selinuxenabled  there are some
python selinux bindings but selinuxenabled should be fine.

Paul