Added --user and --group to override apache:apache for lmConfigEditor

This commit is contained in:
Alex Kelly 2021-07-15 11:15:46 -04:00
parent fe6ad903f1
commit da87299b1d

View File

@ -10,13 +10,23 @@ use English qw(-no_match_vars);
use File::Temp;
use POSIX qw(setuid setgid);
use Safe;
use Getopt::Long;
use strict;
my $cli = Lemonldap::NG::Manager::Cli::Lib->new;
our $opt_user = '__APACHEUSER__';
our $opt_group = '__APACHEGROUP__';
GetOptions (
"user=s" => \$opt_user,
"group=s" => \$opt_group
)
or die("Error in command line arguments\n");
eval {
setgid( ( getgrnam('__APACHEGROUP__') )[2] );
setuid( ( getpwnam('__APACHEUSER__') )[2] );
setgid( ( getgrnam($opt_group) )[2] );
setuid( ( getpwnam($opt_user) )[2] );
print STDERR "Running as uid $EUID and gid $EGID\n";
};