くらめその情シス:jamfPROにDEP Notifyを使用してMacの自動セットアップを構成してみた

2021.05.14

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは

情シス担当、アノテーションの畠山です。

前回は、jamfPROの無料のアドオンソフトである、DEP Notifyについて、ご紹介いたしましたが、今回は、詳細な設定方法について書いていこうと思います。

はじめに

DEP Notifyは、jamfPROのアドオンソフトとして、無料で公開されているソフトウェアですが、jamfPROを運用している情シスの方や、会社からMacを支給された方々の初期セットアップを、強力にサポートできるものとして非常に便利なツールとなっています。

DEP Notifyに関する、詳細な情報に関しては、以下のブログで公開していますので、ご参考にしてください。

jamfPROにDEP Notifyを導入して、ほぼゼロタッチデプロイ運用を実現してみた。

DEP Notify のセットアップを始めましょう

セットアップは、以下の手順で進めます。 まずは、テスト環境を用意して、対象とする検証用のMacだけにDEP Notifyが実行される様にすることをお勧めします。

DEP Notifyには、テストモードが用意されています。

テストモードでは、DEP Notifyの画面は表示されますが、実際のポリシーは適用されませんので、DEP Notifyの動作確認だけを実施することが可能です。

  1. パッケージの入手
  2. 表示するロゴ画像パッケージの作成
  3. Macに自動インストールするアプリの選定と順序の決定
  4. DEPNotify.shのカスタマイズ
  5. テスト対象のSmart Computer Groupを作成する
  6. DEP Notifyを実行させるためのポリシーの作成
  7. テスト用のMacでDEP Notifyの動作確認
  8. 全MacへのDEP Notifyの適用

パッケージの入手

DEP Notifyのパッケージを以下のサイトからダウンロードします。 (リンクをクリックするとダウンロードされます。)

パッケージダウンロードサイト

表示するロゴ画像パッケージの作成

DEP Notifyの画面に会社のロゴ画像を表示することができます。

ロゴ画像を、表示するためにはjamf Composerを使用します。(入手方法は、jamfのご購入先にお問い合わせください)

「Build as PKG」を押して、DEPNotifyIcon.pkgファイルをビルドします。

なお、パッケージをビルドする際には、実際のjamfcloudサーバーの署名証明書が必要になりますので、事前にこちらを参考に作成してComposerへの設定をしましょう。

Macに自動インストールするアプリの選定と順序の決定

自動的にインストールするアプリケーションの順序を決めましょう。

決めた順番で、ポリシー名の先頭に「010」などの番号を付与することで、jamfのポリシー表示も実行順に並ぶため、見やすくなります。

DEPNotify.shのカスタマイズ

以下のサイトより、DEPNotify.shを取得します。

DEPNotify.sh

ソースを全てコピーして、ローカルに「DEPNotify.sh」という名前で保存します。

保存したシェルスクリプトをカスタマイズしていきます。

カスタマイズする部分は、以下になります。

  • 42行目:まずは「TEST MODE」なので、このままで
  • 53行目:Composerで指定したしたロゴが保管されるパスを指定します
  • 56行目:ORG_NAMEには、会社名を指定します
  • 60行目:BANNER_TITLEには、DEP Notifyのタイトルを指定します(ex.「ようこそクラスメソッド へ」)
  • 63行目:サポートの窓口となるメールアドレス等があれば、設定してください
  • 68行目:MAIN_TEXT DEP Notifyが何をするのか、どのくらいの時間がかかるのか等書くといいでしょう
  • 71行目:INITAL_START_STATUS 初期設定開始のメッセージを指定します
  • 74行目:INSTALL_COMPLETE_TEXT 設定完了時のメッセージを指定します
  • 84行目〜87行目:FV_ALERT_TEXT、FV_COMPLETE_MAIN_TEXT、FV_COMPLETE_BUTTON_TEXTは、設定完了時にFileVaultを有効にするポリシーがある場合、表示されるメッセージで、ボタンの表示名をFV_COMPLETE_BUTTON_TEXTで指定します
  • 154行目〜 【重要】実行したいポリシーを順に”「表示するメッセージ」、「,」、「カスタムトリガー名」”で指定します
    "Installing Chrome,chrome"

