-
Notifications
You must be signed in to change notification settings - Fork 137
Removing SELinux Contexts with Python API
Endi S. Dewata edited this page Jul 17, 2023
·
1 revision
import selinux import seobject if not selinux.is_selinux_enabled() or not seobject: return transaction = seobject.semanageRecords('targeted') transaction.start() ports = seobject.portRecords(transaction) ports.delete('8005', 'tcp') ports.delete('8009', 'tcp') ports.delete('8443', 'tcp') ports.delete('8080', 'tcp') fcontexts = seobject.fcontextRecords(transaction) fcontexts.delete('/var/log/pki/pki-tomcat(/.*)?', '') fcontexts.delete('/var/lib/pki/pki-tomcat(/.*)?', '') fcontexts.delete('/etc/pki/pki-tomcat/alias(/.*)?', '') fcontexts.delete('/etc/pki/pki-tomcat(/.*)?', '') transaction.finish()
Tip
|
To find a page in the Wiki, enter the keywords in search field, press Enter, then click Wikis. |