Commit a16ce799 authored by Yadd's avatar Yadd
Browse files

Merge branch 'v2.0' into 'v2.0'

added --user and --group options for CLI to work better with non-apache (nginx) installs

See merge request !208
parents fe6ad903 6bc4423f
Pipeline #14769 passed with stage
in 9 minutes and 26 seconds
......@@ -3,12 +3,21 @@
use warnings;
use strict;
use POSIX;
use Getopt::Long;
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");
my $action;
eval {
POSIX::setgid( scalar( getgrnam('__APACHEGROUP__') ) );
POSIX::setuid( scalar( getpwnam('__APACHEUSER__') ) );
POSIX::setgid( scalar( getgrnam($opt_group) ) );
POSIX::setuid( scalar( getpwnam($opt_user) ) );
};
for ( my $i = 0 ; $i < @ARGV ; $i++ ) {
......
......@@ -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";
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment