Created
February 11, 2019 16:26
-
-
Save poundbangbash/3aec9552714011fd442d83724e12f37a to your computer and use it in GitHub Desktop.
Munki fact to check FileVault Status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Check if FileVault is Active''' | |
import subprocess | |
def fact(): | |
'''Check if FileVault is Active''' | |
cmd = ['/usr/bin/fdesetup', 'isactive'] | |
run = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
output, err = run.communicate() | |
try: | |
proc = subprocess.Popen(cmd, bufsize=-1, stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE) | |
(out, err) = proc.communicate() | |
# check if output is valid. | |
if "true" in out: | |
# Default to Des Moines location | |
return {'isFileVaultActive': 'True'} | |
else: | |
# Return location - strip trailing newline character | |
return {'isFileVaultActive': 'False'} | |
except OSError: | |
return {'isFileVaultActive': 'Unknown'} | |
if __name__ == '__main__': | |
print fact() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment