SELinux Script python reference¶
LMI SELinux Provider client library.
- lmi.scripts.selinux.get_file_label(ns, target)¶
Get label of an SELinux file.
Parameters: target – An SELinux file.
- lmi.scripts.selinux.get_service(ns)¶
Get instance of SELinux service.
Return type: LMIInstance/LMI_SELinuxService
- lmi.scripts.selinux.list_elements(ns, kind)¶
List SELinux elements (booleans and ports).
Parameters: kind – Elements to be listed.
- lmi.scripts.selinux.restore(ns, target, action, recursively)¶
Restore default SELinux security contexts on files.
Parameters: - target – SELinux file to change.
- action – Action to take on mislabeled files.
- recursively – Restore labels recursively in case Target is a directory.
- lmi.scripts.selinux.set_boolean(ns, target, value, default)¶
Set a new value of an SELinux boolean.
Parameters: - target – An SELinux boolean to change.
- value – New value.
- default (bool) – If True, makes the new state persistent.
- lmi.scripts.selinux.set_file_label(ns, target, label)¶
Set label on an SELinux file.
Parameters: - target – An SELinux file to change.
- label – New label.
- lmi.scripts.selinux.set_port(ns, target, protocol, port_range)¶
Set label on an SELinux port.
Parameters: - target – An SELinux port to change.
- protocol – Network protocol (TCP/UDP).
- port_range – Network ports to change. Single port or a range, for example 1024-2048’.
- lmi.scripts.selinux.set_state(ns, new_state, default)¶
Set SELinux state.
Parameters: - new_state – New state value.
- default (bool) – If set to True, makes the new state persistent.