|
Nico and Co. Exutoire, zone libre de Nicolas Barcet
|
| connexion ssl |
NavigationRSS Général
|
LDAP to Mailman
Nicolas 01/06/2005 - 09:29
I maintain various web sites which use LDAP to maintain information about users. I often need these user to be subscribed to mailing lists based on groups or other attributes stored in the LDAP directory. The following script, called regurlarly with a few appropriate parameters will do just that :
#! /bin/sh
# mmldap : An ldap extractor for mailman
#
# Usage: mmldap <listname> <base> <filter> [<listoptions>]
# <listname> is the name of and existing mailman list
# <base> is the basedn for ldapsearch
# <filter> is the ldap filter for ldapsearch
# <listoptions> are the parameters passed to mailman's sync_members command
# defaults are : -a -w=no -g=no
#
# Example :
# mmldap MyList ou=users,o=test "(&(objectclass=user)(mail=*@*)(subscribeML=true)(!(logindisabled=true)))
#
# Author : nicolas@barcet.com
## You can define here the ice command option. Type ice on the command prompt
## for more help.
LDAPOPTIONS=""
#set default is nothing set above
if (test LDAPOPTIONS="") then
# by default will connect anonymously to localhost with a subtree search
LDAPOPTIONS="-s sub -h localhost"
fi
case "$1" in
-h)
cat $0.help
;;
--help)
more $0.readme
;;
*)
if (test -n "$3") then
LISTNAME=$1
BASE=$2
FILTER=$3
echo "$0 invoked at `date` for $LISTNAME"
if (test -n "$4") then
OPTIONS=$4
else
OPTIONS="-a -w=no -g=no"
fi
ldapsearch $LDAPOPTION -b $BASE -x $FILTER mail | grep mail: | awk '{print $2}' > /tmp/maillist
/usr/lib/mailman/bin/sync_members $OPTIONS -f /tmp/maillist $LISTNAME
rm /tmp/maillist
else
echo " Usage: $0 <listname> <base> <filter> [<listoptions>]"
echo " <listname> is the name of and existing mailman list"
echo " <base> is the basedn for ldapsearch"
echo " <filter> is the ldap filter for ldapsearch"
echo " <listoptions> are the parameters passed to mailman's sync_members command"
echo " defaults are : -a -w=no -g=no"
fi
;;
esac
Technorati Tags: Répondre |
ConnexionTags
électronique
april
brevets
démocratie
dadvsi
divers
drm
ecole
education
equilibrage
europe
fiction
filter
filtrage
france
hadopi
informatique
internet
interopérabilité
ipred2
itunes
kids
kvm
législation
lemeur
liberté
libertyalliance
linux
linuxworld08
logiciel libre
machine-a-voter
mandriva
moratoire
OOXML
openID
oscon08
pétition
p2p
Paquet telecom
parents
partage
planetubuntu
pme
politique
présidentielle
presidentielles
quadrature
revendication
RFID
sarkozy
schiboleth
server
solutionslinux
sondage ubuntu server linux
téléchargement
technique
ubuntu
virtualization
vote
[en]
Blogue récents
RSS Linux
Recherche |
Commentaires récents
il y a 30 weeks 1 jour
il y a 31 weeks 4 days
il y a 31 weeks 4 days
il y a 1 année 19 weeks
il y a 1 année 34 weeks
il y a 1 année 35 weeks
il y a 1 année 40 weeks
il y a 1 année 41 weeks
il y a 1 année 41 weeks
il y a 1 année 41 weeks