All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Henningsen <stephan@asklandd.dk>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/sudo: removed template config, added convenient 'sudo' group config options.
Date: Thu, 24 Oct 2019 00:02:31 +0200	[thread overview]
Message-ID: <20191023220232.14597-2-stephan+git@asklandd.dk> (raw)
In-Reply-To: <20191023220232.14597-1-stephan+git@asklandd.dk>

From: Stephan Henningsen <stephan+buildroot@asklandd.dk>

Signed-off-by: Stephan Henningsen <stephan@asklandd.dk>
---
 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))
-- 
2.17.1

  reply	other threads:[~2019-10-23 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 22:02 [Buildroot] [PATCH 1/1] package/sudo: removed template config, added convenient 'sudo' group config options Stephan Henningsen
2019-10-23 22:02 ` Stephan Henningsen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-23 22:11 Stephan Henningsen
2019-10-23 22:11 ` [Buildroot] [PATCH] " Stephan Henningsen
2019-10-23 22:05 [Buildroot] [PATCH 1/1] " Stephan Henningsen
2019-10-23 22:05 ` [Buildroot] [PATCH] " Stephan Henningsen
2019-10-23 22:04 [Buildroot] [PATCH 1/1] " Stephan Henningsen
2019-10-23 22:04 ` [Buildroot] [PATCH] " Stephan Henningsen
2019-10-23 22:03 [Buildroot] [PATCH 1/1] " Stephan Henningsen
2019-10-23 22:03 ` [Buildroot] [PATCH] " Stephan Henningsen
2019-10-23 21:48 [Buildroot] [PATCH 1/1] " Stephan Henningsen
2019-10-23 21:48 ` [Buildroot] [PATCH] " Stephan Henningsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191023220232.14597-2-stephan+git@asklandd.dk \
    --to=stephan@asklandd.dk \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.