From patchwork Wed Oct 23 22:04:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Henningsen X-Patchwork-Id: 1182517 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=asklandd.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=asklandd-dk.20150623.gappssmtp.com header.i=@asklandd-dk.20150623.gappssmtp.com header.b="CzXqCNvH"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46z4D20yyJz9sPL for ; Thu, 24 Oct 2019 09:04:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8F24920198; Wed, 23 Oct 2019 22:04:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xqxdoFhMYH-M; Wed, 23 Oct 2019 22:04:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2E72021539; Wed, 23 Oct 2019 22:04:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 4B4CF1BF870 for ; Wed, 23 Oct 2019 22:04:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 48B3B84559 for ; Wed, 23 Oct 2019 22:04:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7ehCTF8XeOzt for ; Wed, 23 Oct 2019 22:04:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 67C4F84456 for ; Wed, 23 Oct 2019 22:04:28 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id g24so522954wmh.5 for ; Wed, 23 Oct 2019 15:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asklandd-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1tfHEH0HB2bxs19lzeo2E0jGPMnwJKpaKZVMlcShfBc=; b=CzXqCNvHXCLtWGMxNGmtk3MzqhxWJeT49tQVQj++Ddn4YWm24oWRGXGFg2NkNDw7Pc hW+3rHtO2pcbQar5+gLK54LF0oyGaHKh759CAbjdpw2Z/COdY+V9DLdavzvVggtul8t8 3ynfyxpsVHTumMQepsqAQKVwRz4nDU2rB6APDiVPXmOiqyl8OxH3AK+89hHkP2/UKnDh Ue5rt0N7BjgrNnhTWkkU9XtNuHsGErJGhh9yHBqn0el6E63pxlPz6cl9wwoTCskrow5d 5vFIO4ulwiAXrpuPwuxp/4Pxv6HKRHCHRvWWX57Et+xpueZlb6JFUZHTeIPzHlsnscom ncQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1tfHEH0HB2bxs19lzeo2E0jGPMnwJKpaKZVMlcShfBc=; b=bmHvDoPwLNguVaisrPvybyhWaEjwZGzb/pixlHhnNb7Tke2i2R+901rlx2DO7/2YRz Ar8nIvXet+rEwu92vbWNKNZ1JDw5L35aWFWdb0I0wPnQ7ixzYH5kNIoe0nt2cBhYSJII vgUUop9IXBgC7i7vf5TMag+qvMGLV8KJ540USDDLgITXaeYcZ0oYJC6ScWejoTHcN7rJ MPeQIrbQYTBO+QOKKfSINI0rdFWId0fPqhek4CHGG/KPuTgdYzNA8g13RS4c1/7YHuyk jiGe/TEzD5SjbP4DS0COuwbL6LNEFfo92rSOUyG9eN2fPA+6kQwcjxrxWkQpINFDj/S2 taOw== X-Gm-Message-State: APjAAAWtlo8USPSXOZOqIhI/bFAWwPsbaKY9eOKhhL5iYQ2fi8dSUn3f LQaWKDozdYqmoBEyBdtrCWgCUEW8xWs= X-Google-Smtp-Source: APXvYqxUUbJEz6dWC/Vi6FqZV9QbgVFbjtDTXjfb+qFpOF+wfjhCFWVj2yNnKHy57w/iSACygkgYdQ== X-Received: by 2002:a1c:a943:: with SMTP id s64mr1828078wme.170.1571868266398; Wed, 23 Oct 2019 15:04:26 -0700 (PDT) Received: from lumines.sputnik.lan (static-5-186-52-63.ip.fibianet.dk. [5.186.52.63]) by smtp.gmail.com with ESMTPSA id w15sm15581139wro.65.2019.10.23.15.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 15:04:25 -0700 (PDT) From: Stephan Henningsen X-Google-Original-From: Stephan Henningsen To: buildroot@buildroot.org Date: Thu, 24 Oct 2019 00:04:23 +0200 Message-Id: <20191023220423.14930-2-stephan+git@asklandd.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023220423.14930-1-stephan+git@asklandd.dk> References: <20191023220423.14930-1-stephan+git@asklandd.dk> Subject: [Buildroot] [PATCH] package/sudo: removed template config, added convenient 'sudo' group config options. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephan Henningsen , Stephan Henningsen MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Stephan Henningsen Signed-off-by: Stephan Henningsen --- package/sudo/Config.in | 21 ++++++++++++++++++++- package/sudo/sudo.mk | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/package/sudo/Config.in b/package/sudo/Config.in index cbef15d67b..aee077fe3b 100644 --- a/package/sudo/Config.in +++ b/package/sudo/Config.in @@ -1,4 +1,4 @@ -config BR2_PACKAGE_SUDO +menuconfig BR2_PACKAGE_SUDO bool "sudo" # uses fork() depends on BR2_USE_MMU @@ -9,3 +9,22 @@ config BR2_PACKAGE_SUDO but still allow people to get their work done. http://www.sudo.ws/sudo/ + + +if BR2_PACKAGE_SUDO + +config BR2_PACKAGE_SUDO_GROUP + bool "add system group 'sudo'" + help + Create a convenient system group named 'sudo' for + granting users sudo permissions. + +config BR2_PACKAGE_SUDO_GROUP_RULE + bool "allow member of group 'sudo' to execute any command." + select BR2_PACKAGE_SUDO_GROUP + help + Reinserts this rule from the /etc/sudoers configuration file: + + %sudo ALL=(ALL) ALL + +endif diff --git a/package/sudo/sudo.mk b/package/sudo/sudo.mk index cf8b63b1db..34b1869e98 100644 --- a/package/sudo/sudo.mk +++ b/package/sudo/sudo.mk @@ -64,4 +64,24 @@ define SUDO_PERMISSIONS /usr/bin/sudo f 4755 0 0 - - - - - endef +ifeq ($(BR2_PACKAGE_SUDO_GROUP_RULE),y) +define SUDO_ENABLE_SUDO_GROUP_RULE +sed -e '/^# \%sudo\tALL=(ALL) ALL/s/^# //' -i $(TARGET_DIR)/etc/sudoers +endef +SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_ENABLE_SUDO_GROUP_RULE +endif + + +ifeq ($(BR2_PACKAGE_SUDO_GROUP),y) +define SUDO_USERS + - -1 sudo -1 - - - - +endef +endif + +define SUDO_REMOVE_GARBAGE + $(RM) -fv $(TARGET_DIR)/etc/sudoers.dist # Remove stray example file + $(RM) -frv $(TARGET_DIR)/etc/sudoers.d # Remove unused configuration directory +endef +SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_REMOVE_GARBAGE + $(eval $(autotools-package))