#!/usr/bin/perl -w use Lemonldap::NG::Manager::Cli; use POSIX qw(setuid setgid); use strict; sub giveUpPrivileges { my ( $user, $group ) = @_; if ( not defined($user) ) { $user = "nobody"; } if ( not defined($group) ) { $group = "nobody"; } # become $user:$group and give up root privileges setgid( ( getgrnam($group) )[2] ); setuid( ( getpwnam($user) )[2] ); # if we are still root if ( $> == 0 ) { # ask the user to continue or abort print STDERR "$0 must not be launched as root since local cache can be corrupted.\n"; print STDERR "Continue (y/N)? "; my $res = ; exit 1 unless ( $res =~ /^y/i ); } } &giveUpPrivileges( "www-data", "www-data" ); # Display usage unless command unless (@ARGV) { print STDERR "Usage: $0 \n"; print STDERR "Enter $0 help to get more information\n"; exit 1; } my $app = Lemonldap::NG::Manager::Cli->new(); my $ret = $app->run(@ARGV); exit($ret); __END__ =head1 NAME =encoding utf8 lemonldap-ng-cli - Command Line Interface to edit LemonLDAP::NG configuration. =head1 SYNOPSIS Set/get variables in the configuration: lemonldap-ng-cli set lemonldap-ng-cli unset lemonldap-ng-cli get Define macros: lemonldap-ng-cli set-macro lemonldap-ng-cli unset-macro lemonldap-ng-cli get-macro Modify application list: lemonldap-ng-cli apps-set-cat lemonldap-ng-cli apps-get-cat lemonldap-ng-cli apps-add lemonldap-ng-cli apps-set-uri lemonldap-ng-cli apps-set-name lemonldap-ng-cli apps-set-desc lemonldap-ng-cli apps-set-logo lemonldap-ng-cli apps-set-display lemonldap-ng-cli apps-get lemonldap-ng-cli apps-rm Manage rules: lemonldap-ng-cli rules-set lemonldap-ng-cli rules-unset lemonldap-ng-cli rules-get Manage exported variables: lemonldap-ng-cli export-var lemonldap-ng-cli unexport-var lemonldap-ng-cli get-exported-vars Manage exported headers: lemonldap-ng-cli export-header lemonldap-ng-cli unexport-header lemonldap-ng-cli get-exported-headers Manage virtual hosts: lemonldap-ng-cli vhost-add lemonldap-ng-cli vhost-del lemonldap-ng-cli vhost-set-port lemonldap-ng-cli vhost-set-https lemonldap-ng-cli vhost-set-maintenance lemonldap-ng-cli vhost-list Global Storage: lemonldap-ng-cli global-storage lemonldap-ng-cli global-storage-set-dir lemonldap-ng-cli global-storage-set-lockdir Reload URLs: lemonldap-ng-cli reload-urls lemonldap-ng-cli reload-url-add lemonldap-ng-cli reload-url-del =head1 DESCRIPTION lemonldap-ng-cli allow user to edit the configuration of Lemonldap::NG via the command line. =head1 SEE ALSO L, L =head1 AUTHOR David Delassus Edavid.jose.delassus@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2012, by David Delassus This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available. =cut