1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

  • 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を使いました。
  • 画面右下の「+」をタップして、新しいアカウントを追加します。
    20250714_115857000_iOS.png
  • 以下の情報を入力し、「追加」をタップします。
    • アカウント名:任意
    • 鍵:security login totp createコマンドの実行結果で表示されたsecret keyの値
    • 鍵の種類:時間ベース
      20250714_120020000_iOS.jpg
  • 設定完了です。
    20250714_120136000_iOS.png

ログイン

  • 再び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の管理ユーザーを乗っ取られない限りは安心です。
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?