[Exim-Announce] program for generating aliases and LDAP entr…

Top Page
Delete this message
Reply to this message
Author: Stephan Leemburg
Date:  
To: exim-announce
Subject: [Exim-Announce] program for generating aliases and LDAP entries available
Hi,

We use exim on our main mailserver and use an aliases file with
generated aliases and a login to email-address translation for outgoing
mail, in the config file:

(...)

# in the directors config

generated_aliases:
driver = aliasfile
file = /etc/nisaliases
search_type = lsearch
user = mail
group = mail

(...)

# and in the rewrite section

*@jvc.nl         ${lookup{$1}lsearch{/etc/mail/longnames}\
                         {$value}fail}@??? Ffrs


We also use OpenLDAP. Now we wanted to generate the aliases and the LDAP
entries from our central NIS maps. There was nothing, so I wrote a
little program that can generate aliases from the GECOS field, put users
in one or multiple groups (also encoded in the GECOS field) and generate
the appropriate LDAP LDIF files.

It uses 2 fields from the password file to do this (in fact the source
need not be the password file...) and interprets them as follows:

<login-name> : <firstname> <middle-names> <lastname> , <mail-group> [
'/' <mail-group>], <phone>

For example:

loginname: first initials last, group1/ group2/group3, 345
jeanpaul: Jean Paul Something, marketing/ communications, 346
marie: Marie van der Burg, communications, 347

This results in the following aliases:

# generated aliaslist

last:                                              loginname
filast:                                            loginname
f.i.last:                                          loginname
f-i-last:                                          loginname
f_i_last:                                          loginname
firstinitialslast:                                 loginname
first.initials.last:                               loginname
first-initials-last:                               loginname
first_initials_last:                               loginname


something:                                         jeanpaul
jpsomething:                                       jeanpaul
j.p.something:                                     jeanpaul
j-p-something:                                     jeanpaul
j_p_something:                                     jeanpaul
jeanpaulsomething:                                 jeanpaul
jean.paul.something:                               jeanpaul
jean-paul-something:                               jeanpaul
jean_paul_something:                               jeanpaul


burg:                                              marie
mvdburg:                                           marie
m.v.d.burg:                                        marie
m-v-d-burg:                                        marie
m_v_d_burg:                                        marie
marievanderburg:                                   marie
marie.van.der.burg:                                marie
marie-van-der-burg:                                marie
marie_van_der_burg:                                marie



# generated grouplist

all:                                               jpsomething,
                                                   filast,
                                                   mvdburg


communications:                                    jpsomething,
                                                   mvdburg


group1:                                            filast


group2:                                            filast


group3:                                            filast


marketing:                                         jpsomething


The following nametranslation list:

# generated namelist

loginname:                                         filast
jeanpaul:                                          jpsomething
marie:                                             mvdburg


and the following LDAP LDIF File:

dn: dc=top
dc: top
objectClass: top
objectClass: domain
objectClass: domainRelatedObject
associatedDomain: domain.top

dn: dc=domain, dc=top
dc: domain
objectClass: top
objectClass: domain
objectClass: domainRelatedObject
associatedDomain: domain.top

dn: cn=first initials last,dc=domain, dc=top
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: loginname
cn: first initials last
sn: initials last
telephonenumber: 345
givenname: first
o: Some Organisation
ou: group1
mail: filast@???
mail: last@???
mail: f.i.last@???
mail: f-i-last@???
mail: f_i_last@???
mail: firstinitialslast@???
mail: first.initials.last@???
mail: first-initials-last@???
mail: first_initials_last@???

dn: cn=Jean Paul Something,dc=domain, dc=top
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: jeanpaul
cn: Jean Paul Something
sn: Paul Something
telephonenumber: 346
givenname: Jean
o: Some Organisation
ou: marketing
mail: jpsomething@???
mail: something@???
mail: j.p.something@???
mail: j-p-something@???
mail: j_p_something@???
mail: jeanpaulsomething@???
mail: jean.paul.something@???
mail: jean-paul-something@???
mail: jean_paul_something@???

dn: cn=Marie van der Burg,dc=domain, dc=top
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: marie
cn: Marie van der Burg
sn: van der Burg
telephonenumber: 347
givenname: Marie
o: Some Organisation
ou: communications
mail: mvdburg@???
mail: burg@???
mail: m.v.d.burg@???
mail: m-v-d-burg@???
mail: m_v_d_burg@???
mail: marievanderburg@???
mail: marie.van.der.burg@???
mail: marie-van-der-burg@???
mail: marie_van_der_burg@???

dn: cn=all,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: all
cn: all
owner: cn=all,dc=domain, dc=top
mail: all@???
telephonenumber: Group
o: Some Organisation
ou: all
member: cn=Jean Paul Something,dc=domain, dc=top
member: cn=first initials last,dc=domain, dc=top
member: cn=Marie van der Burg,dc=domain, dc=top

dn: cn=communications,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: communications
cn: communications
owner: cn=communications,dc=domain, dc=top
mail: communications@???
telephonenumber: Group
o: Some Organisation
ou: communications
member: cn=Jean Paul Something,dc=domain, dc=top
member: cn=Marie van der Burg,dc=domain, dc=top

dn: cn=group1,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: group1
cn: group1
owner: cn=group1,dc=domain, dc=top
mail: group1@???
telephonenumber: Group
o: Some Organisation
ou: group1
member: cn=first initials last,dc=domain, dc=top

dn: cn=group2,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: group2
cn: group2
owner: cn=group2,dc=domain, dc=top
mail: group2@???
telephonenumber: Group
o: Some Organisation
ou: group2
member: cn=first initials last,dc=domain, dc=top

dn: cn=group3,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: group3
cn: group3
owner: cn=group3,dc=domain, dc=top
mail: group3@???
telephonenumber: Group
o: Some Organisation
ou: group3
member: cn=first initials last,dc=domain, dc=top

dn: cn=marketing,dc=domain, dc=top
objectclass: top
objectclass: groupOfNames
objectclass: rfc822MailGroup
description: marketing
cn: marketing
owner: cn=marketing,dc=domain, dc=top
mail: marketing@???
telephonenumber: Group
o: Some Organisation
ou: marketing
member: cn=Jean Paul Something,dc=domain, dc=top


I was wondering if there is anyone who has interest in this program and
the companion script. If so, I will release them under GPL or just give
them to the exim developers group if they wish.

Kind regards,
--
Stephan