亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

iSCSI服務器CHAP雙向認證配置及創(chuàng)建步驟

 更新時間:2022年04月01日 08:57:21   作者:IT中國人  
這篇文章主要介紹了iSCSI服務器CHAP雙向認證配置,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

一 iSCSI和CHAP介紹

1.1 iSCSI 磁盤

  • iSCSI后端存儲支持多種設備類型,主要有:
  • 文件
  • 單一分區(qū)(partition)

1.磁盤

2.數(shù)組

3.RAID

LVM 本手冊建議以裸磁盤vdb作為示例,其他類型配置參考《002.iSCSI服務端多類型配置》。 同時本手冊基于生產環(huán)境安全考慮,結合CHAP進行配置認證。

1.2 CHAP介紹

基于IP的認證比較粗糙,對于安全性要求高的環(huán)境來說,使用CHAP認證其安全性更有保障。

CHAP(Challenge-Handshake Authentication Protocol),稱為挑戰(zhàn)式握手認證協(xié)議,它是雙向認證,當然也支持單向認證。

對于iscsi而言,在CHAP認證的機制上有兩種方式:initiator authentication和target authentication。

1.2.1 initiator authentication認證

在initiator嘗試連接到一個target的時候,initator需要提供一個用戶名和密碼給target被target進行認證。

也就是說initiator需要被target認證,它向target端提供的賬號和密碼是target端指定的。

這個賬號和密碼對于target來說是流入的賬號和密碼,用incoming表示。

稱呼這個賬號和密碼為:incoming賬號和incoming密碼。

即,incoming賬號是initiator端提供給target端,被target端認證的賬號。

1.2.2 target authentication認證

在initiator嘗試連接到一個target的時候,target有時也需要被initiator認證,以確保該target是合法而非偽裝的target,這就要求target提供一個用戶名和密碼給initiator被initiator進行認證。 
target向initiator提供的賬號和密碼對于target而言是流出的,所以稱之為outgoing。 
稱呼這個賬號和密碼為:outgoing賬號和outgoing密碼。 
而對于initiator而言是incoming的,所以在initiator配置文件中稱為in。 
也就是說outgoing賬號是target端提供給initiator端,被initiator認證的賬號,但盡管如此,這個賬號和密碼還是在target端創(chuàng)建和綁定的。

1.2.3 單/雙向認證

兩種認證方式是有層次順序的。 
一般來說,有認證需求的時候都是服務器驗證客戶端是否有權限,iscsi也一樣。 
initiator authentication可以單獨存在,它可以在沒有target authentication的情況下應用,這時候的CHAP認證就是單向認證(target認證initiator的合法性)。 
但target authentication只有在initiator authentication的基礎上才能進行。也就是說target認證和initiator認證必須同時存在才可以。即initiator和target需要相互認證實現(xiàn)雙向CHAP認證。

注意:發(fā)現(xiàn)認證和登錄認證都支持單/雙向認證。

二 iSCSI創(chuàng)建步驟

  • 建立用于共享的磁盤
  • 創(chuàng)建后備磁盤
  • 創(chuàng)建相應的IQN
  • 創(chuàng)建相應的規(guī)則
  • 為后備磁盤創(chuàng)建LUN
  • 創(chuàng)建雙向認證賬號和密碼
  • 指定偵聽的IP和端口
  • 檢查并保存配置
  • 防火墻規(guī)則開放
  • 服務(開機)啟動

三 前置準備

3.1 環(huán)境準備

主機名

IP

備注

iscsi

172.24.8.72

iSCSI服務器

client

172.24.8.71

iSCSI客戶端

3.2 查看裸磁盤

[root@iscsi ~]# fdisk -l
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

四 創(chuàng)建后備存儲

4.1 安裝相關軟件

[root@iscsi ~]# yum -y install targetcli

4.2 交互設置

[root@system1 ~]# targetcli	                                                 
#進入targetcli交互配置視圖
  • block:定義的塊設備,磁盤驅動器、磁盤分區(qū)、LVM等
  • fileio:創(chuàng)建的指定大小的文件,如dd if=/dev/zero of=……所創(chuàng)建
  • pscsi:物理SCSI,通常不采用此類型
  • ramdisk:在內存中創(chuàng)建的一個指定大小ramdisk設備
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
 
