dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
573 stars 396 forks source link

Discovery with authentication fails to boot #2612

Open fulminemizzega opened 5 months ago

fulminemizzega commented 5 months ago

Describe the bug Boot fails with authentication error. I encountered this issue trying to setup iSCSI for the first time. I'm booting a Fedora 39 VM on hyper-v via iPXE, without iBFT, boot cmdline includes netroot=user:pass@ip:........, target is on TrueNAS CORE 13.0-U6.1 (freebsd based). TrueNAS wizard sets up an iSCSI portal and it allows CHAP authentication for discovery. From what I've found, it looks like that on linux only target authentication is supported by targetcli or tgtadm, so I guess this combination is not common.

Distribution used Fedora 39

Dracut version dracut 059-16.fc39

Init system systemd

To Reproduce Setup a target with discovery authentication, try to boot from it specifying netroot parameters on the kernel cmdline.

Expected behavior Boot the system

Additional context I've managed to track where the error is generated: https://github.com/dracutdevs/dracut/blob/4980bad34775da715a2639b736cba5e65a8a2604/modules.d/95iscsi/iscsiroot.sh#L227

# iscsiadm -m discovery -t st -p 192.168.80.48
iscsiadm: Login failed to authenticate with target 
iscsiadm: discovery login to 192.168.80.48 rejected: initiator failed authorization
iscsiadm: Could not perform SendTargets discovery: iSCSI login failed due to authorization failure

Everything works fine if I instead disable authentication discovery and enable it on the target itself. To better explain the setup, here is the TrueNAS documentation: https://www.truenas.com/docs/core/13.0/uireference/sharing/iscsi/iscsishare/#manual-setup-screens Expand the manual setup screens, the Portal tab contains the setting (Discovery Authentication Method) that caused this issue. The other authentication I'm referring to is under Targets tab (Authentication Method)