Skip to content

Unable to unlock Filevault with LAPS Admin #106

@mruepp

Description

@mruepp

We try to roll out LAPS Admin & macOSLAPS on our Intune Managed Machines.
We create a Smartcard enforced config but we exclude unmapped users.

So the flow is:
Local User enrollment -> LAPS Admin created through MDM with random password -> macLAPS gets installed MDM -> Custom Attribute should show LAPS Password

Our enrollment User is the first to be assigned the Secure Token and the only one to login interactively. The LAPS Admin gets created later in the process. Never would someone interactively login to the LAPS Admin account except breaking glass is necessary.

We can not unlock Filevault in the Bootprocess with the LAPS Admin, even if we manually rotate the password using
sudo /usr/local/laps/macOSLAPS -resetPassword

Our macLAPS Config looks like this:

    <key>DaysTillExpiration</key>
    <integer>30</integer>
    <key>LocalAdminAccount</key>
    <string>lapsadmin</string>
    <key>PasswordLength</key>
    <integer>14</integer>
    <key>PasswordGrouping</key>
    <integer>6</integer>
    <key>PasswordSeparator</key>
    <string>-</string>
    <key>RemovePassChars</key>
    <string>{}[]|</string>
    <key>Method</key>
    <string>Local</string>
    <key>PasswordRequirements</key>
        <dict>
            <key>Lowercase</key>
            <integer>1</integer>
            <key>Uppercase</key>
            <integer>1</integer>
            <key>Number</key>
            <integer>1</integer>
            <key>Symbol</key>
            <integer>1</integer>
        </dict>

Our initial Password creation snippet looks like this, we create a random password and we use this script to create Admin through MDM

echo "Creating new local admin account [$adminaccountname]"
p=`cat /dev/urandom | base64 | tr -dc '0-9a-zA-Z' | head -c14 | base64`

We use this script to record the password as custom attribute.

#!/bin/zsh
: '
-------------------------
| macOSLAPS EA Combined |
-------------------------
| Captures the Password and Expiration from the files
| outputted to the filesystem and sends the results
| to jamf in the following format:
|     | Password: PasswordHere | Expiration: ExpirationHere |
------------------------------------------------------------
| Created: James Smith - https://github.com/smithjw
| Last Update By: Joshua D. Miller - josh.miller@outlook.com
| Last Update Date: January 29, 2023
------------------------------------------------------------
'
### -------------------- ###
### | Global Variables | ###
### -------------------- ###
## Path to macOSLAPS binary ##
LAPS=/usr/local/laps/macOSLAPS
## Path to Password File ##
PW_FILE="/var/root/Library/Application Support/macOSLAPS-password"
## Path to Expiration File ##
EXP_FILE="/var/root/Library/Application Support/macOSLAPS-expiration"
## Local Admin Account ##
LOCAL_ADMIN=$(/usr/bin/defaults read \
    "/Library/Managed Preferences/edu.psu.macoslaps.plist" LocalAdminAccount)
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: #
### ----------------------- ###
### | Verify Requirements | ###
### ----------------------- ###
verify_requirements () {
    ## Does the binary exist ##
    if [ ! -e $LAPS ]
    then
        /bin/echo "macOSLAPS Not Installed"
        return
    fi
    ## Verify Local Admin Specified Exists ##
    if id "$1" &> /dev/null
    then
        /bin/echo "Yes"
    else
        /bin/echo "Account Not Found"
    fi
    return
}
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: #
### ----------------- ###
### | Main Function | ###
### ----------------- ###
## Determine if macOSLAPS itself exits and the local admin account is present ##
VERIFIED=$(verify_requirements "$LOCAL_ADMIN")
## If we have verified LAPS and the Account ##
if [[ "$VERIFIED" == "Yes" ]]
then
    ## Ask macOSLAPS to write out the current password to the system keychain
    $LAPS -getPassword > /dev/null
    SERVICE_NAME=$(/bin/cat /var/root/.GeneratedLAPSServiceName)
    CURRENT_PASSWORD=$(/usr/bin/security find-generic-password -s "$SERVICE_NAME" -w 2&> /dev/null)
    CURRENT_EXPIRATION=$(/usr/bin/security find-generic-password -s "$SERVICE_NAME" | /usr/bin/grep -Eo "\d{4}-\d{2}-\d{2}.*\d")
    ## Test $current_password to ensure there is a value
    if [ -z "$CURRENT_PASSWORD" ]
    then
        ## Don't Write anything to jamf as it might overwrite an
        ## old password in place that might still be needed
        exit 0
    else
        /bin/echo "Password: $CURRENT_PASSWORD | Expiration: $CURRENT_EXPIRATION"
        ## Run macOSLAPS a second time to remove the password export entry from the system keychain
        $LAPS > /dev/null
    fi
## Otherwise ##
else
	echo "<result>Not Installed</result>"
fi

exit 0

Is there something I miss? So the goal would be to have a breaking glass local admin user with regular password rotation write back as custom attribute to our MDM which allows us to circumvent the Smartcard only login on boot with File Vault.

Thanks,

Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions