pmx-ldap-sync - Create a flat file list or map from an LDAP service.
pmx-ldap-sync --base DN --query QUERY --result ATTRIBUTES [--result-filter EXPR] [--host LDAPHOST[:PORT]] [--result-rhs ATTRIBUTES [--result-rhs-filter EXPR]] [--page-size INT] [--async] [--verbose] [--bind-dn DN] [--bind-password PASSWORD] [--ldap-version 2|3] [--scope base|one|sub] FILENAME
pmx-ldap-sync --help
The pmx-ldap-sync
program synchronizes data from an LDAP
directory service with a plain text file. This file can be used as a
PureMessage list or map.
Once the sync is complete, the local file (FILENAME
) specified is
atomically replaced using rename()
. Therefore, the local file can be
the list or map name. pmx-ldap-sync
can run uninterrupted, without
prompting the user for input (for example, it can be used as a scheduled job).
--result
option.
The result from each record is a separate list item. Multiple results from each record are space separated but still result in a single list item.
$_
for use in
the expression. The result of the expression is used
in place of the value when creating the output file.
--result
, but instead of creating
a list, the results are used as the right-hand side of a map.
--result-filter
, but it applies to
--result-rhs
instead of --result
.
LDAPv2 and older do not support this option.
More than one --host
option may be specified. Each is tried
in order until a connection is made.
--bind-dn
specifies the identity (in the form of a Distinguished
Name) of someone who is authorized to query the LDAP server.
This option is required if --bind-password
is specified.
If --bind-password
is not specified, an anonymous bind is attempted.
pmx-ldap-sync --base 'o=yourorg,c=US' --query '(&(mail=*)(paid=true)' \ --result 'mail,awaymail' valid-users
Another usage for the pmx-ldap-sync
utility is to set
the --result-filter
option to add content to the result.
The following example uses the --result-filter
option
in a sendmail access file generator:
pmx-ldap-sync --base 'o=yourorg,c=US' --query '(&(mail=*)(paid=true))' \ --result 'mail' --result-filter 's,\z,\tOK,;$_' \ valid-users
Copyright (C) 2000-2008 Sophos Group. All rights reserved. Sophos and PureMessage are trademarks of Sophos Plc and Sophos Group.
=cut