/> /backstores/block create block1 /dev/sdb                              #將裸磁盤創(chuàng)建為后備盤
/> /iscsi create wwn=iqn.2022-11.com.imxhy:disk01 #創(chuàng)建符合名稱的IQN
/> /iscsi/iqn.2022-11.com.imxhy:disk01/tpg1/luns create /backstores/block/block1        #將創(chuàng)建的后備磁盤block1創(chuàng)建一個LUN
/> /iscsi/iqn.2022-11.com.imxhy:disk01/tpg1/acls create iqn.2021-11.com.imxhy:client      #只允許配置iqn.2021-11.com.imxhy:client的key才能使用此iSCSI提供的磁盤服務
/> /iscsi/iqn.2021-11.com.imxhy:disk01/tpg1/portals/ delete 0.0.0.0 3260                     #刪除默認的全部偵聽
/> /iscsi/iqn.2022-11.com.imxhy:disk01/tpg1/portals/ create 172.24.8.72 3260                 #指定本地用于偵聽客戶端連接的IP
/> /iscsi/ set discovery_auth enable=1 userid=discover password=discoverps                   #選配,本實驗增加discovery的認證
/> /iscsi/ get discovery_auth
DISCOVERY_AUTH CONFIG GROUP
===========================
enable=True
-----------
The enable discovery_auth parameter.
mutual_password=
----------------
The mutual_password discovery_auth parameter.
mutual_userid=
--------------
The mutual_userid discovery_auth parameter.
password=discoverps
-------------------
The password discovery_auth parameter.
userid=discover
---------------
The userid discovery_auth parameter.
/> /iscsi/iqn.2022-11.com.imxhy:disk01/tpg1/acls/iqn.2021-11.com.imxhy:client/ set auth userid=user01 password=u1pass mutual_userid=muser01 mutual_password=m1pass
/> /iscsi/iqn.2022-11.com.imxhy:disk01/tpg1/acls/iqn.2021-11.com.imxhy:client/ get auth       #查看配置
AUTH CONFIG GROUP
=================
mutual_password=m1pass
----------------------
The mutual_password auth parameter.
mutual_userid=muser01
---------------------
The mutual_userid auth parameter.
password=u1pass
The password auth parameter.
userid=user01
-------------
The userid auth parameter.
/> ls /
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 1]
| | o- block1 ........................................................................... [/dev/sdb (1.0GiB) write-thru activated]
| | o- alua ................................................................................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ........................................................................................... [1-way disc auth, Targets: 1]
| o- iqn.2022-11.com.imxhy:disk01 ...................................................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 1]
| | o- iqn.2021-11.com.imxhy:client ......................................................................... [Mapped LUNs: 1]
| | o- mapped_lun0 ................................................................................ [lun0 block/block1 (rw)]
| o- luns .......................................................................................................... [LUNs: 1]
| | o- lun0 ..................................................................... [block/block1 (/dev/sdb) (default_tg_pt_gp)]
| o- portals .................................................................................................... [Portals: 1]
| o- 172.24.8.72:3260 ................................................................................................. [OK]
o- loopback ......................................................................................................... [Targets: 0]
/> exit

提示:如上操作:

1:創(chuàng)建的ACL將分配到每個LUN。

2:創(chuàng)建LUN必須在TPG下。

3:若不指定端口將采用默認端口3260

4:若不指定IP,將允許服務器上定義的所有網(wǎng)絡接口上的連接

5:創(chuàng)建LUN必須在TPG下

五 防火墻開放

[root@iscsi ~]# firewall-cmd --add-port=3260/tcp --permanent                  #防火墻添加iSCSI的端口
[root@iscsi ~]# firewall-cmd --add-service=iscsi-target --permanent              #防火墻放通iSCSI target服務
[root@iscsi ~]# firewall-cmd --reload

六 開啟服務

[root@iscsi ~]# systemctl enable target --now

七 客戶端配置

[root@client ~]# yum -y install iscsi-initiator-utils                             #安裝客戶端
[root@client ~]# vim /etc/iscsi/initiatorname.iscsi                              #配置CHAP認證
InitiatorName=iqn.2021-11.com.imxhy:client
[root@client ~]# vim /etc/iscsi/iscsid.conf
……
node.session.auth.authmethod = CHAP
node.session.auth.username = user01
node.session.auth.password = u1pass
node.session.auth.username_in = muser01
node.session.auth.password_in = m1pass
discovery.sendtargets.auth.authmethod = CHAP
discovery.sendtargets.auth.username = discover
discovery.sendtargets.auth.password = discoverps
[root@client ~]# systemctl restart iscsid

八 客戶端登錄

8.1 發(fā)現(xiàn)目標

[root@client ~]# iscsiadm -m discovery -t sendtargets -p 172.24.8.72 ? ? ? ? ? ? ? ? ? ?    #發(fā)現(xiàn)目標
172.24.8.72:3260,1 iqn.2022-11.com.imxhy:disk01

8.2 登錄目標

[root@client ~]# iscsiadm -m node -T iqn.2022-11.com.imxhy:disk01 -p 172.24.8.72 -l ? ? ? ? ? 
#登錄目標

8.3 查詢信息

