Enable SIP with Munki

When 10.12.2 hit this week, it introduced an awesome new feature - the ability to enable SIP without having to be booted into a Recovery like environment (either Recovery HD or a NetInstall). Unfortunately it merely enables SIP on the next reboot.

Fortunately, Munki is pretty good at telling users when they need to reboot, so I wrote the following pkgsinfo file that will check if SIP is enabled, and if it isn’t, will enable it and reboot (fortunately it’s quite a bit easier to do this that it is with other tools. I’ve targeted this update at 10.12.0, because, well, if they’re not updating, I’d like them to. And it’s called ‘Critical Security Update’ so they may actually install it. If you really want them to install it, you can set a force_install_after_date and set it to the past, which will give your users a hour to install it before their machine goes byebye. Without further ado, here it is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<string>Resolves critical security issues.</string>
<string>Critical Security Update</string>
import subprocess
import sys
def main():
sip_status = subprocess.check_output(['/usr/bin/csrutil', 'status'])
if 'disabled' in sip_status:
if __name__ == '__main__':
/usr/bin/csrutil clear
exit 0</string>

If you have machines that are below 10.12 (and considering the security issues, you should consider making 10.12 a managed install), you will probably want to add it to a manifest like so:

<string>os_vers_minor &gt;= 12</string>