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_007
34 #
35 # DESCRIPTION:
36 # Attempt to establish TCP connection and discovery the LU with
37 # "CHAP" authentication configured when mis-matched chap user and secret
38 # authentication fails and verify its failure on initiator host
39 # STRATEGY:
40 # Setup:
41 # Create target portal group with specified tag 1 and ip address
42 # Create target node with tpgt 1 and specified auth-method of
43 # "chap" authentication
44 # Setup initiator node authentication property with specified chap
45 # user and secret by itadm modify-initiator option
46 # on target host
47 # Modify initiator node authentication property with the wrong chap
48 # user and secret with configured on target host
49 # by iscsiadm modify initiator-node option on initiator host
50 # Create a LU on target host by zfs file system
51 # Create the view of LU by default to all target and host groups
52 # Setup initiator node to enable "SendTarget" method
53 # Setup SendTarget with discovery address on initiator host
54 # Test:
55 # Check that device path of specified LU can NOT be visible by
56 # iscsi initiator node
57 # Check that iscsi initiator node has no active connection
58 # Cleanup:
59 # Delete the target portal group
60 # Delete the target node
61 # Delete the configuration information in initiator and target
62 #
63 # STRATEGY_NOTES:
64 #
65 # TESTABILITY: explicit
66 #
67 # AUTHOR: john.gu@sun.com
68 #
69 # REVIEWERS:
70 #
71 # ASSERTION_SOURCE:
72 #
73 # TEST_AUTOMATION_LEVEL: automated
74 #
75 # STATUS: IN_PROGRESS
76 #
77 # COMMENTS:
78 #
79 # __stc_assertion_end
80 #
81 function iscsi_auth_007
82 {
83 cti_pass
84
85 tc_id="iscsi_auth_007"
86
87 tc_desc="Attempt to establish TCP connection and discovery the LU with"
88 tc_desc="${tc_desc} CHAP authentication configured when mis-matched chap"
89 tc_desc="${tc_desc} user and secret authentication fails and verify its"
90 tc_desc="${tc_desc} failure on initiator host"
91 print_test_case $tc_id - $tc_desc
92
93 stmsboot_enable_mpxio $ISCSI_IHOST
94
95 typeset portal_list
96 set -A portal_list $(get_portal_list ${ISCSI_THOST})
97
98 typeset t="${IQN_TARGET}.${TARGET[1]}"
99 # Create target and target protal group
100 itadm_create POS tpg 1 "${portal_list[0]}"
101 itadm_create POS target -n ${t} -t 1 -a chap
102
103 # Set initiator chap properities on initiator host
104 iscsiadm_modify POS "${ISCSI_IHOST}" initiator-node -C "123456789012"
105 iscsiadm_modify POS "${ISCSI_IHOST}" initiator-node -H "i_chap_user"
106
107 # Set initiator chap properities on target host
108 typeset i_node_name="$(iscsiadm_i_node_name_get ${ISCSI_IHOST})"
109 itadm_create POS initiator -s "123456789012" "${i_node_name}"
110 itadm_modify POS initiator -u "i_chap_user_wrong" "${i_node_name}"
111
112 #Create lu
113 build_fs zdsk
114 fs_zfs_create -V 1g $ZP/${VOL[0]}
115 sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
116
117 typeset guid
118 eval guid=\$LU_${VOL[0]}_GUID
119 # Add view
120 stmfadm_add POS view "${guid}"
121 # Online lu
122 stmfadm_online POS lu "${guid}"
123 # Online target
124 stmfadm_online POS target "${IQN_TARGET}.${TARGET[1]}"
125
126 # Set discover address
127 iscsiadm_add POS ${ISCSI_IHOST} discovery-address \
128 "${portal_list[0]}"
129
130 # Enable sendTargets discovery method
131 iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
132
133 # Verify the lun on initiator host
134 iscsiadm_verify ${ISCSI_IHOST} lun
135
136 tp_cleanup
137 clean_fs zdsk
138 initiator_cleanup "${ISCSI_IHOST}"
139 }
140