56 lines
1.7 KiB
Bash
56 lines
1.7 KiB
Bash
#!/bin/sh
|
|
############################################################################
|
|
# Shellscript : Prüft des Enrollment Status
|
|
# Autor : Andreas Vogel, macenterprise gmbh
|
|
# Copyright : macenterprise 2019
|
|
############################################################################
|
|
|
|
###### Variablen ######
|
|
#Profil ist vorhanden
|
|
profileAdCs="D078E91C-02B0-482B-ABEE-BF78EFACF140"
|
|
profileEnroll="1DC11CB5-55E0-41F2-B063-34090AFCD593"
|
|
|
|
# Prüfung der Profiele
|
|
checkAdCs=$(sudo /usr/bin/profiles -P | grep "$profileAdCs" | awk '{print $4}')
|
|
checkEnroll=$(sudo /usr/bin/profiles -P | grep "$profileEnroll" | awk '{print $4}')
|
|
|
|
#[[ $profileAdCs == $checkAdCs ]] -> ADCS Profil wurde installiert
|
|
#[[ $profileEnroll == $checkEnroll ]] -> Enroll 802.1x ist installiert
|
|
#[[ $aduser -gt 10000 ]] -> UUID größer als 10000. User wurde aus dem AD erstellt. ( Assount Verwaltet/Mobil )
|
|
|
|
# AD User wurde angelegt
|
|
aduser=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1)
|
|
|
|
###################################################################################################
|
|
|
|
# Prüfung auf vorhandensein des ADCS Profil
|
|
# 1 -> Profil vorhanden
|
|
# 0 -> Profil nicht vorhanden
|
|
if [[ $profileAdCs == $checkAdCs ]]
|
|
then
|
|
ADCS_Status=1
|
|
else
|
|
ADCS_Status=0
|
|
fi
|
|
|
|
# Prüfung auf vorhandensein des Enroll Profil 802.1x
|
|
# 1 -> Profil vorhanden
|
|
# 0 -> Profil nicht vorhanden
|
|
if [[ $profileEnroll == $checkEnroll ]]
|
|
then
|
|
Enroll_Status=1
|
|
else
|
|
Enroll_Status=0
|
|
fi
|
|
|
|
# Prüfung ob der Account umgestellt worden ist, auf AD Account
|
|
# 1 -> Account ist AD
|
|
# 0 -> Account ist local
|
|
if [[ $aduser -gt 10000 ]]
|
|
then
|
|
AD_Account_Status=1
|
|
else
|
|
AD_Account_Status=0
|
|
fi
|
|
|
|
echo "<result>$ADCS_Status$Enroll_Status$AD_Account_Status</result>" |