From nobody Sun Jun 11 20:09:03 2023 X-Original-To: dev-commits-src-branches@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 4QfQrJ102Nz4cpwG; Sun, 11 Jun 2023 20:09:04 +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 4QfQrH5klnz3HGH; Sun, 11 Jun 2023 20:09:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686514143; 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=R16RFMHsz6buM2tTMKCQBWEPTSGU7JO6IFXiMWjWOxg=; b=wuq3ZC1k9j7lt9M4xWR7WZDUpHsQayIKdK8rqTysnLE+FJ3pf89X+SzRyh1RnkZCoxT0Vl 8hPBkeRAU/JS95yA1LF4KULwMdUOC59awe5W69UOMeJFvxopsxk4EBqJGSsOzEB6H+zRJi HeWXGph+HLkGD8uUcWFvHrhOyzMevCnN2qjIG1VqQTTdl8cvbIX+O1A10zUlxsLP4jMSFk l62189JwJJ13OqCvbQm4idR89TxaBT3xQKt59JF+PIh+9StgchrJiQyyBYp2rCW1Sm6tz1 H0i/YM0A4RIcq4JK4x6eYz8gMmS2McZmD4mi7diafKir0CyVvCj4jgvCMM9IQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686514143; 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=R16RFMHsz6buM2tTMKCQBWEPTSGU7JO6IFXiMWjWOxg=; b=T4/ub3u6dWoxrGoRCVn/rH86A+/J7Ie4KpZL4nGuZax3IeZ1kIHqfLkrZfRG5z844kcWCW 1hMF2alOijN8h88v0a51cK96wGZy+q98d6ADTF3TTVJXFYKm6wA6vPceP9enwJAMaaFr33 WiU3SEj7GLsJnOal8rkyM/AF2UVYH6NYcQPNvFK/CO4I7okkxoNwzHfcOPdmUapFXSsi0A a1/4DuEkffQFXtK3yoK2wwuaTLo16yq0M77SWcUkvbmvf18jKakO0VCMlD+7YZBK9h+z7L AYGIJkAE3jZRFtBAa8hcDgYi1vUQrBYUJ1Je6rvJ0mMSKl0edz+9KkoHOyea1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686514143; a=rsa-sha256; cv=none; b=FMEjNo/5XN8eLdBkNx/SkneuRTdUFa1zUpY8gGLictZixkWMc5bi1sFGQiy9oQVCn702I6 ld+a+rTaKI+TidF3oKbfNfZct+3dr89Et0/NEaFC0J7bknfwpWy7Oyak2UHwa/2+i3elTj Vcg1lkNYo2s4aiF1jYcW1LOO36PUZhRgWE48nujYprl5+GJuD5Wl7S6rNcViDri8tfBLR6 jWTjmNC/PbPcrnxlWD9dqJMhEU4a0dvLyKv7b51/JYEGS4di2YttRn/iGC9gPe83fxR/pc h0DDTb0035IROWVYZZemCaU6E7+pFN0tfZVmziuDcmlcpYBNRYRJTEMjAOExcw== 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 4QfQrH4gCtz19xK; Sun, 11 Jun 2023 20:09:03 +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 35BK93JK035015; Sun, 11 Jun 2023 20:09:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BK93EU035014; Sun, 11 Jun 2023 20:09:03 GMT (envelope-from git) Date: Sun, 11 Jun 2023 20:09:03 GMT Message-Id: <202306112009.35BK93EU035014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4deff63c5d78 - stable/13 - gssd: Improve failure message when running in a jail List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4deff63c5d7837d74ea2cafc0f0373b11daf143e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4deff63c5d7837d74ea2cafc0f0373b11daf143e commit 4deff63c5d7837d74ea2cafc0f0373b11daf143e Author: Rick Macklem AuthorDate: 2023-05-28 18:06:27 +0000 Commit: Rick Macklem CommitDate: 2023-06-11 20:07:55 +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. (cherry picked from commit 697727110b68e483c320d834bcbcdf01c01142a1) --- 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 5589da37c195..92ecd8faaddb 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("");