はじめに
- ONTAPでは、SSH接続時の多要素認証の手段としてTOTPをサポートしています。(ONTAP 9.13.1以降)
- TOTP(Time-based One-Time Password)とは、ログイン時に「Google Authenticator」のような認証アプリに表示されるワンタイムパスワードを入力するアレです。
- 公式のドキュメントではTOTPの設定方法がいまいち分かりづらかったので記事にしてみました。
ONTAPにおけるTOTPのサポート状況(ONTAP 9.16.1時点)
- SSH認証でのみ利用可能です。System Manager(GUI)などへの認証にはサポートされていません。
- セカンダリの認証方法としてのみサポートされており、プライマリの認証方法としてパスワード認証もしくはSSH鍵認証を設定する必要があります。
- 認証アプリとして以下をサポートしています。
- Microsoft Authenticator
- Google Authenticator
- Authy
- その他TOTP互換の認証アプリ
やってみた
ユーザー作成
- 今回は
totp-user
というユーザーを新規作成します。その際、プライマリの認証方法としてパスワード認証、セカンダリの認証方法としてTOTPを設定します。
コマンド
security login create -user-or-group-name totp-user -role admin -application ssh -authentication-method password -second-authentication-method totp
- パスワードの設定を求められるので入力します。
実行結果
Please enter a password for user 'totp-user':
Please enter it again:
Warning: TOTP is initially disabled for user "totp-user". To enable TOTP, user "totp-user" must login and configure TOTP using the "security login totp create".
-
totp-user
ユーザーが作成されていることを確認します。
コマンド
security login show -user-or-group-name totp-user
実行結果
Vserver: cluster1
Second
User/Group Authentication Acct Authentication
Name Application Method Role Name Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
totp-user ssh password admin no totp
- ユーザー作成時、「TOTPが無効なので、"totp-user"ユーザーでログインして、TOTPの設定をするように」という主旨の警告メッセージが表示されていたので、その通りに設定していきます。
TOTP設定(ONTAP側)
-
totp-user
ユーザーでログインします。(cluster1は名前解決済みのONTAPクラスタ名)
コマンド
ssh totp-user@cluster1
- パスワードを入力します。
実行結果
Password:
This is your first recorded login.
-
totp-user
ユーザーのTOTPの設定を行います。秘密鍵(secret key
)の値は後で使うので控えておきます。
コマンド
security login totp create -username totp-user
実行結果
TOTP profile information of user "totp-user".
Warning: pasting the following URL into your browser exposes the OTP secret to Google:
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/root@cluster1-01%3Fsecret%3XXXXXXXXXXXXXXXXXXXXXXXXXX%26issuer%3Dcluster1-01
Your new secret key is: XXXXXXXXXXXXXXXXXXXXXXXXXX
Your verification code for code 1 is 999999
Your emergency scratch codes are:
12345678
12345678
12345678
12345678
12345678
-
totp-user
ユーザーのTOTPが有効になっていることを確認します。
コマンド
security login totp show -username totp-user
実行結果
Vserver: cluster1
UserName: totp-user
TOTP SHA Fingerprint:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TOTP status:
true
Comment:
-
TOTP設定(認証アプリ側)
- スマートフォンにて認証アプリを起動します。今回はGoogle Authenticatorを使いました。
- 画面右下の「+」をタップして、新しいアカウントを追加します。
- 以下の情報を入力し、「追加」をタップします。
- 設定完了です。
ログイン
- 再び
totp-user
ユーザーでログインします。
コマンド
ssh totp-user@cluster1
- パスワードの入力後に
Verification code
の入力を求められるので、認証アプリ上に表示されている6桁の数字を入力します。
実行結果
Password:
Verification code:
Last login time: 7/14/2025 11:56:59
- パスワード認証とTOTP認証の多要素認証でログインできました。
まとめ
- ONTAPへのSSH接続時の認証方法としてTOTPを設定しました。
- これで、万が一ONTAPの管理ユーザーのユーザー名/パスワードが流出してしまっても、攻撃者にスマートフォンを盗まれてスマートフォンのロックを解除されない限りはONTAPの管理ユーザーを乗っ取られない限りは安心です。