カスタムトリガー について

通常、jamfでは起動、ログイン、ログアウト、ネットワーク状態の変更、登録完了、Recurring Check-inの5つのトリガーが用意されています。

これに加えて、カスタムトリガー というトリガーがあります。カスタムトリガー は、ユーザーが指定した名前をスクリプトを使用して呼び出して実行することができます。

逆に、スクリプトやコマンド以外ではこのトリガーを実行することはできません。

DEP Notifyでは、このカスタムトリガー を使用して、順番にトリガーを起動することでポリシーを実行します。

DEPNotify.shのカスタマイズが出来たら、jamf管理画面の「全ての管理」→「コンピュータ管理」の「スクリプト」にアップロードします。

アップロード後は、こちらでスクリプト内容を編集することが可能です。

以下、DEPNotify.shのサンプルです。

DEPNotify.sh
#!/bin/bash
# Version 2.0.5

#########################################################################################
# License information
#########################################################################################
# Copyright 2018 Jamf Professional Services

# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

#########################################################################################
# General Information
#########################################################################################
# This script is designed to make implementation of DEPNotify very easy with limited
# scripting knowledge. The section below has variables that may be modified to customize
# the end user experience. DO NOT modify things in or below the CORE LOGIC area unless
# major testing and validation is performed.

# More information at: https://github.com/jamfprofessionalservices/DEP-Notify

#########################################################################################
# Testing Mode
#########################################################################################
# Testing flag will enable the following things to change:
# Auto removal of BOM files to reduce errors
# Sleep commands instead of policies or other changes being called
# Quit Key set to command + control + x
TESTING_MODE=true # Set variable to true or false

#########################################################################################
# General Appearance
#########################################################################################
# Flag the app to open fullscreen or as a window
FULLSCREEN=true # Set variable to true or false

# Banner image can be 600px wide by 100px high. Images will be scaled to fit
# If this variable is left blank, the generic image will appear. If using custom Self
# Service branding, please see the Customized Self Service Branding area below
BANNER_IMAGE_PATH="/Applications/Self Service.app/Contents/Resources/AppIcon.icns"

# Update the variable below replacing "Organization" with the actual name of your organization. Example "ACME Corp Inc."
ORG_NAME="Organization"

# Main heading that will be displayed under the image
# If this variable is left blank, the generic banner will appear
BANNER_TITLE="Welcome to $ORG_NAME"

# Update the variable below replacing "email helpdesk@company.com" with the actual plaintext instructions for your organization. Example "call 555-1212" or "email helpdesk@company.com"
SUPPORT_CONTACT_DETAILS="email helpdesk@company.com"

# Paragraph text that will display under the main heading. For a new line, use \n
# If this variable is left blank, the generic message will appear. Leave single
# quotes below as double quotes will break the new lines.
MAIN_TEXT='Thanks for choosing a Mac at '$ORG_NAME'! We want you to have a few applications and settings configured before you get started with your new Mac. This process should take 10 to 20 minutes to complete. \n \n If you need additional software or help, please visit the Self Service app in your Applications folder or on your Dock.'

# Initial Start Status text that shows as things are firing up
INITAL_START_STATUS="Initial Configuration Starting..."

# Text that will display in the progress bar
INSTALL_COMPLETE_TEXT="Configuration Complete!"

# Complete messaging to the end user can ether be a button at the bottom of the
# app with a modification to the main window text or a dropdown alert box. Default
# value set to false and will use buttons instead of dropdown messages.
COMPLETE_METHOD_DROPDOWN_ALERT=false # Set variable to true or false

