Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2761031rdb; Wed, 4 Oct 2023 10:33:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEICEXQSKLP7Tt1qmhSKL58Qsi25v6wgpeuHdVEH6fIxt1GmNHiGwLuKaOlggeSDIc+EfWQ X-Received: by 2002:a05:6358:7e46:b0:13c:c84b:88b9 with SMTP id p6-20020a0563587e4600b0013cc84b88b9mr2021988rwm.15.1696440781711; Wed, 04 Oct 2023 10:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696440781; cv=none; d=google.com; s=arc-20160816; b=MzXMUVHQ5d3RsyFmwUwIqtQpOPOuF0lH2VJZQ43jorfDuXnJ8CB3ilZZRqNKtkMN0d lpV77oOHV1JI0FAleu93kz4S+XEVTtzZjsQvbui40r/tjVXk/k7v4qpQi34AdbJqW6Y0 /dsWjOfs5aji++14W2lyECDkY6+XBulm4Zr4qqztHwkrTr3h8wXUgA+jRf2U41ZcnHjJ QE+PJrR/OuxdPng2sphqAMG3OPZQoAkF0il40UXs2EjeR/fwDGW357H4x6pS6bH9Vi9g ZSZzjLx7kSZgpaIHov2HFXCIMYjRFsRghnlqfRhdYegaLWYnC645mgD+mGQuegzpEUMW qTyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hIrUaub9xbgh9JA6eu/SKHUdTohV+B8D2DY3q1ptAy8=; fh=uNRrSD0XciptfTJwyKJ3Qz1AkNjyaoXT9yPd2pM8S/o=; b=CfGEc+uqidHJNwQgaaHuAayR5bAaoxkqo6wu2d5NV0OnEFFZ4hlU43Ibnw5XJ0QPQT UYEgJetsAypPvE77IAmA2aP0pTtS8x4AtkxmMUKnasSvS4UQZ4ikqceYTuIvVZIB+ZBc o77q9x7zrmi3MSaQZJrIsfxB7VT0DtEteHqkEZf8f7peGRU5CFkUXvoxoHUcbDX39Hse sHAVU6m4EvBD+K+N2zcplZ92+renA1/AylSYbrfnoOTthXx2KGxSrcUOWl+2hvuF8gR4 wchyhfff/67CERxfkppols9ZtM5fS1zSkZbEEA4DVzap1wXex2/AOGQarOWPa2cYG+Ub 20wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TM3hkiE1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id mi10-20020a17090b4b4a00b0027921228848si2075523pjb.133.2023.10.04.10.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TM3hkiE1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4A9438068A10; Wed, 4 Oct 2023 10:32:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243498AbjJDRcx (ORCPT + 99 others); Wed, 4 Oct 2023 13:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243676AbjJDRcx (ORCPT ); Wed, 4 Oct 2023 13:32:53 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5222AD for ; Wed, 4 Oct 2023 10:32:47 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-7a2874d2820so1523139f.1 for ; Wed, 04 Oct 2023 10:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696440767; x=1697045567; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hIrUaub9xbgh9JA6eu/SKHUdTohV+B8D2DY3q1ptAy8=; b=TM3hkiE1jNcwqgDj/87Y07KeoUXcW8OsLwFNvsiB3L8tSy/aNvxVvUq+Q2ruQa13X4 B4T5w29KYlyjAidIIJ0SV+Z1GyAgVtZ32CNNGKf/ao1QSmLUWW4A55JZ+xVKeJ0zwvgW gZaiEBUFGIStCigdAiywamjt74NdNJdktkdJkFOxlQ1RUMsSYxJ5Fw2gtwevEKTE+d9f CrPElEGwpIxWcSEEEmuZPquem15A9fAW9BHAdfZMd0okuitL4FC8vAFhWwhqML5IRVd3 uSrINFvmD0HnrQ3BC6+B6BydrYPCws786kglpcyhrHQsNX7apBJ4kO6yv4cHVGAonPeY bA4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696440767; x=1697045567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hIrUaub9xbgh9JA6eu/SKHUdTohV+B8D2DY3q1ptAy8=; b=CibLNqzUx0oH/Mh2cZrJ4EwRqrHh52DHwmqn5Hx5PUr4Vl0RW53t3A5ynXU7TQmqEK 7HrEM7Re/1sRLPghOdu45JdyK9iTHc9ZQZi59guOsV0CjIOLkwOJmtp5mO4nDXmoKU0h RsD0nyNeAXKrgtLcSq58S2KxOFFsSgKGlSF0SjcpJ7V2aRQfdM1LXlo1oW/v/DgdmzcY rt2KWCdzgH8LTiu7v8TZrDLE4RzC8C9YO2/vtwykRaqkJG216xpd7c8w4H1bDMH6ZpfI y69JSr3bMpX7goL3bGZRsykcg9x4YHM3aMRjpOheMzXRx5l+83AUGC/Z6YQ291Qn8mgl UuGQ== X-Gm-Message-State: AOJu0Yyd/KAVMw/+7i8JonWyT9P+ZG0aL9YhHuBIkv+WG0Axc21MyF+M 7zXwW+nyZyijsj24W5TZrrg= X-Received: by 2002:a05:6602:3a11:b0:79f:922b:3809 with SMTP id by17-20020a0566023a1100b0079f922b3809mr3229009iob.1.1696440767201; Wed, 04 Oct 2023 10:32:47 -0700 (PDT) Received: from kolga-mac-1.attlocal.net ([2600:1700:6a10:2e90:d99c:94dd:ccd6:fb22]) by smtp.gmail.com with ESMTPSA id u23-20020a6be417000000b007870289f4fdsm1066598iog.51.2023.10.04.10.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:32:46 -0700 (PDT) From: Olga Kornievskaia To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/3] nfs-utils: gssd: handle KRB5_AP_ERR_BAD_INTEGRITY for machine credentials Date: Wed, 4 Oct 2023 13:32:39 -0400 Message-Id: <20231004173240.46924-5-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20231004173240.46924-1-olga.kornievskaia@gmail.com> References: <20231004173240.46924-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 10:32:59 -0700 (PDT) From: Olga Kornievskaia During context establishment, when the client received KRB5_AP_ERR_BAD_INTEGRITY error, it might be due to the server updating its key material. To handle such error, get a new service ticket and re-try the AP_REQ. Signed-off-by: Olga Kornievskaia --- utils/gssd/gssd_proc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index 4fb6b72d..e5cc1d98 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -412,13 +412,27 @@ create_auth_rpc_client(struct clnt_info *clp, tid, tgtname); auth = authgss_create_default(rpc_clnt, tgtname, &sec); if (!auth) { + if (sec.minor_status == KRB5KRB_AP_ERR_BAD_INTEGRITY) { + printerr(2, "WARNING: server=%s failed context " + "creation with KRB5_AP_ERR_BAD_INTEGRITY\n", + clp->servername); + if (cred == GSS_C_NO_CREDENTIAL) + retval = gssd_refresh_krb5_machine_credential(clp->servername, + "*", NULL, 1); + if (!retval) { + auth = authgss_create_default(rpc_clnt, tgtname, + &sec); + if (auth) + goto success; + } + } /* Our caller should print appropriate message */ printerr(2, "WARNING: Failed to create krb5 context for " "user with uid %d for server %s\n", uid, tgtname); goto out_fail; } - +success: /* Success !!! */ rpc_clnt->cl_auth = auth; *clnt_return = rpc_clnt; -- 2.39.1