App-Regather
view release on metacpan or search on metacpan
etc/regather.conf.sample
etc/regather.d/bind.tt
etc/regather.d/crl-ovpn.tt
etc/regather.d/crl-rad.tt
etc/regather.d/djb.tt
etc/regather.d/nsd.tt
etc/regather.d/ovpn.tt
etc/regather.d/ovpn-replica.tt
etc/regather.d/sieve.tt
lib/App/Regather.pm
lib/App/Regather/Config.pm
lib/App/Regather/Logg.pm
plugins now available
* configfile
* nsupdate
* script
As example, regather, on LDAP event can
* create/re-write/delete OpenVPN client config file/s
* create/re-write/delete CRL file for OpenVPN or FreeRADIUS (in this case it is ca+crl pem file)
* create/re-write/delete sieve script for mail user.
* nsupdate DNS zones
* create/re-write/delete mail domain maildir directory in IMAP4 space, on domain binding to IMAP server LDAP configuration (todo)
* pass LDAP object as set of environmental variables to a script
All this allow you to adopt regather to do anything you want on LDAP syncrepl event.
Copyright (c) 2021 [Zeus Panchenko](https://github.com/z-eos)
lib/App/Regather.pm view on Meta::CPAN
if ( $self->o('strict') ) {
exit LDAP_CONNECT_ERROR;
} else {
next;
}
} else {
$self->l->cc( pr => 'info', fm => "%s: TLS negotiation succeeded" ) if $self->o('v') > 1;
}
}
my $bind = $self->cf->getnode(qw(ldap bnd))->as_hash if $self->cf->is_section(qw(ldap bnd));
if ( ref($bind) eq 'HASH' ) {
if ( exists $bind->{dn} ) {
my @bind_options;
push @bind_options, delete $bind->{dn};
while ( my($k, $v) = each %{$bind} ) {
push @bind_options, $k => $v;
}
$mesg = $self->o('ldap')->bind( @bind_options );
if ( $mesg->code ) {
####### !!!!!!! TODO: to implement exponential delay on error sending to awoid log file/notify
####### !!!!!!! queue overflow
$self->l->cc( pr => 'err', fm => "%s:%s: bind error: %s",
ls => [ __FILE__,__LINE__, $mesg->error ] );
if ( $self->o('strict') ) {
exit $mesg->code;
} else {
next;
}
}
}
}
lib/App/Regather.pm view on Meta::CPAN
$self->l->cc( pr => 'info',
fm => "%s:%s: LDAP search:\n% 13s%s\n% 13s%s\n% 13s%s\n% 13s%s\n\n",
ls => [ __FILE__,__LINE__,
'base: ', $self->cf->get(qw(ldap srch base)),
'scope: ', $self->cf->get(qw(ldap srch scope)),
'filter: ', $self->cf->get(qw(ldap srch filter)),
'attrs: ', join("\n", @{$cfgattrs}) ] ) if $self->o('v') > 2;
}
}
$mesg = $self->o('ldap')->unbind;
if ( $mesg->code ) {
$self->l->cc_ldap_err( mesg => $mesg );
exit $mesg->code;
}
closelog();
}
#
lib/App/Regather/Config.pm view on Meta::CPAN
none => 'never',
allow => 'optional',
demand => 'require',
hard => 'require',
try => 'optional',
},
},
},
bnd => {
anonymous => '',
dn => 'binddn',
password => 'bindpw',
},
srch=> {
attrs => '',
base => 'base',
filter => '',
raw => '',
scope => '',
sizelimit => 'sizelimit',
timelimit => 'timelimit',
lib/App/Regather/Config.pm view on Meta::CPAN
base = STRING
filter = STRING :mandatory
raw = STRING
scope = STRING :default sub
sizelimit = NUMBER :default 0
timelimit = NUMBER :default 0
log_base = STRING
[ldap bnd]
anonymous = STRING
bindpw = STRING
dn = STRING
password = STRING
[ldap opt]
async = NUMBER :default 0
debug = NUMBER :default 0
inet4 = STRING
inet6 = STRING
keepalive = STRING
localaddr = STRING
( run in 0.690 second using v1.01-cache-2.11-cpan-2398b32b56e )