Skip to contentSkip to conversation

alternative to audit2* and semanage without Python?

DISCUSSION Matěj Cepl 2 participants 3 messages Dec 4 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

does anybody know about an alternative to user space SELinux utilities which wouldn't require Python?

I am using a minimal host distribution (based on openSUSE MicroOS) using distrobox and Flatpak containers everywher, and I would like to eliminate Python from the host system. fwupd (where fortunately Python utilities are used only for management of firmware uploads and they are not required for end users) and SELinux utilities are the only ones which pull in Python for me.

Alternatively, I can ask a friendly LLM near me to rewrite those utilities in Go, but that would be only the last hopeless attempt.

Any thoughts?

Matěj

Signature · 6 lines
http://matej.ceplovi.cz/blog/, @[email protected]
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
Scouts are saving aluminium cans, bottles and other items to be
recycled. Proceeds will be used to cripple children.
      -- from a church bulletin
maintainer
#1 lore raw
Quoted 13 lines · Matěj Cepl

Hi,

does anybody know about an alternative to user space SELinux utilities which wouldn't require Python?

I am using a minimal host distribution (based on openSUSE MicroOS) using distrobox and Flatpak containers everywher, and I would like to eliminate Python from the host system. fwupd (where fortunately Python utilities are used only for management of firmware uploads and they are not required for end users) and SELinux utilities are the only ones which pull in Python for me.

Quoted 5 lines

Alternatively, I can ask a friendly LLM near me to rewrite those utilities in Go, but that would be only the last hopeless attempt.

Any thoughts?

On a production system with a static policy (e.g. any policy customization done off-line and then pushed to the system already fully compiled/configured), I'm not sure you need any of the selinux python utilities. You can pull the logs to another system for running audit2allow and then push back the regenerated policy, and similarly for anything you might want to do via semanage. And most of the logic for semanage lives in libsemanage which is C code, so just rewriting the semanage python to go shouldn't be too large a lift if you truly need it on the end system.

maintainer
#2 lore raw
Quoted 21 lines · Stephen Smalley
Quoted 13 lines · Matěj Cepl

Hi,

does anybody know about an alternative to user space SELinux utilities which wouldn't require Python?

I am using a minimal host distribution (based on openSUSE MicroOS) using distrobox and Flatpak containers everywher, and I would like to eliminate Python from the host system. fwupd (where fortunately Python utilities are used only for management of firmware uploads and they are not required for end users) and SELinux utilities are the only ones which pull in Python for me.

Quoted 5 lines

Alternatively, I can ask a friendly LLM near me to rewrite those utilities in Go, but that would be only the last hopeless attempt.

Any thoughts?

Quoted 9 lines

On a production system with a static policy (e.g. any policy customization done off-line and then pushed to the system already fully compiled/configured), I'm not sure you need any of the selinux python utilities. You can pull the logs to another system for running audit2allow and then push back the regenerated policy, and similarly for anything you might want to do via semanage. And most of the logic for semanage lives in libsemanage which is C code, so just rewriting the semanage python to go shouldn't be too large a lift if you truly need it on the end system.

I also wouldn't be opposed to upstreaming a Go or other compiled-language version of semanage and perhaps audit2allow.