]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Implement extended iscsi: rfc4173 syntax which allows specifying credentials
authorHans de Goede <hdegoede@redhat.com>
Fri, 31 Jul 2009 08:31:16 +0000 (10:31 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 31 Jul 2009 10:44:18 +0000 (12:44 +0200)
As discussed before, it would be nice to be able to specify
the iscsi chap credentials inside the netroot=iscsi:.....
syntax, this patch implements this in a backwards compatible way, like
this:
iscsi:username:pass@127.0.0.1::3260::iqn.2009-01.com.example:testdisk
iscsi:username:pass:reverse:pass@127.0.0.1::3260::iqn.2009-01.com.example:test

The only downside is that the backwards compatibility is broken when there
is an @ in the iscsi target name (very unlikely), that can still be used,
but only like this:
iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk

dracut.8
modules.d/95iscsi/iscsiroot

index 37c73bfb7a1fe51ab31c4da94eb953e0440de258..807d3fe42170a1b173cbed106c224eead96361be 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -192,7 +192,7 @@ This is supported by dracut but not recommended.
 
 .SH iSCSI
 .TP
-.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
+.B root=iscsi:[username:password[reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
 protocol defaults to "6", LUN defaults to "0".
 
 If the "servername" field is provided by BOOTP or DHCP, then that
@@ -205,18 +205,16 @@ associated fields.
 http://tools.ietf.org/html/rfc4173
 
 .TP
-.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
+.B root=iscsi:[username:password[reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
 e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
-
 .TP
-.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
+.B root=??? netroot=iscsi:[username:password[reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
 multiple netroot options allow setting up multiple iscsi disks
 e.g. 
    root=UUID=12424547 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
 .B not yet implemented
 .TP
 .B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username=  iscsi_password= iscsi_in_username= iscsi_in_password=
-
 .TP
 .B root=??? iscsi_firmware
 will read the iscsi parameter from the BIOS firmware
index a9ad14ac3cae224dc067111cdd7914710f8dd25b..e28cbaa7a1d5f12a679f7add0344e09c7099f77b 100755 (executable)
@@ -77,6 +77,24 @@ fi
 # override conf/commandline options by dhcp root_path
 # FIXME this assumes that all values have been provided
 OLDIFS="$IFS"
+IFS=@
+set $iroot
+if [ $# -gt 1 ]; then
+    authinfo=$1; shift 
+    iroot=$*
+    # allow empty authinfo to allow having an @ in iscsi_target_name like this:
+    # netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
+    if [ -n "$authinfo" ]; then
+        IFS=:
+        set $authinfo
+        iscsi_username=$1
+        iscsi_password=$2
+        if [ $# -gt 2 ]; then
+            iscsi_in_username=$3
+            iscsi_in_password=$4
+        fi
+    fi
+fi  
 IFS=:
 set $iroot
 iscsi_target_ip=$1; shift