[root@client ~]# iscsiadm -m session -o show
tcp: [23] 172.24.8.72:3260,1 iqn.2022-11.com.imxhy:disk01 (non-flash)
[root@client ~]# iscsiadm -m session -P 3 ? ? ? ?#查詢信息
iSCSI Transport Class version 2.0-870
version 6.2.0.874-22
Target: iqn.2022-11.com.imxhy:disk01 (non-flash)
? ? ? ? Current Portal: 172.24.8.72:3260,1
? ? ? ? Persistent Portal: 172.24.8.72:3260,1
? ? ? ? ? ? ? ? **********
? ? ? ? ? ? ? ? Interface:
? ? ? ? ? ? ? ? Iface Name: default
? ? ? ? ? ? ? ? Iface Transport: tcp
? ? ? ? ? ? ? ? Iface Initiatorname: iqn.2021-11.com.imxhy:client
? ? ? ? ? ? ? ? Iface IPaddress: 172.24.8.71
? ? ? ? ? ? ? ? Iface HWaddress: <empty>
? ? ? ? ? ? ? ? Iface Netdev: <empty>
? ? ? ? ? ? ? ? SID: 1
? ? ? ? ? ? ? ? iSCSI Connection State: LOGGED IN
? ? ? ? ? ? ? ? iSCSI Session State: LOGGED_IN
? ? ? ? ? ? ? ? Internal iscsid Session State: NO CHANGE
? ? ? ? ? ? ? ? *********
? ? ? ? ? ? ? ? Timeouts:
? ? ? ? ? ? ? ? Recovery Timeout: 120
? ? ? ? ? ? ? ? Target Reset Timeout: 30
? ? ? ? ? ? ? ? LUN Reset Timeout: 30
? ? ? ? ? ? ? ? Abort Timeout: 15
? ? ? ? ? ? ? ? *****
? ? ? ? ? ? ? ? CHAP:
? ? ? ? ? ? ? ? username: user01
? ? ? ? ? ? ? ? password: ********
? ? ? ? ? ? ? ? username_in: muser01
? ? ? ? ? ? ? ? password_in: ********
? ? ? ? ? ? ? ? ************************
? ? ? ? ? ? ? ? Negotiated iSCSI params:
? ? ? ? ? ? ? ? HeaderDigest: None
? ? ? ? ? ? ? ? DataDigest: None
? ? ? ? ? ? ? ? MaxRecvDataSegmentLength: 262144
? ? ? ? ? ? ? ? MaxXmitDataSegmentLength: 262144
? ? ? ? ? ? ? ? FirstBurstLength: 65536
? ? ? ? ? ? ? ? MaxBurstLength: 262144
? ? ? ? ? ? ? ? ImmediateData: Yes
? ? ? ? ? ? ? ? InitialR2T: Yes
? ? ? ? ? ? ? ? MaxOutstandingR2T: 1
? ? ? ? ? ? ? ? Attached SCSI devices:
? ? ? ? ? ? ? ? Host Number: 3 ?State: running
? ? ? ? ? ? ? ? scsi3 Channel 00 Id 0 Lun: 0
? ? ? ? ? ? ? ? ? ? ? ? Attached scsi disk sdb ? ? ? ? ?State: running

[root@client ~]# iscsiadm -m node -o show
# BEGIN RECORD 6.2.0.874-22
node.name = iqn.2022-11.com.imxhy:disk01
node.tpgt = 1
node.startup = automatic
……
iface.transport_name = tcp
node.discovery_address = 172.24.8.72
node.discovery_port = 3260
node.discovery_type = send_targets
node.session.initial_cmdsn = 0
node.session.initial_login_retry_max = 8
node.session.xmit_thread_priority = -20
node.session.cmds_max = 128
node.session.queue_depth = 32
node.session.nr_sessions = 1
node.session.auth.authmethod = CHAP
node.session.auth.username = user01
node.session.auth.password = ********
node.session.auth.username_in = muser01
node.session.auth.password_in = ********
node.session.scan = auto
node.conn[0].address = 172.24.8.72
node.conn[0].port = 3260

# END RECORD

[root@client ~]# fdisk -l ? ? ? ? ? ? ? ?#發(fā)現(xiàn)的iSCSI服務器三個共享

九 格式化并掛載

9.1 格式化并掛載

注意:

1:此時能當做本地磁盤使用,分區(qū)格式化等操作;

2:可使用RAID或LVM來進行操作,LVM的可在之后格式化LV。

[root@client ~]# mkfs.ext4 /dev/sdb ? ? ? ? ? ?    ?#格式化相關iSCSI磁盤
[root@client ~]# mkdir -p /iscsdisk/sdb01 ? ? ? ?  ? #創(chuàng)建用于掛載sdd磁盤的掛載點 ? ? ? ?
[root@client ~]# mkdir -p /iscsdisk/lv01 ? ? ? ?  ? ?#創(chuàng)建用于掛載LVM分區(qū)的掛載點
[root@client ~]# mount /dev/sdb /iscsdisk/sdb01/ ? ? ?#可直接掛載
[root@client ~]# vi /etc/fstab ? ? ? ? ? ? ? ?    ? #自動掛載
……
/dev/sdb /iscsdisk/lv01 ? ?ext4 ? ?defaults ? ?0 0

到此這篇關于iSCSI服務器CHAP雙向認證配置的文章就介紹到這了,更多相關iSCSI服務器CHAP內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論