Files
Alte_Skripte/de.ing.add.cls_mac.sh
2026-02-16 15:05:15 +01:00

51 lines
1.4 KiB
Bash

#!/bin/bash
##########################################################################
# Script : Add cls_mac to FileVault
# Autor : Andreas Vogel
# Copyright : macenterprise gmbh, 2020
##########################################################################
# set -x
############################################# Variablen #########################################################################
DecryptString() {
# Usage: ~$ DecryptString "Encrypted String" "Salt" "Passphrase"
echo "${1}" | /usr/bin/openssl enc -aes256 -d -a -A -S "${2}" -k "${3}"
}
adminName="${7}"
adminPass=$(DecryptString "${4}" "${5}" "${6}")
add_user="${8}"
add_user_Pass=$(DecryptString "${9}" "${10}" "${11}")
############################################# Funktion #########################################################################
adduser_fv () {
expect <<EOF
spawn fdesetup add -usertoadd $add_user
expect "Enter the primary user name:"
send $adminName\r
expect "Enter the password for the user $adminName:"
send $adminPass\r
expect "Enter the password for the added user $add_user:"
send $add_user_Pass\r
expect
EOF
}
############################################# Ausführung #############################################################################
if adduser_fv
then
echo "cls_mac wurde erfolgreich hinzugefügt"
exit 0
else
echo "Fehler! cls_mac konnte nicht hinzugefügt werden."
exit 1
fi