# Script designed to automatically logout user to start FileVault process if
# deferred enablement is detected. Text displayed if deferred status is on.
# Option for dropdown alert box
FV_ALERT_TEXT="Your Mac must logout to start the encryption process. You will be asked to enter your password and click OK or Continue a few times. Your Mac will be usable while encryption takes place."
# Options if not using dropdown alert box
FV_COMPLETE_MAIN_TEXT='Your Mac must logout to start the encryption process. You will be asked to enter your password and click OK or Continue a few times. Your Mac will be usable while encryption takes place.'
FV_COMPLETE_BUTTON_TEXT="Logout"

# Text that will display inside the alert once policies have finished
# Option for dropdown alert box
COMPLETE_ALERT_TEXT="Your Mac is now finished with initial setup and configuration. Press Quit to get started!"
# Options if not using dropdown alert box
COMPLETE_MAIN_TEXT='Your Mac is now finished with initial setup and configuration.'
COMPLETE_BUTTON_TEXT="Get Started!"

#########################################################################################
# Plist Configuration
#########################################################################################
# The menu.depnotify.plist contains more and more things that configure the DEPNotify app
# You may want to save the file for purposes like verifying EULA acceptance or validating
# other options.

# Plist Save Location
# This wrapper allows variables that are created later to be used but also allow for
# configuration of where the plist is stored
INFO_PLIST_WRAPPER (){
DEP_NOTIFY_USER_INPUT_PLIST="/Users/$CURRENT_USER/Library/Preferences/menu.nomad.DEPNotifyUserInput.plist"
}

# Status Text Alignment
# The status text under the progress bar can be configured to be left, right, or center
STATUS_TEXT_ALIGN="center"

# Help Button Configuration
# The help button was changed to a popup. Button will appear if title is populated.
HELP_BUBBLE_TITLE="Need Help?"
HELP_BUBBLE_BODY="This tool at $ORG_NAME is designed to help with new employee onboarding. If you have issues, please $SUPPORT_CONTACT_DETAILS"

#########################################################################################
# Error Screen Text
#########################################################################################
# If testing mode is false and configuration files are present, this text will appear to
# the end user and asking them to contact IT. Limited window options here as the
# assumption is that they need to call IT. No continue or exit buttons will show for
# DEP Notify window and it will not show in fullscreen. IT staff will need to use Terminal
# or Activity Monitor to kill DEP Notify.

# Main heading that will be displayed under the image
ERROR_BANNER_TITLE="Uh oh, Something Needs Fixing!"

# Paragraph text that will display under the main heading. For a new line, use \n
# If this variable is left blank, the generic message will appear. Leave single
# quotes below as double quotes will break the new lines.
ERROR_MAIN_TEXT='We are sorry that you are experiencing this inconvenience with your new Mac. However, we have the nerds to get you back up and running in no time! \n \n Please contact IT right away and we will take a look at your computer ASAP. \n \n'
ERROR_MAIN_TEXT="$ERROR_MAIN_TEXT $SUPPORT_CONTACT_DETAILS"

# Error status message that is displayed under the progress bar
ERROR_STATUS="Setup Failed"

#########################################################################################
# Trigger to be used to call the policy
#########################################################################################
# Policies can be called be either a custom trigger or by policy id.
# Select either event, to call the policy by the custom trigger,
# or id to call the policy by id.
TRIGGER="event"

#########################################################################################
# Policy Variable to Modify
#########################################################################################
# The policy array must be formatted "Progress Bar text,customTrigger". These will be
# run in order as they appear below.
POLICY_ARRAY=(
"Installing Adobe Creative Cloud,adobeCC"
"Installing Adobe Reader,adobeReader"
"Installing Chrome,chrome"
"Installing Firefox,firefox"
"Installing Zoom,zoom"
"Installing NoMAD,nomad"
"Installing Office,msOffice"
"Installing Webex,webex"
"Installing Critical Updates,updateSoftware"
)
------------ 以下省略 ------------------

テスト対象のSmart Computer Groupを作成する

テスト時は、テスト対象のMacだけにDEP Notifyが適用される様にするために、テスト専用のSmart Computer Groupを作成します。

テスト専用のSmart Computer Groupは、まだjamfに登録されていないMacを対象にする必要があるため、コンピュータ名等の情報は使用できません。

