Skip to contentSkip to conversation

package/frr: make vtysh group configurable

PATCH In review Joachim Wiberg 3 participants 8 messages Jan 6, 2025 – Feb 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/frr: make vtysh group configurable

---
 package/frr/Config.in | 8 ++++++++
 package/frr/frr.mk    | 7 ++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
package/frr/Config.in +8 -0
index c26b160b2a..9b9ad6f331 100644
@@ -24,6 +24,14 @@ config BR2_PACKAGE_FRR
 
 if BR2_PACKAGE_FRR
 
+config BR2_PACKAGE_FRR_VTYSH_GROUP
+	string "FRR vtysh group, default: frrvty"
+	default "frrvty"
+	help
+	  This setting controls the group a user must be member of to connect
+	  to vtysh.  E.g., on systems with an admin user, which may be member
+	  of the 'wheel' group, it may make more sense to use 'wheel' here.
+
 config BR2_PACKAGE_FRR_BMP
 	bool "BMP protocol"
 	select BR2_PACKAGE_C_ARES
package/frr/frr.mk +4 -3
index 921ef99665..9ec4d3af4f 100644
@@ -37,6 +37,7 @@ FRR_CONF_ENV = \
 
 # Do not enable -fplugin=frr-format for production, see doc/developer/workflow.rst,
 # it is only intended for FRR's developments
+FRR_VTYSH_GROUP=$(call qstrip,$(BR2_PACKAGE_FRR_VTYSH_GROUP))
 FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
 	--sysconfdir=/etc/frr \
 	--localstatedir=/var/run/frr \
@@ -48,7 +49,7 @@ FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
 	--enable-shell-access \
 	--enable-user=frr \
 	--enable-group=frr \
-	--enable-vty-group=frrvty \
+	--enable-vty-group=$(FRR_VTYSH_GROUP) \
 	--enable-fpm
 
 HOST_FRR_CONF_OPTS = --enable-clippy-only
@@ -107,12 +108,12 @@ define FRR_PERMISSIONS
 	/etc/frr/daemons f 640 frr frr - - - - -
 	/etc/frr/daemons.conf f 640 frr frr - - - - -
 	/etc/frr/frr.conf f 640 frr frr - - - - -
-	/etc/frr/vtysh.conf f 640 frr frrvty - - - - -
+	/etc/frr/vtysh.conf f 640 frr $(FRR_VTYSH_GROUP) - - - - -
 	/etc/frr/support_bundle_commands.conf f 640 frr frr
 endef
 
 define FRR_USERS
-	frr -1 frr -1 * /var/run/frr - frrvty FRR user priv
+	frr -1 frr -1 * /var/run/frr - $(FRR_VTYSH_GROUP) FRR user priv
 endef
 
 define FRR_INSTALL_INIT_SYSV
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Joachim,

Quoted 1 line · On Mon, 6 Jan 2025 21:34:59 +0100 Joachim Wiberg <[email protected]> wrote:

I am not a big fan of this, because we frequently use a "sane" default group in packages, and clearly don't want to make such a "sane" default configurable in each package. We would normally expect people who need to customize things to do it in their custom post-build script, but I admit in this specific case it seems not great, so I don't really have a good idea.

But my main concern is really: do we want to allow config options to set the group like this for each and every package?

Quoted 3 lines

# Do not enable -fplugin=frr-format for production, see doc/developer/workflow.rst,

 # it is only intended for FRR's developments
+FRR_VTYSH_GROUP=$(call qstrip,$(BR2_PACKAGE_FRR_VTYSH_GROUP))

Nitpick: spaces needed around = sign.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi Thomas, all

Quoted 9 lines · Thomas Petazzoni

On Mon,  6 Jan 2025 21:34:59 +0100
Joachim Wiberg <[email protected]> wrote:
I am not a big fan of this, because we frequently use a "sane" default group in packages, and clearly don't want to make such a "sane" default
configurable in each package. We would normally expect people who need to customize things to do it in their custom post-build script, but I admit in this specific case it seems not great, so I don't really have a good idea.

I understand the concern, sane defaults is one of many reasons that make Buildroot so compelling. However ...

Quoted 2 lines

But my main concern is really: do we want to allow config options to set the group like this for each and every package?

