This file contains hidden or 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
| #!/bin/bash | |
| account="laps_account" # replace this with the account you wish to track | |
| passwordLastSetTimeEpoch=$(/usr/bin/dscl . read "/Users/$account" accountPolicyData | /usr/bin/awk -F'[><]' '/<key>passwordLastSetTime<\/key>/{getline; print $3}' | /usr/bin/cut -d '.' -f1) | |
| # Time in UTC -- use `date -jf` if you want the time in local timezone instead | |
| echo "<result>$(/bin/date -juf %s "$passwordLastSetTimeEpoch")</result>" |
This file contains hidden or 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
| #!/bin/bash | |
| sync_metadata_path="/Library/laps_sync_metadata.json" | |
| jamf_out=$(/usr/local/bin/jamf rotateManagementAccountPassword -verbose 2>&1) | |
| result="" | |
| # Create metadata file | |
| if [[ ! -f "$sync_metadata_path" ]]; then | |
| /usr/bin/touch "$sync_metadata_path" | |
| /bin/chmod 600 "$sync_metadata_path" |
This file contains hidden or 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
| import Foundation | |
| import CryptoKit | |
| extension SymmetricKey { | |
| init?(base64EncodedString: String) { | |
| guard let data = Data(base64Encoded: base64EncodedString) else { | |
| return nil | |
| } | |
| self.init(data: data) |