semanage_modify(3)

πŸ“¦
version 3.11 Β· 2 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ semanage_modify(3) ✨

okay bestie, welcome to the libsemanage API docs πŸ’– this is semanage_modify from section 3 of the manual, and she is lowkey the glow-up function of the SELinux management world. buckle up πŸŽ€


🌸 NAME 🌸

semanage_modify β€” SELinux Management API πŸ‘‘

πŸ¦‹ SYNOPSIS πŸ¦‹

so the tea is: the following modify function is supported for any semanage record. literally any of them. just swap out the function and object name to match whatever record you're working with, iykyk πŸ’…

extern int MODIFY_FUNCTION (
     semanage_handle_t *handle,
     const semanage_OBJECT_key_t *key,
     const semanage_OBJECT_t *data);

πŸ’œ DESCRIPTION πŸ’œ

🌈 Behavior

here's the vibe: if a matching key is found in the local store, the object you're handing over will replace the one that's currently there. no matching key? then it just gets added to the store instead. either way she's in 🫢

when semanage_commit(3) gets invoked, the changes get permanently written into the local store, and then loaded into policy. periodt.

the validity of the object being added? checked at commit time, not before. adding new objects with respect to policy is allowed β€” except in the case of booleans. if you try to add new booleans with respect to policy, it will fail at commit time. that's not a vibe. πŸ’€

πŸŽ€ Parameters

  • the handle is used to track persistent state across semanage calls, and for error reporting πŸ‘‘
  • the key identifies the data object, which will be written into the store πŸ—οΈ
  • the key and the data are properties of the caller, and are not stored or modified internally β€” she does not touch them, no cap 🚫

⭐ Requirements

this function requires a semanage connection to be established (peep semanage_connect(3)), and it must be executed in a transaction (peep semanage_begin_transaction(3)). no connection, no transaction, no service πŸ™ˆ


πŸ’– RETURN VALUE πŸ’–

if it fails, -1 is returned, and the semanage error callback gets invoked, describing the error (she will tell you what went wrong, fr fr 😭). otherwise, 0 is returned. slay.


πŸ”₯ SEE ALSO πŸ”₯

  • semanage_handle_create(3)
  • semanage_begin_transaction(3)
  • semanage_connect(3)
  • semanage_commit(3)

and that's the whole page, bestie ✨ this icon was brought to you by ivg2@cornell.edu, dated 16 March 2006 β€” yes she's an elder but she still ate πŸ’…πŸ‘‘πŸ¦‹πŸŒΈπŸ’œ