From nobody Sat Jul 06 20:42:20 2024 X-Original-To: dev-commits-src-main@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 4WGj4D360Fz5Pvkb; Sat, 06 Jul 2024 20:42:20 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WGj4D2M3Cz4FCD; Sat, 6 Jul 2024 20:42:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720298540; 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=IRibl8fUmuj7bBE22A3seAbrTJlC7DggreH6s8IJuAI=; b=Mj9f0Xt/o03FpXBSXIW6ySCYeiO3wBDkZI1hV5UT7PwpxW2oCOEXTmMWR9Hsy3jAxl7LAy kcpyG7NbZ28gf8rbf8EcfddCx8+6hdUScz1z2D1xeoZCbRsLIJvnnEzpUp4QfkCrHYh2lL 9kIgugSU+cBhf3/uVXeKrrusWgsoQj69ZyQ6YnEOCLlOH0C/k7tpxpwhLp/AwHeQsDaN8i W4yu5ocd3kz4OCQlMHHzf5D/GJAg/OMttY42n0DtYGNFnIO3Ud3WcmNBEQZcWlqlz5/MY+ Ii+XbQT9Lx7Y2n11EYKa0SeTnqEmFfUy6+sD+Fx/K1hRQu3WpFCgwrfNRCT/pg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720298540; a=rsa-sha256; cv=none; b=OgVL/Asc1T+FBI3jCwWlY1GwDfCVpUaUi1dDNupkRbYSMNeck8pHRhwn5ZQ2kmXsLo8PlG XKRFgslAMTpffwGGCPbFUJdSTiJFJOOwRdhXOrzvPFaqsnKgPK7RfY329tnaPfxG66EhxN k72kopK8NOi0vJlBlHQEO/LqRqbkTXPUDudOqKqHA6RoUtqaT08MBQaM+JggcYvecnhDoc Py5873f4P8jZtrP2hmd4JFRAs6j9uZ6PVh9bwyrKt/47jMqDyqQ71JwkLqPt7I6xXLzW51 CzCQEYmmoe97LeUyPBfLgJs18UOjBvpIixSGgsIBXx7ke33F8AQmtXhzxwpjTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720298540; 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=IRibl8fUmuj7bBE22A3seAbrTJlC7DggreH6s8IJuAI=; b=qW61lvQ4OcnZz+fkXG1KGxWJCFsv2ou5dX4Kf1+YSM1zYlNqkfeHxhSX6RBxEI3a7Y7tJ0 SiEGhNOkASvwlKXjH4Mum5jiFF1y7TlXmSQ5czHI0pfJTfM+JqJHzyRrb9XUS8shU7oxue FzA0u9KRDyrLi0L/BUcCaQNAHPp/iQGptaO8NY6StlORdJSYrBBrKPU7Nn4CHzYuq/EMWl N6Sw70WQz2hl+GPC2+MQYi+7sSOMgdk1A6QiMTmRCj4lRoWtSgtwMK30UQEh7VBf1eMoKb RvwtEDWqFovCIjVyi8PgQCZDUDlarNZ6pfQWyzxzmoNHK6I60sI2otxCdOq4Kg== 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 4WGj4D1fJLzvkc; Sat, 6 Jul 2024 20:42:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 466KgKkj027164; Sat, 6 Jul 2024 20:42:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 466KgKlC027161; Sat, 6 Jul 2024 20:42:20 GMT (envelope-from git) Date: Sat, 6 Jul 2024 20:42:20 GMT Message-Id: <202407062042.466KgKlC027161@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: d8a99eaa1f06 - main - rpcbind: Add option to disable local host binding List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: d8a99eaa1f06bc3b3c017dce3e6ddf6b1fa37bcb Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d8a99eaa1f06bc3b3c017dce3e6ddf6b1fa37bcb commit d8a99eaa1f06bc3b3c017dce3e6ddf6b1fa37bcb Author: Joyu Liao AuthorDate: 2024-07-06 20:39:07 +0000 Commit: Rick Macklem CommitDate: 2024-07-06 20:39:07 +0000 rpcbind: Add option to disable local host binding In our products, we need those options to support our features. Add daemon mode option for mountd, nfsd. Add skip local host binding option for rpcd. Add skip local host binding option for mountd. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/rpcbind/rpcbind.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index de05330d0ca5..44adae366bed 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -88,6 +88,7 @@ int libwrap = 0; #endif int nofork = 0; int verboselog = 0; +int nobind_localhost = 0; static char **hosts = NULL; static struct sockaddr **bound_sa; @@ -342,9 +343,9 @@ init_transport(struct netconfig *nconf) if (nhostsbak == 1) hosts[0] = "*"; else { - if (hints.ai_family == AF_INET) { + if (hints.ai_family == AF_INET && nobind_localhost == 0) { hosts[nhostsbak - 1] = "127.0.0.1"; - } else if (hints.ai_family == AF_INET6) { + } else if (hints.ai_family == AF_INET6 && nobind_localhost == 0) { hosts[nhostsbak - 1] = "::1"; } else return 1; @@ -802,7 +803,7 @@ parseargs(int argc, char *argv[]) #else #define WRAPOP "" #endif - while ((c = getopt(argc, argv, "6adh:iLlNs" WRAPOP WSOP)) != -1) { + while ((c = getopt(argc, argv, "6adh:IiLlNs" WRAPOP WSOP)) != -1) { switch (c) { case '6': ipv6_only = 1; @@ -823,6 +824,9 @@ parseargs(int argc, char *argv[]) if (hosts[nhosts - 1] == NULL) errx(1, "Out of memory"); break; + case 'I': + nobind_localhost = 1; + break; case 'i': insecure = 1; break; @@ -850,7 +854,7 @@ parseargs(int argc, char *argv[]) #endif default: /* error */ fprintf(stderr, - "usage: rpcbind [-6adiLls%s%s] [-h bindip]\n", + "usage: rpcbind [-6adIiLls%s%s] [-h bindip]\n", WRAPOP, WSOP); exit (1); }