forked from loceee/OSXCasperScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add AdPassMonHelper.sh - run at login to configure and launch ADPassM…
…on (bentoms fork) for AD users. minor changes and fixes to superecon.sh
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# ADPassMonHelper.sh | ||
# | ||
# run on casper login trigger, check if user is AD | ||
# writes adpassmon prefs and launches ADPassMon if so. | ||
# | ||
# macmule's fork - https://macmule.com/2014/04/01/announcing-adpassmon-v2-fork/ | ||
# | ||
|
||
adpassmon="/Applications/Utilities/ADPassMon.app" | ||
userloggedin="${3}" | ||
|
||
expireage=${4} | ||
passwordpolicytext="${5}" | ||
|
||
uniqueid=$(echo $(dscl . read /Users/${userloggedin} UniqueID 2> /dev/null | awk '{print $2}')) | ||
|
||
if [ -z "${uniqueid}" ] || (( ${uniqueid} > 1000 )) # if user doesn't exist in localds, or uid is > 1000 - network user | ||
then | ||
echo "${userloggedin} is an AD account" | ||
if [ -f "${adpassmon}/Contents/MacOS/ADPassMon" ] | ||
then | ||
echo "writing ADPassMon preferences ..." | ||
sudo -u ${userloggedin} defaults write org.pmbuko.ADPassMon expireAge -int ${expireage} | ||
sudo -u ${userloggedin} defaults write org.pmbuko.ADPassMon pwPolicy -string "${passwordpolicytext}" | ||
sudo -u ${userloggedin} defaults write org.pmbuko.ADPassMon selectedBehaviour -int 2 | ||
sudo -u ${userloggedin} defaults write org.pmbuko.ADPassMon prefsLocked -bool true | ||
echo "launching ADPassMon ..." | ||
sudo -u "${userloggedin}" "${adpassmon}/Contents/MacOS/ADPassMon" & | ||
else | ||
echo "ADPassMon is NOT installed, doing nothing" | ||
fi | ||
else | ||
echo "${userloggedin} is a local user, doing nothing" | ||
fi | ||
exit 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,4 @@ then | |
${dockutil} --add "${target}" --display folder --view grid "${abshome}" | ||
fi | ||
fi | ||
exit | ||
exit |
This file contains 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