2017-12-01 06:42:02 +01:00
|
|
|
#!/usr/bin/perl
|
2016-02-06 10:00:54 +01:00
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2016-02-26 07:41:38 +01:00
|
|
|
use POSIX;
|
2016-02-06 10:00:54 +01:00
|
|
|
|
2016-02-06 13:22:10 +01:00
|
|
|
my $action;
|
|
|
|
|
2016-02-26 07:41:38 +01:00
|
|
|
eval {
|
|
|
|
POSIX::setgid( scalar( getgrnam('__APACHEGROUP__') ) );
|
|
|
|
POSIX::setuid( scalar( getpwnam('__APACHEUSER__') ) );
|
|
|
|
};
|
|
|
|
|
2016-02-06 13:22:10 +01:00
|
|
|
for ( my $i = 0 ; $i < @ARGV ; $i++ ) {
|
|
|
|
if ( $ARGV[$i] =~ /^-/ ) {
|
|
|
|
$i++;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
$action = $ARGV[$i];
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
|
2016-02-22 15:52:16 +01:00
|
|
|
$action ||= "help";
|
|
|
|
|
2020-09-01 18:14:00 +02:00
|
|
|
if ( $action =~ /^(?:[gs]et|del|(?:add|del)Key|save|restore|rollback)$/ ) {
|
2016-02-06 10:00:54 +01:00
|
|
|
eval { require Lemonldap::NG::Manager::Cli; };
|
2017-02-26 09:04:39 +01:00
|
|
|
die "Manager libraries not available, aborting ($@)" if ($@);
|
2016-02-06 10:00:54 +01:00
|
|
|
Lemonldap::NG::Manager::Cli->run(@ARGV);
|
|
|
|
}
|
2020-09-16 16:56:06 +02:00
|
|
|
elsif ( $action =~ /^(?:info|update-cache|test-email)$/ ) {
|
2016-02-06 10:00:54 +01:00
|
|
|
eval { require Lemonldap::NG::Common::Cli; };
|
2016-02-06 13:22:10 +01:00
|
|
|
die "Lemonldap::NG common libraries not available, aborting ($@)" if ($@);
|
2016-02-06 10:00:54 +01:00
|
|
|
Lemonldap::NG::Common::Cli->run(@ARGV);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
help();
|
|
|
|
}
|
|
|
|
|
|
|
|
sub help {
|
|
|
|
print STDERR qq{Usage: $0 <options> action <parameters>
|
|
|
|
|
|
|
|
Available actions:
|
|
|
|
- help : print this
|
|
|
|
- info : get currentconfiguration info
|
|
|
|
- update-cache : force configuration cache to be updated
|
2020-09-16 16:56:06 +02:00
|
|
|
- test-email <destination> : send a test email
|
2016-02-06 10:00:54 +01:00
|
|
|
- get <keys> : get values of parameters
|
|
|
|
- set <key> <value> : set parameter(s) value(s)
|
2020-09-01 18:14:00 +02:00
|
|
|
- del <keys> : delete parameters
|
2016-02-06 10:00:54 +01:00
|
|
|
- addKey <key> <subkey> <value> : add or set a subkey in a parameter
|
|
|
|
- delKey <key> <subkey> : delete subkey of a parameter
|
2019-06-30 17:51:30 +02:00
|
|
|
- save : export configuration to STDOUT
|
|
|
|
- restore - : import configuration from STDIN
|
|
|
|
- restore <file> : import configuration from file
|
2020-02-24 11:58:29 +01:00
|
|
|
- rollback : restore previous configuration
|
2016-02-06 10:00:54 +01:00
|
|
|
|
2020-01-29 08:44:51 +01:00
|
|
|
Options:
|
|
|
|
- yes <0|1> : accept confirmation prompt automatically
|
|
|
|
- log <msg> : set configuration log message
|
|
|
|
- safe <0|1> : fail in case the requested configuration is invalid
|
|
|
|
- force <0|1> : allow overwrite of existing config number
|
|
|
|
- cfgNum <num> : set new configuration number (requires -force 1)
|
2020-08-31 22:45:21 +02:00
|
|
|
- sep <char> : separator of hierarchical values (by default: /)
|
2020-08-31 22:47:57 +02:00
|
|
|
- iniFile <file> : path to an alternate lemonldap-ng.ini file
|
2020-01-29 08:44:51 +01:00
|
|
|
|
2019-07-03 15:10:53 +02:00
|
|
|
See Lemonldap::NG::Manager::Cli(3) for more
|
2016-02-06 13:22:10 +01:00
|
|
|
};
|
2016-02-06 10:00:54 +01:00
|
|
|
}
|
2016-02-06 19:41:26 +01:00
|
|
|
__END__
|
2016-02-06 10:00:54 +01:00
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
=encoding utf8
|
|
|
|
|
|
|
|
lemonldap-ng-cli - Command-line manager for Lemonldap::NG web-SSO system.
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
Get information about current configuration
|
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
$ lemonldap-ng-cli info
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
Update local configuration cache
|
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
$ lemonldap-ng-cli update-cache
|
|
|
|
|
2020-09-16 16:56:06 +02:00
|
|
|
Send a test email
|
|
|
|
|
|
|
|
$ lemonldap-ng-cli test-email dwho@badwolf.org
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
Save configuration
|
|
|
|
|
|
|
|
$ lemonldap-ng-cli save >conf.json
|
2020-02-24 11:57:56 +01:00
|
|
|
$ lemonldap-ng-cli -cfgNum 19 save >conf-19.json
|
2019-05-30 09:48:43 +02:00
|
|
|
|
2019-05-30 10:18:41 +02:00
|
|
|
Restore configuration
|
|
|
|
|
|
|
|
$ lemonldap-ng-cli restore conf.json
|
|
|
|
# OR
|
|
|
|
$ lemonldap-ng-cli restore - <conf.json
|
|
|
|
|
2020-02-24 11:58:29 +01:00
|
|
|
Cancel the last configuration change
|
|
|
|
|
|
|
|
$ lemonldap-ng-cli rollback
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
Get a configuration parameter value
|
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
$ lemonldap-ng-cli get portal domain cookieName
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
Set some values
|
2016-02-06 19:41:26 +01:00
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
$ lemonldap-ng-cli set portal http://auth.e.com/ domain e.com
|
2016-02-06 19:41:26 +01:00
|
|
|
# add or set a key
|
|
|
|
$ lemonldap-ng-cli addKey macro fullname '$givenName." ".$lastName'
|
|
|
|
|
2020-01-29 08:44:51 +01:00
|
|
|
# without changing the version number
|
|
|
|
$ lemonldap-ng-cli -force 1 -cfgNum 1 set portal http://auth.e.com/ domain e.com
|
|
|
|
|
|
|
|
# without asking for confirmation
|
|
|
|
$ lemonldap-ng-cli -yes 1 set portal http://auth.e.com/ domain e.com
|
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2018-07-24 21:26:37 +02:00
|
|
|
lemonldap-ng-cli is a command line interface to interact with Lemonldap::NG
|
|
|
|
configuration. Commands are described in L<Lemonldap::NG::Manager::Cli>
|
2019-07-03 15:10:53 +02:00
|
|
|
and L<Lemonldap::NG::Common::Cli>
|
2016-02-06 19:41:26 +01:00
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
=head2 Available commands
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item info
|
|
|
|
|
|
|
|
=item update-cache
|
|
|
|
|
2020-09-16 16:56:06 +02:00
|
|
|
=item test-email
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
=item save
|
|
|
|
|
2019-05-30 10:18:41 +02:00
|
|
|
=item restore
|
|
|
|
|
2019-05-30 09:48:43 +02:00
|
|
|
=item get
|
|
|
|
|
|
|
|
=item set
|
|
|
|
|
|
|
|
=item addKey
|
|
|
|
|
|
|
|
=item delKey
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
2020-01-29 08:44:51 +01:00
|
|
|
=head2 Available options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item -yes
|
|
|
|
|
|
|
|
Confirm modification automatically (default: 0)
|
|
|
|
|
|
|
|
=item -log
|
|
|
|
|
|
|
|
Allows you to set the log message that will be displayed in the manager
|
|
|
|
|
|
|
|
=item -safe
|
|
|
|
|
|
|
|
The configuration change will be aborted if it contains errors (default: 0)
|
|
|
|
|
|
|
|
=item -cfgNum
|
|
|
|
|
|
|
|
Choose a particular configuration number (default: latest)
|
|
|
|
|
|
|
|
=item -force
|
|
|
|
|
|
|
|
Allows you to force overwriting an existing configuration (default: 0)
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
2016-02-06 19:41:26 +01:00
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2019-07-03 15:10:53 +02:00
|
|
|
L<Lemonldap::NG::Manager::Cli>, L<Lemonldap::NG::Common::Cli>
|
2016-02-06 19:41:26 +01:00
|
|
|
L<http://lemonldap-ng.org/>
|
|
|
|
|
|
|
|
=head1 AUTHORS
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item David Coutateur, E<lt>david.jose.delassus@gmail.comE<gt>
|
|
|
|
|
|
|
|
=item Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
|
|
|
=item Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 BUG REPORT
|
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features:
|
2017-11-11 14:06:23 +01:00
|
|
|
L<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
|
2016-02-06 19:41:26 +01:00
|
|
|
|
|
|
|
=head1 DOWNLOAD
|
|
|
|
|
|
|
|
Lemonldap::NG is available at
|
|
|
|
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item Copyright (C) 2016 by Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
=item Copyright (C) 2016 by Clément Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see L<http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
=cut
|