From 7b20647e7ae32a6f9a2d7d107aa34b4e1d9d6796 Mon Sep 17 00:00:00 2001 From: SinnySupernova <155481713+SinnySupernova@users.noreply.github.com> Date: Tue, 15 Oct 2024 19:37:27 +0000 Subject: [PATCH] add numeric fallback to privilege drop (#868) --- crates/common/src/listener/listen.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/common/src/listener/listen.rs b/crates/common/src/listener/listen.rs index fc1cd38f..ca82582b 100644 --- a/crates/common/src/listener/listen.rs +++ b/crates/common/src/listener/listen.rs @@ -318,9 +318,13 @@ impl Listeners { #[cfg(not(target_env = "msvc"))] { if let Ok(run_as_user) = std::env::var("RUN_AS_USER") { - let mut pd = privdrop::PrivDrop::default().user(run_as_user); + let mut pd = privdrop::PrivDrop::default() + .user(run_as_user) + .fallback_to_ids_if_names_are_numeric(); if let Ok(run_as_group) = std::env::var("RUN_AS_GROUP") { - pd = pd.group(run_as_group); + pd = pd + .group(run_as_group) + .fallback_to_ids_if_names_are_numeric(); } pd.apply().failed("Failed to drop privileges"); }