1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 # A test purpose file to test functionality of chap authentication
29 #
30
31 # __stc_assertion_start
32 #
33 # ID: iscsi_auth_012
34 #
35 # DESCRIPTION:
36 # Verify that connection fails to be created if the chap secrets of
37 # both initiator and target authentication are identical within
38 # bi-directional authentication
39 #
40 # STRATEGY:
41 # Setup:
42 # Create target portal group with specified tag 1 and ip address
43 # Create target node with tpgt 1 with specified auth-method of
44 # "chap" authentication
45 # Modify initiator node authentication property with specified
46 # chap user1 and secret1 on initiator host by iscsiadm
47 # modify initiator-node option
48 # Modify the specified initiator node authentication property on
49 # target host by the same chap user1 and secret1 on initiator
50 # host by itadm modify-initiator option
51 # Modify target node authentication property with specified
52 # chap user1 and secret1 on target host by itadm modify-target
53 # option
54 # Modify the specified target node authentication property on
55 # initiator host by the same chap user1 and secret1 on target
56 # host by iscsiadm modify target-param option
57 # Create a LU on target host by zfs file system
58 # Create the view of LU by default to all target and host groups
59 # Setup initiator node to enable "SendTarget" method
60 # Setup SendTarget with discovery address on initiator host
61 # Test:
62 # Check that device path of specified LU can NOT be visible by
63 # iscsi initiator node
64 # Check that iscsi initiator node has no connection
65 # Cleanup:
66 # Delete the target portal group
67 # Delete the target node
68 # Delete the configuration information in initiator and target
69 # STRATEGY_NOTES:
70 #
71 # TESTABILITY: explicit
72 #
73 # AUTHOR: john.gu@sun.com
74 #
75 # REVIEWERS:
76 #
77 # ASSERTION_SOURCE:
78 #
79 # TEST_AUTOMATION_LEVEL: automated
80 #
81 # STATUS: IN_PROGRESS
82 #
83 # COMMENT
84 #
85 # __stc_assertion_end
86 #
87 function iscsi_auth_012
88 {
89 cti_pass
90
91 tc_id="iscsi_auth_012"
92
93 tc_desc="Verify that connection fails to be created if the chap secrets"
94 tc_desc="${tc_desc} of both initiator and target authentication are"
95 tc_desc="${tc_desc} identical within bi-directional authentication"
96 print_test_case $tc_id - $tc_desc
97
98 stmsboot_enable_mpxio $ISCSI_IHOST
99
100 typeset portal_list
101 set -A portal_list $(get_portal_list ${ISCSI_THOST})
102 typeset t="${IQN_TARGET}.${TARGET[1]}"
103 # Create target and target protal group
104 itadm_create POS tpg 1 "${portal_list[0]}"
105 itadm_create POS target -n ${t} -t 1 -a chap
106
107 # Set initiator chap properities on initiator host
108 iscsiadm_modify POS "${ISCSI_IHOST}" initiator-node -C "123456789012"
109 iscsiadm_modify POS "${ISCSI_IHOST}" initiator-node -H "i_chap_user"
110
111 # Set initiator chap properities on target host
112 typeset i_node_name="$(iscsiadm_i_node_name_get ${ISCSI_IHOST})"
113 itadm_create POS initiator -s "123456789012" "${i_node_name}"
114 itadm_modify POS initiator -u "i_chap_user" "${i_node_name}"
115
116 # Set target chap properities on target host
117 itadm_modify POS target -s "123456789012" "${t}"
118 itadm_modify POS target -u "t_chap_user" "${t}"
119
120 # Set target chap properities on initiator host
121 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -C "123456789012" ${t}
122 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -H "t_chap_user" ${t}
123 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -B "enable" ${t}
124 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -a "CHAP" ${t}
125
126 #Create lu
127 build_fs zdsk
128 fs_zfs_create -V 1g $ZP/${VOL[0]}
129 sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
130
131 typeset guid
132 eval guid=\$LU_${VOL[0]}_GUID
133 # Add view
134 stmfadm_add POS view "${guid}"
135 # Online lu
136 stmfadm_online POS lu "${guid}"
137 # Online target
138 stmfadm_online POS target "${IQN_TARGET}.${TARGET[1]}"
139
140 typeset portal_list
141 set -A portal_list $(get_portal_list ${ISCSI_THOST})
142
143 # Set discover address
144 iscsiadm_add POS ${ISCSI_IHOST} discovery-address \
145 "${portal_list[0]}"
146
147 # Enable sendTargets discovery method
148 iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
149
150 # Verify the lun on initiator host
151 iscsiadm_verify ${ISCSI_IHOST} lun
152
153 tp_cleanup
154 clean_fs zdsk
155 initiator_cleanup "${ISCSI_IHOST}"
156 }