Forum: CFEngine Help
Subject: Re: CFEngine Help: Managing Booleans
Author: daveseff
Link to topic: https://cfengine.com/forum/read.php?3,27500,27538#msg-27538
I've written this library function here it seems to work well so far:
bundle agent set_selinux_boolean(s, i){
classes:
"BOOL_OFF" expression => strcmp("$(i)", "off");
"BOOL_ON" expression => strcmp("$(i)", "on");
"sebooloff" expression => regcmp(".*off$", execresult("/usr/sbin/getsebool
$(s)", "noshell"));
"seboolon" expression => regcmp(".*on$", execresult("/usr/sbin/getsebool
$(s)", "noshell"));
reports:
sebooloff.BOOL_ON::
"$(s) is off. Lets turn it on.";
seboolon.BOOL_OFF::
"$(s) is on. Let's turn it off.";
commands:
sebooloff.BOOL_ON::
"/usr/sbin/setsebool -P $(s) on";
seboolon.BOOL_OFF::
"/usr/sbin/setsebool -P $(s) off";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine