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