設定 Linux 主機的鑑別

您可以為 Linux 主機設定單向 CHAP 鑑別。在配置用於主機的單向鑑別之後,您可以選擇性地設定雙向鑑別。

開始之前

系統支援兩種「盤查信號交換驗證通訊協定 (CHAP)」方法:
  • 單向 CHAP 鑑別(系統鑑別主機 iSCSI 起始器)。
  • 雙向 CHAP 鑑別(系統和起始器彼此鑑別)。
註: 您為單向鑑別和雙向鑑別選取的 CHAP 密碼必須不同。

程序

如果要設定 Linux 主機的鑑別,請遵循下列步驟:

  1. 使用適當的編輯器,開啟 /etc/iscsi/iscsid.conf/etc/iscsid.conf
  2. 移至 CHAP 設定段落。

    下列範例顯示輸出:

    圖 1. Linux 主機的 CHAP 設定
    #*************
    #CHAP Settings
    #*************
    
    #To enable CHAP authentication set node.session.auth.authmethod
    #to CHAP. The default is None.
    #node.session.auth.authmethod = CHAP
    
    #To set a CHAP username and password for initiator
    #authentication by the target(s), uncomment the following lines:
    #node.session.auth.username = username
    #node.session.auth.password = password
    node.session.auth.username = rhel_username
    node.session.auth.password = xxxxxxxxxxxxx
    #To set a CHAP username and password for target(s)
    #authentication by the initiator, uncomment the following lines:
    #node.session.auth.username_in = username_in
    #node.session.auth.password_in = password_in
    node.session.auth.password_in = yyyyyyyyyyyyy
    #To enable CHAP authentication for a discovery session to the target
    #set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
    #discovery.sendtargets.auth.authmethod = CHAP
    discovery.sendtargets.auth.authmethod = CHAP
    #To set a discovery session CHAP username and password for the initiator
    #authentication by the target(s), uncomment the following lines:
    #discovery.sendtargets.auth.username = username
    #discovery.sendtargets.auth.password = password
    
    #To set a discovery session CHAP username and password for target(s)
    #authentication by the initiator, uncomment the following lines:
    #discovery.sendtargets.auth.username_in = username_in
    #discovery.sendtargets.auth.password_in = password_in
  3. 設定鑑別。
    • 設定單向鑑別:
      1. 設定 CHAP 使用者名稱與密碼給您的起始器名稱。
        1. node.session.auth.authmethod = CHAP
        2. node.session.auth.username = <initiator's user name>
        3. node.session.auth.password = <CHAP secret for host>
      2. 設定探索階段作業 CHAP 使用者名稱與密碼給您的起始器名稱。
        1. discovery.sendtargets.auth.authmethod = CHAP
        2. discovery.sendtargets.auth.username = <initiator's user name>
        3. discovery.sendtargets.auth.password = <CHAP secret for host>
      3. 儲存這些設定。您必須登出任何現行階段作業,並重新探索系統 iSCSI 目標,以便讓 CHAP 密碼生效。
      註: 在上述範例中,xxxxxxxxxxxxx 是主機的 CHAP 密碼,rhel_username 是起始器的 IQN 名稱。這個使用者名稱與您以 chhost 指令為這部主機所設定的值(iscsiusername 欄位)必須相同。
    • 設定雙向鑑別。
      註: 設定雙向鑑別並非必要。在您配置使用雙向鑑別之前,請確定單向鑑別已配置且適用於您的主機。
      1. password_in 編輯成您在系統上使用 chsystem 指令所設定的 CHAP 密碼。
        1. 為一或多個目標,設定 CHAP 使用者名稱與密碼。
          • node.session.auth.password_in = <CHAP secret for clustered system>
        2. 為一或多個目標,設定探索階段作業 CHAP 使用者名稱與密碼。
          • discovery.sendtargets.auth.password_in = <CHAP secret for clustered system>
      2. 儲存這些設定。您必須登出任何現行階段作業,並重新探索系統 iSCSI 目標,以便讓 CHAP 密碼生效。