LoginSignup
1
2

Cloudflare WARP クライアントの自動登録を macOS で確認する

Last updated at Posted at 2021-10-20

概要

macOS · Cloudflare for Teams documentation

MDM を使った WARP クライアントの配布が可能ですが、Service Token のパラメータを指定することで登録・接続までを自動的に行うことができます。
今回は MDM を使わずに確認します。

Service Token 作成

Create a service token · Cloudflare for Teams documentation

↑こちらの手順に従って https://dash.teams.cloudflare.com からService Token を事前に作成します。
Client Secret は一度しか表示されませんので、控えておいて後で使います。

image-20211020121028882
image-20211020121143621

Device enrollment rule の作成

https://dash.teams.cloudflare.com の Settings > Devices > Device enrollment permissions > Manage > Device enrollment rules > Add a policy から以下のようなルールを作成し Save します。

  • Rule action --> Service Auth
  • Include --> Service Token --> Select Service Token name

image-20211020122050634

WARP クライアントダウンロード

macOS desktop client · Cloudflare WARP client docs

zip をダウンロードし、pkg ファイルを取り出しておきます。

curl -o ~/Downloads/Cloudflare_WARP.zip https://www.cloudflarewarp.com/Cloudflare_WARP.zip
unzip -o ~/Downloads/Cloudflare_WARP.zip -d ~/Downloads

または

plistファイル作成

Parameters · Cloudflare for Teams documentation

WARP インストール時に設定可能なパラメータを plist ファイルで作成します。

  • organization は、Settings > General から ORG_NAME.cloudflareaccess.com を確認できます
  • onboarding のステップをスキップします。
  • switch_lockedauto_connect を使って起動時に自動接続させます。
  • auth_client_idauth_client_secret を使って起動時に自動登録させます。

その後、バイナリフォーマットに変換し、所定のディレクトリに配置します。

export ORG_NAME='YOUR_ORG_NAME'
export CLIENT_ID='YOUR_CLIENT_ID'
export CLIENT_SECRET='YOUR_CLIENT_SECRET'
cat << EOS > com.cloudflare.warp.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>organization</key>
    <string>$ORG_NAME</string>
    <key>service_mode</key>
    <string>warp</string>
    <key>onboarding</key> 
    <false />
    <key>switch_locked</key> 
    <true />
    <key>auto_connect</key> 
    <integer>0</integer> 
    <key>auth_client_id</key>
    <string>$CLIENT_ID</string>
    <key>auth_client_secret</key>
    <string>$CLIENT_SECRET</string>
</dict>
</plist>
EOS

plutil -convert binary1 com.cloudflare.warp.plist
sudo chown root:wheel com.cloudflare.warp.plist
sudo mv com.cloudflare.warp.plist /Library/Managed\ Preferences

WARP クライアントインストール

インストールします。

sudo installer -pkg ~/Downloads/Cloudflare_WARP.pkg -target /

先ほどの plist ファイルを読み取り、自動で登録・接続までが行われたことが確認できます。

image-20211020122925602

image-20211020123347434

image-20211020123429691

Cloudflare for Teams ダッシュボードで確認

User Email は non_identity@ORG_NAME.cloudflareaccess.com となるため、Gateway ID がユニーク値になります。

image-20211020123614614

ログでは以下のように表示されます。(Device ID = Gateway ID

image-20211020123923150

参考:WARP アンインストール

Remove WARP · Cloudflare for Teams documentation

echo Y | /Applications/Cloudflare\ WARP.app/Contents/Resources/uninstall.sh
sudo rm /Library/Managed\ Preferences/com.cloudflare.warp.plist
Do you want to uninstall Cloudflare WARP app? Enter Y to proceed or N to exit. Y
Proceeding with uninstallation.
Stopping and unloading CloudflareWARP daemon.
Password:
Stopped and unloaded 'CloudflareWARP' daemon process.
Removed daemon plist file.
Stopping 'Cloudflare WARP' GUI process.
'Cloudflare WARP' GUI process running with pid: 1508.
Killed 'Cloudflare WARP' GUI process.
Removing 'Cloudflare WARP' app folder.
Forgot package 'com.cloudflare.1dot1dot1dot1.macos' on '/'.
Removing settings and log files folder.
Finished uninstallation!

参考:トラブルシューティング

以下のコマンドでログファイルを出力できます。

cd /Applications/Cloudflare\ WARP.app/Contents/Resources
warp-diag
Debugging information stored in: ~/Desktop/warp-debugging-info.zip
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2