diff --git a/Netdisco/Changes b/Netdisco/Changes index 329e8d65..df5dc405 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -3,6 +3,7 @@ [ENHANCEMENTS] * Use daterange for IP Subnets (same as IP Inventory) + * Run daemons as target binary's owning user (supports run control) [BUG FIXES] diff --git a/Netdisco/bin/netdisco-daemon b/Netdisco/bin/netdisco-daemon index 8b05c382..8dbfc6e6 100755 --- a/Netdisco/bin/netdisco-daemon +++ b/Netdisco/bin/netdisco-daemon @@ -32,6 +32,9 @@ my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ()); my $log_dir = dir($home, 'logs'); mkdir $log_dir if ! -d $log_dir; +my $uid = stat($netdisco)[4] || 0; +my $gid = stat($netdisco)[5] || 0; + Daemon::Control->new({ name => 'Netdisco Daemon', program => $netdisco, @@ -39,6 +42,8 @@ Daemon::Control->new({ pid_file => file($home, 'netdisco-daemon.pid'), stderr_file => file($log_dir, 'netdisco-daemon.log'), stdout_file => file($log_dir, 'netdisco-daemon.log'), + uid => $uid, + gid => $gid, })->run; =head1 NAME diff --git a/Netdisco/bin/netdisco-web b/Netdisco/bin/netdisco-web index d41d24d1..5484931a 100755 --- a/Netdisco/bin/netdisco-web +++ b/Netdisco/bin/netdisco-web @@ -32,6 +32,9 @@ my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ()); my $log_dir = dir($home, 'logs'); mkdir $log_dir if ! -d $log_dir; +my $uid = stat($netdisco)[4] || 0; +my $gid = stat($netdisco)[5] || 0; + Daemon::Control->new({ name => 'Netdisco Web', program => 'starman', @@ -39,6 +42,8 @@ Daemon::Control->new({ pid_file => file($home, 'netdisco-web.pid'), stderr_file => file($log_dir, 'netdisco-web.log'), stdout_file => file($log_dir, 'netdisco-web.log'), + uid => $uid, + gid => $gid, })->run; =head1 NAME