Re: python34 and selinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/15/2016 07:48 AM, William wrote:
> Hi,
> 
> Are there modules for selinux python34, so that from python I can query the
> selinux api? I would like to be able to query current state, contexts, trigger
> relabels etc. Is this possible?
> 

libselinux and libsemanage have python 2 and python 3 bindings available
in subpackages:

libselinux-python.x86_64 : SELinux python bindings for libselinux
libselinux-python3.x86_64 : SELinux python 3 bindings for libselinux
libsemanage-python.x86_64 : semanage python bindings for libsemanage
libsemanage-python3.x86_64 : semanage python 3 bindings for libsemanage


For the general info you can use help():

# python3
>>> import selinux
>>> help(selinux)
>>> import semanage
>>> help(semanage)

e.g.
>>> selinux.is_selinux_enabled()
1
>>> selinux.selinux_getpolicytype()
[0, 'targeted']

Petr
-- 
Petr Lautrbach


Attachment: signature.asc
Description: OpenPGP digital signature

--
selinux mailing list
selinux@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/selinux@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux