From nobody Sun May 28 18:09:18 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QTmrZ5g2hz4XhkV; Sun, 28 May 2023 18:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QTmrZ4WWtz3p8L; Sun, 28 May 2023 18:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685297358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7UF7rotBcwwAZBBGTIifZvRdVKj0JYIIoKnIh7DvXWM=; b=kLW/1mre+8CfpF/HV5LlufLroj8cHIv7EX+wzw8CtNNH9qSqe5m2wsz6I+Ed8PLhmONqaX O4pMA9UCZ/PkM1TXAe77vwkPbcX9WzBA3XlbpCbCoqE+pCy3cBEdPcqHuEB/GjG3TCxvQm JdAHla3Xu98DCKCrsLj5SVGMipRzdRUxi1YGI+t6+L+0JHUyrtTcQIfgU7dMxtb2M7pFid hOjpaqp2rSp+VjMeytrDXPstvq2Php1hf+LpgkCl3tcIqU6St+VBTOtfFut9Aw1iMgksNx fi9b/wLQqklAFRqN/G9P2gibv9GCAiKVmyD/IFe5pnbU6Sr7hrNVZp+cQmL3LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685297358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7UF7rotBcwwAZBBGTIifZvRdVKj0JYIIoKnIh7DvXWM=; b=HrFVQSE1v/U4+/ri7durmwvBQ3QQXavSk+zy11hNTy5b6DOWuiaBddGbw6l3MbJEEBow78 dtwZPRX5BucYLvy0KGwN9MbNMKNDKeJ8V6lmGZWiPTzoY4mwsDim9l35M+M4nzvUn6+MZN rwQwm8XDnq3EgnWgJ0BHuvWWX0/MmrF4nSUFn4ABd9zqxj4g9HBImzVHVU5jRmADtL/ig1 ynwTPqAP5dasewlawwYJIG2YGa4RWzeMqGpQaeR0VMLCTJQG98eQ8EnkyYxnR8DZdmPxp6 BWQqpfMq+cyWzubvtLAz9Y4RFVshmJ6IGAJ2pZ7rL3lcA9nc1T0hdKHWNs27RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685297358; a=rsa-sha256; cv=none; b=exlIEqQVBe5BqvaMCJsEhUloUFwKUj6cik4vzXkXXmPulF1OV6yWo80CMLu1sDx0yBb1u9 w5NoHXMVeTlFm63aRIoP3TAPH56Zp+9wCEoiGHmNrRVkGakqMuGov4abAQjsj6q+Sbxons 2ASpT7rKZ5MjL8TYkUnMt4tQN9Uj4DfQee7z4n0CvQWXSFajHLzINXwqDf7nQfugBy9D3p YYeIjTg13N5BETTDWLB2LJn27gx4Ac16by8ydQSMBtm6JFsQsi2Oeju5KCTMygf4NZZegh Az+JovAvtMQk6iS4S8gHNDPpMDQaXJpEO1Av/VT1Dzc8y2HLlpJnyeTMFa6xtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QTmrZ3cNMzg5B; Sun, 28 May 2023 18:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34SI9IQG064388; Sun, 28 May 2023 18:09:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34SI9IRD064387; Sun, 28 May 2023 18:09:18 GMT (envelope-from git) Date: Sun, 28 May 2023 18:09:18 GMT Message-Id: <202305281809.34SI9IRD064387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 697727110b68 - main - gssd: Improve failure message when running in a jail List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 697727110b68e483c320d834bcbcdf01c01142a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=697727110b68e483c320d834bcbcdf01c01142a1 commit 697727110b68e483c320d834bcbcdf01c01142a1 Author: Rick Macklem AuthorDate: 2023-05-28 18:06:27 +0000 Commit: Rick Macklem CommitDate: 2023-05-28 18:08:38 +0000 gssd: Improve failure message when running in a jail If a jail is not correctly configured to run nfsd(8) in the jail, gssd(8) cannot run. This patch improves the failure message for this case. MFC after: 2 weeks --- usr.sbin/gssd/gssd.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index d1722851e4e1..2bc839b7a2ea 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -112,8 +113,9 @@ main(int argc, char **argv) * directly to us. */ struct sockaddr_un sun; - int fd, oldmask, ch, debug; + int fd, oldmask, ch, debug, jailed; SVCXPRT *xprt; + size_t jailed_size; /* * Initialize the credential cache file name substring and the @@ -243,7 +245,27 @@ main(int argc, char **argv) gss_next_id = 1; gss_start_time = time(0); - gssd_syscall(_PATH_GSSDSOCK); + if (gssd_syscall(_PATH_GSSDSOCK) < 0) { + jailed = 0; + if (errno == EPERM) { + jailed_size = sizeof(jailed); + sysctlbyname("security.jail.jailed", &jailed, + &jailed_size, NULL, 0); + } + if (debug_level == 0) { + if (jailed != 0) + syslog(LOG_ERR, "Cannot start gssd." + " allow.nfsd must be configured"); + else + syslog(LOG_ERR, "Cannot start gssd"); + exit(1); + } + if (jailed != 0) + err(1, "Cannot start gssd." + " allow.nfsd must be configured"); + else + err(1, "Cannot start gssd"); + } svc_run(); gssd_syscall("");