From: Mike Christie <mchristi@redhat.com>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH 1/1] iscsi target: fix discovery auth enforcement
Date: Wed, 24 Apr 2019 15:23:43 +0000 [thread overview]
Message-ID: <5CC07F7F.80004@redhat.com> (raw)
In-Reply-To: <20190424015216.16757-1-mchristi@redhat.com>
Martin, Do not merge this patch. I am going to self nack it. It could
add a regression where CHAP is not used if an app initializes this file
to 0 during loading before it has setup CHAP then later sets up CHAP
assuming we would use CHAP,None.
On 04/23/2019 08:52 PM, Mike Christie wrote:
> If the user writes 0 to enforce_discovery_auth to disable CHAP during
> discovery we will set the AuthMethod arguments to CHAP,None even if
> there are no CHAP settings. The initiator can then only login if it has
> its AuthMethod set to only None. If it is set to CHAP,None, login will
> fail, because the target sees CHAP and will try to do that, but it will
> always fail since there are no CHAP settings setup.
>
> This has us use CHAP,None if CHAP is setup when writing 0 to
> enforce_discovery_auth file and None if CHAP is not setup.
>
> Signed-off-by: Mike Christie <mchristi@redhat.com>
> ---
> drivers/target/iscsi/iscsi_target_configfs.c | 24 ++++++++++++++++----
> 1 file changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
> index cac94c94ef5d..bfc4a7966a2d 100644
> --- a/drivers/target/iscsi/iscsi_target_configfs.c
> +++ b/drivers/target/iscsi/iscsi_target_configfs.c
> @@ -1276,6 +1276,7 @@ static ssize_t iscsi_disc_enforce_discovery_auth_store(struct config_item *item,
> {
> struct iscsi_param *param;
> struct iscsi_portal_group *discovery_tpg = iscsit_global->discovery_tpg;
> + struct iscsi_node_auth *auth = &iscsit_global->discovery_acl.node_auth;
> u32 op;
> int err;
>
> @@ -1306,19 +1307,34 @@ static ssize_t iscsi_disc_enforce_discovery_auth_store(struct config_item *item,
> return -EINVAL;
>
> discovery_tpg->tpg_attrib.authentication = 1;
> - iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 1;
> + auth->enforce_discovery_auth = 1;
> pr_debug("LIO-CORE[0] Successfully enabled"
> " authentication enforcement for iSCSI"
> " Discovery TPG\n");
> - } else {
> + } else if ((auth->naf_flags & NAF_USERID_SET &&
> + auth->naf_flags & NAF_PASSWORD_SET) ||
> + (auth->naf_flags & NAF_USERID_IN_SET &&
> + auth->naf_flags & NAF_PASSWORD_IN_SET)) {
> /*
> - * Reset the AuthMethod key to CHAP,None
> + * Partially disable. Reset AuthMethod key to CHAP,None
> */
> if (iscsi_update_param_value(param, "CHAP,None") < 0)
> return -EINVAL;
>
> discovery_tpg->tpg_attrib.authentication = 0;
> - iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 0;
> + auth->enforce_discovery_auth = 0;
> + pr_debug("LIO-CORE[0] Partially disabled"
> + " authentication enforcement for iSCSI"
> + " Discovery TPG\n");
> + } else {
> + /*
> + * Fully disable. Reset AuthMethod key to None
> + */
> + if (iscsi_update_param_value(param, "None") < 0)
> + return -EINVAL;
> +
> + discovery_tpg->tpg_attrib.authentication = 0;
> + auth->enforce_discovery_auth = 0;
> pr_debug("LIO-CORE[0] Successfully disabled"
> " authentication enforcement for iSCSI"
> " Discovery TPG\n");
>
prev parent reply other threads:[~2019-04-24 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 1:52 [PATCH 1/1] iscsi target: fix discovery auth enforcement Mike Christie
2019-04-24 15:23 ` Mike Christie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5CC07F7F.80004@redhat.com \
--to=mchristi@redhat.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.