name = iscsi-initiator-utils
rel_ver = 873
version = 6.2.0.%{rel_ver}
-release = 1
+release = 2
groups = System/Daemons
url = http://www.open-iscsi.org/
build
requires
+ doxygen
+ kmod-devel
openssl-devel
python-devel
end
build
- cd %{DIR_APP}/utils/open-isns && ./configure --with-security=no
- cd %{DIR_APP}/utils/open-isns && make
- cd %{DIR_APP} && make -C utils/sysdeps
- cd %{DIR_APP} && make -C utils/fwparam_ibft
- cd %{DIR_APP} && make -C usr
- cd %{DIR_APP} && make -C utils
- cd %{DIR_APP} && make -C libiscsi
- cd %{DIR_APP}/libiscsi && python setup.py build
+ make OPTFLAGS="%{CFLAGS} -DUSE_KMOD -lkmod"
+
+ pushd libiscsi
+ python setup.py build
+ popd
end
install
--- /dev/null
+d /run/lock/iscsi 0700 root root -
+f /run/lock/iscsi/lock 0600 root root -
--- /dev/null
+From c34e0bdcbafdb6f9304e1474d51fe1c789c5dea2 Mon Sep 17 00:00:00 2001
+From: Tomasz Torcz <tomek@pipebreaker.pl>
+Date: Wed, 28 Nov 2012 13:37:08 +0100
+Subject: iscsid: add example unit files for systemd
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Those two units, based on the work by Jóhann B. Guðmundsson, exploit
+on-demand socket activation in iscsid.
+---
+ etc/systemd/iscsid.service | 13 +++++++++++++
+ etc/systemd/iscsid.socket | 9 +++++++++
+ 2 files changed, 22 insertions(+)
+ create mode 100644 etc/systemd/iscsid.service
+ create mode 100644 etc/systemd/iscsid.socket
+
+diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
+new file mode 100644
+index 0000000..028e0b3
+--- /dev/null
++++ b/etc/systemd/iscsid.service
+@@ -0,0 +1,13 @@
++[Unit]
++Description=Open-iSCSI
++Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
++After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
++
++[Service]
++Type=forking
++PIDFile=/var/run/iscsid.pid
++ExecStart=/usr/sbin/iscsid
++ExecStop=/sbin/iscsiadm -k 0 2
++
++[Install]
++WantedBy=multi-user.target
+diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket
+new file mode 100644
+index 0000000..832451d
+--- /dev/null
++++ b/etc/systemd/iscsid.socket
+@@ -0,0 +1,9 @@
++[Unit]
++Description=Open-iSCSI iscsid Socket
++Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
++
++[Socket]
++ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
++
++[Install]
++WantedBy=sockets.target
+--
+1.7.11.7
+
--- /dev/null
+From 1c3b1d23e0b3f17399ffd4463cafad813b0444d5 Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Wed, 19 Dec 2012 15:07:36 -0800
+Subject: update systemd service files, add iscsi.service for starting
+ sessions on boot
+
+Signed-off-by: Chris Leech <cleech@redhat.com>
+---
+ etc/systemd/iscsi.service | 19 +++++++++++++++++++
+ etc/systemd/iscsi_mark_root_nodes | 14 ++++++++++++++
+ etc/systemd/iscsid.service | 7 +++++--
+ etc/systemd/iscsid.socket | 2 +-
+ 4 files changed, 39 insertions(+), 3 deletions(-)
+ create mode 100644 etc/systemd/iscsi.service
+ create mode 100755 etc/systemd/iscsi_mark_root_nodes
+
+diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
+new file mode 100644
+index 0000000..bbd52fd
+--- /dev/null
++++ b/etc/systemd/iscsi.service
+@@ -0,0 +1,19 @@
++[Unit]
++Description=Login and scanning of iSCSI devices
++Documentation=man:iscsid(8) man:iscsiadm(8)
++DefaultDependencies=no
++Conflicts=shutdown.target
++After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
++Before=remote-fs-pre.target
++ConditionPathExists=/etc/iscsi/initiatorname.iscsi
++
++[Service]
++Type=oneshot
++RemainAfterExit=true
++ExecStart=/usr/libexec/iscsi_mark_root_nodes
++ExecStart=/sbin/iscsiadm -m node --loginall=automatic
++ExecStop=/bin/sync
++ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
++
++[Install]
++WantedBy=sysinit.target
+diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes
+new file mode 100755
+index 0000000..c68475c
+--- /dev/null
++++ b/etc/systemd/iscsi_mark_root_nodes
+@@ -0,0 +1,14 @@
++#!/bin/bash
++
++ISCSIADM=/sbin/iscsiadm
++SESSION_FILE=/run/initramfs/iscsi.sessions
++
++if [ ! -f $SESSION_FILE ] ; then
++ exit 0
++fi
++
++while read t num i target; do
++ ip=${i%:*}
++ $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot
++done < $SESSION_FILE
++
+diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
+index 028e0b3..653dd08 100644
+--- a/etc/systemd/iscsid.service
++++ b/etc/systemd/iscsid.service
+@@ -1,7 +1,10 @@
+ [Unit]
+ Description=Open-iSCSI
+-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
+-After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
++Documentation=man:iscsid(8) man:iscsiadm(8)
++DefaultDependencies=no
++Conflicts=shutdown.target
++After=network.target iscsiuio.service
++Before=remote-fs-pre.target
+
+ [Service]
+ Type=forking
+diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket
+index 832451d..58a8d12 100644
+--- a/etc/systemd/iscsid.socket
++++ b/etc/systemd/iscsid.socket
+@@ -1,6 +1,6 @@
+ [Unit]
+ Description=Open-iSCSI iscsid Socket
+-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
++Documentation=man:iscsid(8) man:iscsiadm(8)
+
+ [Socket]
+ ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
+--
+1.7.11.7
+
--- /dev/null
+From bf7f9118ab2f1a5302dafa198d3351f6f977b7bd Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Mon, 19 Nov 2012 16:40:04 -0800
+Subject: use red hat for name
+
+---
+ utils/iscsi-iname.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
+index 6347edc..cb2f6c8 100644
+--- a/utils/iscsi-iname.c
++++ b/utils/iscsi-iname.c
+@@ -73,7 +73,7 @@ main(int argc, char *argv[])
+ exit(0);
+ }
+ } else {
+- prefix = "iqn.2005-03.org.open-iscsi";
++ prefix = "iqn.1994-05.com.redhat";
+ }
+
+ /* try to feed some entropy from the pool to MD5 in order to get
+--
+1.7.11.7
+
+
+$(TESTS): $(FW_OBJS) $(COMMON_OBJS) $(USR_OBJS) $(LIB)
+
-+html: libiscsi.h
-+# doxygen libiscsi.doxy
++html: libiscsi.h libiscsi.doxy
++ doxygen libiscsi.doxy
+
+clean:
+ rm -rf *.o common-objs usr-objs fw-objs libuip-objs libiscsi.so* \
--- /dev/null
+From 822b53e6c9ebb0fe7236ebd3b4c73b009100592d Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Tue, 22 Jan 2013 14:27:12 -0800
+Subject: iscsiuio systemd unit files
+
+---
+ etc/systemd/iscsiuio.service | 17 +++++++++++++++++
+ etc/systemd/iscsiuio.socket | 9 +++++++++
+ 2 files changed, 26 insertions(+)
+ create mode 100644 etc/systemd/iscsiuio.service
+ create mode 100644 etc/systemd/iscsiuio.socket
+
+diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service
+new file mode 100644
+index 0000000..f0410b7
+--- /dev/null
++++ b/etc/systemd/iscsiuio.service
+@@ -0,0 +1,17 @@
++[Unit]
++Description=iSCSI UserSpace I/O driver
++Documentation=man:iscsiuio(8)
++DefaultDependencies=no
++Conflicts=shutdown.target
++Requires=iscsid.service
++BindTo=iscsid.service
++After=network.target
++Before=remote-fs-pre.target iscsid.service
++
++[Service]
++Type=forking
++PIDFile=/var/run/iscsiuio.pid
++ExecStart=/usr/sbin/iscsiuio
++
++[Install]
++WantedBy=multi-user.target
+diff --git a/etc/systemd/iscsiuio.socket b/etc/systemd/iscsiuio.socket
+new file mode 100644
+index 0000000..d42cedc
+--- /dev/null
++++ b/etc/systemd/iscsiuio.socket
+@@ -0,0 +1,9 @@
++[Unit]
++Description=Open-iSCSI iscsiuio Socket
++Documentation=man:iscsiuio(8)
++
++[Socket]
++ListenStream=@ISCSID_UIP_ABSTRACT_NAMESPACE
++
++[Install]
++WantedBy=sockets.target
+--
+1.7.11.7
+
From c3d2b8f3de5b6161845304cf46982d2c5a9918b6 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
-Date: Tue, 22 Jan 2013 15:04:14 -0800
-Subject: use systemctl to start iscsid
+Date: Thu Feb 21 21:05:39 PST 2013
+Subject: disable iscsid.startup from iscsiadm, prefer systemd socket activation
---
etc/iscsid.conf | 2 +-
#
# Default for Fedora and RHEL. (uncomment to activate).
-iscsid.startup = /etc/rc.d/init.d/iscsid force-start
-+iscsid.startup = /bin/systemctl start iscsid.service
++#iscsid.startup = /bin/systemctl start iscsid.service
#
# Default for upstream open-iscsi scripts (uncomment to activate).
# iscsid.startup = /sbin/iscsid
--- /dev/null
+From ab79bdb20e37216ca969e06d63a952acfd023963 Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Tue, 28 May 2013 13:12:27 -0700
+Subject: [PATCH] Don't check for autostart sessions if iscsi is not used (bug
+ #951951)
+
+Change conditional startup in iscsi.service to check for a non-empty
+nodes directory, instead of initiator-name. This fits better with what
+it's doing, as there's no need to scan for autostart node records if
+there are no node records at all.
+---
+ etc/systemd/iscsi.service | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
+index bbd52fd..7b4efee 100644
+--- a/etc/systemd/iscsi.service
++++ b/etc/systemd/iscsi.service
+@@ -5,7 +5,7 @@ DefaultDependencies=no
+ Conflicts=shutdown.target
+ After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
+ Before=remote-fs-pre.target
+-ConditionPathExists=/etc/iscsi/initiatorname.iscsi
++ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
+
+ [Service]
+ Type=oneshot
+--
+1.8.1.4
+
--- /dev/null
+From 3cac85a3f97d0a22270166f428209f873b58c319 Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Tue, 11 Jun 2013 11:25:27 -0700
+Subject: [PATCH] iscsid: fix order of setting uid/gid and drop supplementary
+ groups
+
+If using the user and group ID settings together the existing order of
+calling setuid first will almost always cause the setgid call to fail,
+assuming the new effective user id does not have the CAP_SETGID
+capability. The effective group ID needs to change first.
+
+While we're at it, if iscsid is started as root it should drop any
+inherited supplementary group permissions.
+
+And if anyone is actually using this to try and isolate capabilities,
+they probably care enough to want to known that it is failing. Make
+iscsid startup fail instead of just calling perror.
+
+Signed-off-by: Chris Leech <cleech@redhat.com>
+---
+ usr/iscsid.c | 23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/usr/iscsid.c b/usr/iscsid.c
+index b4bb65b..c0ea6fa 100644
+--- a/usr/iscsid.c
++++ b/usr/iscsid.c
+@@ -27,6 +27,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <signal.h>
++#include <grp.h>
+ #include <sys/mman.h>
+ #include <sys/utsname.h>
+ #include <sys/types.h>
+@@ -477,11 +478,25 @@ int main(int argc, char *argv[])
+ }
+ }
+
+- if (uid && setuid(uid) < 0)
+- perror("setuid\n");
++ if (gid && setgid(gid) < 0) {
++ log_error("Unable to setgid to %d\n", gid);
++ log_close(log_pid);
++ exit(ISCSI_ERR);
++ }
+
+- if (gid && setgid(gid) < 0)
+- perror("setgid\n");
++ if ((geteuid() == 0) && (getgroups(0, NULL))) {
++ if (setgroups(0, NULL) != 0) {
++ log_error("Unable to drop supplementary group ids\n");
++ log_close(log_pid);
++ exit(ISCSI_ERR);
++ }
++ }
++
++ if (uid && setuid(uid) < 0) {
++ log_error("Unable to setuid to %d\n", uid);
++ log_close(log_pid);
++ exit(ISCSI_ERR);
++ }
+
+ memset(&daemon_config, 0, sizeof (daemon_config));
+ daemon_config.pid_file = pid_file;
+--
+1.8.1.4
+
--- /dev/null
+From 1483a176fdbb22bbfecf06eea57d1aa200f30561 Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech@redhat.com>
+Date: Mon, 21 Jan 2013 15:43:36 -0800
+Subject: use Red Hat version string to match RPM package version
+
+---
+ usr/version.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr/version.h b/usr/version.h
+index a090522..aef0c3d 100644
+--- a/usr/version.h
++++ b/usr/version.h
+@@ -6,7 +6,7 @@
+ * This may not be the same value as the kernel versions because
+ * some other maintainer could merge a patch without going through us
+ */
+-#define ISCSI_VERSION_STR "2.0-873"
++#define ISCSI_VERSION_STR "6.2.0.873-1"
+ #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
+
+ #endif
+--
+1.7.11.7
+