そこで、Criteriaには、Serial Numberを指定して、対象Macを抽出できる様にします。

ABMからMDM連携でjamfにエンロールが開始されたMacのうち、このSmart Computer GroupのものだけにDEP Notifyが実行される様、ポリシーのScopeに作成したSmart Computer Groupを設定します。

DEP Notifyを実行させるためのポリシーの作成

DEP Notifyのポリシーは、DEP Notifyをインストールするためのポリシーのみが、「登録完了」トリガーで動作する様にして、その後、自動的にインストールさせたいアプリケーションのポリシーは全て、カスタムトリガーで登録します。

【重要】DEP Notifyをインストールするための最初のポリシーの作成には、以下の注意が必要です。

  • DEP Notifyパッケージと一緒に、DEP Notifyicon(ロゴ画像)パッケージを設定する
  • DEPNotify.shスクリプトを設定する
  • M1 Macがある場合、Rosetta2をDEP Notifyより先にインストールする必要がある

DEP Notifyポリシーの内容
パッケージ(DEP Notify本体と表示するロゴ画像を指定)


スクリプト(DEPNotify.sh)


Rosetta2のインストールスクリプトの設定
優先順位が「Before」になっていることに注意してください。

なお、テスト時は、既存のポリシーとDEP Notifyのポリシーが重複してしまうため、既存ポリシーの方のScopeで、DEP Notify対象Smart Computer Groupは除外に設定しておきましょう。

テスト用のMacでDEP Notifyの動作確認

テスト用のMacを初期化して、DEP Notifyが正しく動作するか確認してみましょう。

まず、初回セットアップウィザードでリモートマネジメントが表示され、MDMサーバーに接続できたことを確認します。

一瞬、デスクトップが表示された後、DEP Notifyが起動して、設定したポリシーのインストールが始まります。


全てのポリシーのインストールが完了すると、FileVaultを有効化するポリシーがあれば、指定したボタン名で「ログアウト」のボタンが表示されます。

DEP Notifyの中で、確認ウィンドウを出すポリシーを実行すると、ログアウトができなくなったり、インストールが途中で止まったりする場合があります。

その場合は、Command + Control + x キーで、DEP Notifyの画面を閉じることができます。

なお、画面は閉じてもDEP Notifyの実行は進みます。

テストモードで、設定したポリシーのインストールが動作したら、テストモードを外して、実際にポリシー適用まで実施してみましょう。 テストモードの解除は、DEP Notify.shの42行目をfalseに設定してください。

すでに、Smart Computer Groupや、既存ポリシーへの除外設定をしていれば、重複してポリシー適用がされたりしませんので通常のjamfエンロールでのポリシー適用時と、DEP Notifyでの実行時のポリシー適用に差がないことをこの時点で確認するといいでしょう。

全MacへのDEP Notifyの適用

テスト用のMacで、DEP Notifyの動作確認ができたら、本番リリースしましょう。 この時点で、登録済みのMacには、影響はありません。

作業項目としては、以下になります。

  • DEP NotifyのポリシーのScopeに指定していたテスト対象のSmart Computer GroupをAll Computerに変更する
  • DEP Notify以外のポリシーで除外していたテスト対象のSmart Computer Groupを解除
  • DEP Notifyに移行したポリシーは、一旦「無効」にした上で、後に削除

注意:最終的に、「登録完了」トリガーで実行するポリシーは、DEP Notifyのみにしてください。 また、「ログイン」トリガーは、「登録完了」トリガーの後、すぐにキックされますので、こちらも考慮が必要です。

おわりに

最後まで、お読みいただきありがとうございます。

DEP Notifyに関しては、まだまだ情報が少なく、いろいろな方にサポートしていただきながらここまでできました。

この場を借りて、お礼を申し上げます。

また、今後、jamfをもっともっと活用して、Macのデバイス管理を効率化していく一つのツールとして、DEP Notifyをご活用いただければと思います。

関連リンク

DevelopersIO jamf関連リンク