... some packages, in this case the complex beast that is Frr, hard code the group in the resulting application, without being possible to change or override in post-build scripts or configuration files. In such cases I believe we should allow for keeping deviations to the defaults in the users defconfig rather than forcing them to maintain local patches.

Quoted 6 lines
Quoted 4 lines

 # Do not enable -fplugin=frr-format for production, see doc/developer/workflow.rst,

 # it is only intended for FRR's developments
+FRR_VTYSH_GROUP=$(call qstrip,$(BR2_PACKAGE_FRR_VTYSH_GROUP))

Nitpick: spaces needed around = sign.

Ah, good catch. Will fix that in v2, pending approval of the general idea, of course.

Best regards
/Joachim

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Joachim Wiberg

Hi Joachim,

Why would you enforce a frrvty user to any other value ? Can you explain the rational of not using the Buildroot's default value ?

Even if FRR has such capability, it does not mean we should expose it.

Your suggestion starts adding some complexities. Based on the same model, if we follow it, we should do the same for:
--enable-user=frr
--enable-group=frr
too. That's why I would be strongly interested in reading your rationals for such capability.

Best regards,
Vincent
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hi Vincent!

Quoted 2 lines · Vincent Jardin

Why would you enforce a frrvty user to any other value ? Can you explain the rational of not using the Buildroot's default value ?

Currently, non-root users of a Buildroot system, that you want to give administrator privileges to manage the system, i.e., edit system files and configure Frr daemons using vtysh, need to be member of two groups:
wheel and frrvty.

I propose opening up that so it is up to the Buildroot user (developer) how they model their end system.

Quoted 1 line

Even if FRR has such capability, it does not mean we should expose it.

This Frr build-time setting controls the group which an administrator user in a system must be member of to be able to access vtysh over its UNIX socket, it cannot be set set or changed in another way after build.

A variant of the same patch that would work for my own use-case, and in some way align with Buildroot defaults, would be to change what we hard- code it to:

--enable-vty-group=wheel

I did not think such a patch would fly at all, in particular since it is not backwards compatible. Which is why I went with this approach where the developer can at least decide the group of users should be able to manage Frr now that it has shifted to everything-via-vtysh from per- daemon .conf files as their default.

Quoted 7 lines

Your suggestion starts adding some complexities. Based on the same model, if we
follow it, we should do the same for:
  --enable-user=frr
  --enable-group=frr
too. That's why I would be strongly interested in reading your rationals for such capability.

I see, well that was not my intention at all to imply. The latter is for privilege separation of the daemons themselves, I don't see any value to a user of Buildroot to be able to change that for any package.

All the best
/Joachim

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
Quoted 11 lines · Joachim Wiberg

Hi Vincent!

Quoted 2 lines · Vincent Jardin

Why would you enforce a frrvty user to any other value ? Can you explain the rational of not using the Buildroot's default value ?

Currently, non-root users of a Buildroot system, that you want to give administrator privileges to manage the system, i.e., edit system files and configure Frr daemons using vtysh, need to be member of two groups:
wheel and frrvty.

That is correct, but I still don't see what the problem is with that. It's
pretty standard UNIX sysadmin practice to use a unique group for each service and to add the users who need to access that service to the corresponding group.

Quoted 2 lines

I propose opening up that so it is up to the Buildroot user (developer) how they model their end system.

We don't want to give complete freedom though.

Quoted 11 lines
Quoted 1 line

Even if FRR has such capability, it does not mean we should expose it.

This Frr build-time setting controls the group which an administrator user in a system must be member of to be able to access vtysh over its UNIX socket, it cannot be set set or changed in another way after build.

A variant of the same patch that would work for my own use-case, and in some way align with Buildroot defaults, would be to change what we hard- code it to:

--enable-vty-group=wheel

But that would give access to frr to every user in the wheel group, with no
way at all to reduce that access. Conversely, a separate frrvty group allows you to add whatever user is needed to that group.

Regards,
Arnout

Quoted 25 lines

I did not think such a patch would fly at all, in particular since it is not backwards compatible. Which is why I went with this approach where the developer can at least decide the group of users should be able to manage Frr now that it has shifted to everything-via-vtysh from per- daemon .conf files as their default.

