Home > FileVault 2, Mac administration, Scripting > FileVault 2 encryption status script now available as an Absolute Manage custom information item

FileVault 2 encryption status script now available as an Absolute Manage custom information item

Patrick Gallagher of Emory University has adapted my FileVault 2 encryption status check script for use with Absolute Manage. He was kind enough to share back a copy of his adaption of the script, so I am hosting it here on my GitHub repository.

  1. November 14, 2011 at 4:02 pm

    This is funny. On Friday, I just adapted your FV2 status script for our Absolute Manage server, too. I made some changes so that it doesn’t require a temp file but it’s based on your logic. Figured I’d pass it along.


    #!/bin/bash
    # Based on the FileVault 2 Encryption Check script by rtrouton
    # https://github.com/rtrouton/rtrouton_scripts/blob/master/rtrouton_scripts/filevault_2_encryption_check/regular_script/filevault_2_encryption_check.sh
    PATH='/usr/bin:/usr/sbin'
    ST_NOTENABLED='Not Enabled'
    ST_ENCRYPTING='Encrypting (%s%%)'
    ST_ENCRYPTED='Encrypted'
    ST_DECRYPTING='Decrypting (%s%%)'
    ST_DECRYPTED='Decrypted'
    ST_UNKNOWN='Unknown'
    OS_VERSION="$(sw_vers | awk '/ProductVersion/ {print $2}')"
    IFS=. read _ OS_MAJOR_POINT _ <<< "$OS_VERSION"
    if ((OS_MAJOR_POINT >= 7)); then
    CORE_STORAGE_STATUS="$(diskutil cs list)"
    case "$CORE_STORAGE_STATUS" in
    *'No CoreStorage'* ) printf "$ST_NOTENABLED\n" ;;
    *'Logical Volume Family'* )
    ENCRYPTION_CONTEXT="$(awk '/Encryption Context/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    if [[ "$ENCRYPTION_CONTEXT" = Present ]]; then
    ENCRYPTION_TYPE="$(awk '/Encryption Type/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    case "$ENCRYPTION_TYPE" in
    AES-XTS )
    CONVERSION_STATUS="$(awk '/Conversion Status/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    case "$CONVERSION_STATUS" in
    *Complete* ) printf "$ST_ENCRYPTED\n" ;;
    *Converting* )
    CONVERSION_DIRECTION="$(awk '/Conversion Direction/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    if [[ "$CONVERSION_DIRECTION" = *forward* ]]; then
    SIZE_CONVERTED="$(awk '/Size \(Converted\)/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    SIZE_TOTAL="$(awk '/Size \(Total\)/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    CONVERTED_PERCENT="$(bc <<< "scale=1; $SIZE_CONVERTED * 100 / $SIZE_TOTAL")"
    printf "$ST_ENCRYPTING\n" "$CONVERTED_PERCENT"
    else
    printf "$ST_UNKNOWN\n"
    fi
    ;;
    esac
    ;;
    None )
    CONVERSION_DIRECTION="$(awk '/Conversion Direction/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    case "$CONVERSION_DIRECTION" in
    *backward* )
    SIZE_CONVERTED="$(awk '/Size \(Converted\)/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    SIZE_TOTAL="$(awk '/Size \(Total\)/ {print $3}' <<< "$CORE_STORAGE_STATUS")"
    CONVERTED_PERCENT="$(bc <<< "scale=1; $SIZE_CONVERTED * 100 / $SIZE_TOTAL")"
    printf "$ST_DECRYPTING\n" "$CONVERTED_PERCENT"
    ;;
    *-none-* ) printf "$ST_DECRYPTED\n" ;;
    * ) printf "$ST_UNKNOWN\n" ;;
    esac
    ;;
    esac
    fi
    esac
    fi
    exit 0

    view raw

    gistfile1.sh

    hosted with ❤ by GitHub

  2. November 14, 2011 at 4:32 pm

    Nice work, thanks for sharing this.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: