Add --user/--group options to lmConfigEditor and lemonldap-ng-cli (user:group hardcoded to apache may not work correctly)
Summary
Attempting to use lmConfigEditor gives errors about being unable to read configuration files. In order to make lemonldap-ng work with nginx, everything has to be owned nginx:nginx instead of apache:apache, but hard coding the user and group in this utility makes it impossible to use with anything other than apache.
Design proposition
add CLI options to specify --user
and --group
to override apache:apache.
I'm not a PERL master, but I made it work with this
use Getopt::Long;
our $opt_user = 'apache';
our $opt_group = 'apache';
GetOptions (
"user=s" => \$opt_user,
"group=s" => \$opt_group
)
or die("Error in command line arguments\n");
eval {
setgid( ( getgrnam($opt_group) )[2] );
setuid( ( getpwnam($opt_user) )[2] );
print STDERR "Running as uid $EUID and gid $EGID\n";
};
Edited by Yadd