Quoted 7 lines

Your suggestion starts adding some complexities. Based on the same model, if we
follow it, we should do the same for:
  --enable-user=frr
  --enable-group=frr
too. That's why I would be strongly interested in reading your rationals for such capability.

I see, well that was not my intention at all to imply. The latter is for privilege separation of the daemons themselves, I don't see any value to a user of Buildroot to be able to change that for any package.

All the best
/Joachim

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw
In reply to Joachim Wiberg
Quoted 1 line · Joachim Wiberg

After some back-and-forth we didn't reach find the use case compelling enough,
so I've marked this patch as Rejected.

BTW in the future, please make sure to include in the commit message an
explanation _why_ this patch is needed (unless it's obvious, like for version bumps, new packages, or fixes).

Regards,
Arnout

Quoted 50 lines
---
  package/frr/Config.in | 8 ++++++++
  package/frr/frr.mk    | 7 ++++---
  2 files changed, 12 insertions(+), 3 deletions(-)
package/frr/Config.in +8 -0
index c26b160b2a..9b9ad6f331 100644
@@ -24,6 +24,14 @@ config BR2_PACKAGE_FRR
 
  if BR2_PACKAGE_FRR
 
+config BR2_PACKAGE_FRR_VTYSH_GROUP
+	string "FRR vtysh group, default: frrvty"
+	default "frrvty"
+	help
+	  This setting controls the group a user must be member of to connect
+	  to vtysh.  E.g., on systems with an admin user, which may be member
+	  of the 'wheel' group, it may make more sense to use 'wheel' here.
+
  config BR2_PACKAGE_FRR_BMP
  	bool "BMP protocol"
  	select BR2_PACKAGE_C_ARES
package/frr/frr.mk +2 -2
index 921ef99665..9ec4d3af4f 100644
@@ -37,6 +37,7 @@ FRR_CONF_ENV = \
 
  # Do not enable -fplugin=frr-format for production, see doc/developer/workflow.rst,
  # it is only intended for FRR's developments
+FRR_VTYSH_GROUP=$(call qstrip,$(BR2_PACKAGE_FRR_VTYSH_GROUP))
  FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
  	--sysconfdir=/etc/frr \
  	--localstatedir=/var/run/frr \
@@ -48,7 +49,7 @@ FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
  	--enable-shell-access \
  	--enable-user=frr \
  	--enable-group=frr \
-	--enable-vty-group=frrvty \
+	--enable-vty-group=$(FRR_VTYSH_GROUP) \
  	--enable-fpm
 
  HOST_FRR_CONF_OPTS = --enable-clippy-only
@@ -107,12 +108,12 @@ define FRR_PERMISSIONS
  	/etc/frr/daemons f 640 frr frr - - - - -
  	/etc/frr/daemons.conf f 640 frr frr - - - - -
  	/etc/frr/frr.conf f 640 frr frr - - - - -
-	/etc/frr/vtysh.conf f 640 frr frrvty - - - - -

package/frr/frr.mk define FRR_PERMISSIONS · line 119

Quoted 10 lines
package/frr/frr.mk +2 -1
+	/etc/frr/vtysh.conf f 640 frr $(FRR_VTYSH_GROUP) - - - - -
  	/etc/frr/support_bundle_commands.conf f 640 frr frr
  endef
 
  define FRR_USERS
-	frr -1 frr -1 * /var/run/frr - frrvty FRR user priv
+	frr -1 frr -1 * /var/run/frr - $(FRR_VTYSH_GROUP) FRR user priv
  endef
 
  define FRR_INSTALL_INIT_SYSV

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw
Quoted 4 lines · Arnout Vandecappelle
Quoted 1 line · Joachim Wiberg

  After some back-and-forth we didn't reach find the use case compelling enough, so I've marked this patch as Rejected.

OK, that's fine. It was worth a try, and now I've learned a bit more about policy and how you reason about things like this in Buildroot. So thank you! 🙂

Quoted 3 lines

BTW in the future, please make sure to include in the commit message an explanation _why_ this patch is needed (unless it's obvious, like for version bumps, new packages, or fixes).

Understood.

Best regards
/Joachim

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot