设置 Linux 主机的认证
您可以为 Linux 主机设置单向 CHAP 认证。在配置用于主机的单向认证之后,可以选择设置双向认证。
开始之前
系统支持两种提问握手认证协议 (CHAP) 方法:
- 单向 CHAP 认证(系统认证主机 iSCSI 启动器)。
- 双向 CHAP 认证(系统和启动器互相认证)。
注: 您为单向认证和双向认证选择的 CHAP 秘密必须不同。
过程
要设置 Linux 主机的认证,请执行以下步骤:
- 使用适当的编辑器打开 /etc/iscsi/iscsid.conf 或 /etc/iscsid.conf。
- 转至 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 = iqn.suse.nmp.com 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
- 设置认证。
- 设置单向认证:
- 设置启动器名称的 CHAP 用户名和密码。
- node.session.auth.authmethod = CHAP
- node.session.auth.username = <initiator IQN name>
- node.session.auth.password = <CHAP secret for host>
- 设置启动器名称的发现会话 CHAP 用户名和密码。
- discovery.sendtargets.auth.authmethod = CHAP
- discovery.sendtargets.auth.username = <initiator IQN name>
- discovery.sendtargets.auth.password = <CHAP secret for host>
- 保存这些设置。您必须注销任何当前会话并重新发现系统 iSCSI 目标以使 CHAP 密码生效。
注: 在以上的示例中,xxxxxxxxxxxxx 是主机的 CHAP 秘密,而 iqn.suse.nmp.com 是启动器的 IQN 名称。IQN 名称必须是使用 mkhost 命令在系统上用于创建主机对象的同一名称。 - 设置启动器名称的 CHAP 用户名和密码。
- 设置双向认证。注: 并非必须设置双向认证。在您为双向认证进行配置之前,确保您已配置了单向认证且此认证对您的主机有效。
- 将 password_in 更改为您在系统上使用 chsystem 命令设置的 CHAP 密码。
- 设置一个或多个目标的 CHAP 用户名和密码。
- node.session.auth.password_in = <CHAP secret for clustered system>
- 设置一个或多个目标的发现会话 CHAP 用户名和密码。
- discovery.sendtargets.auth.password_in = <CHAP secret for clustered system>
- 设置一个或多个目标的 CHAP 用户名和密码。
- 保存这些设置。您必须注销任何当前会话并重新发现系统 iSCSI 目标以使 CHAP 密码生效。
- 将 password_in 更改为您在系统上使用 chsystem 命令设置的 CHAP 密码。
- 设置单向认证:
相关任务: