[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: sendmail aliases
Below is a really old perl script that I used, when I first started
using sendmail aliases (including majordomo) in OpenLDAP (1999). Use
at your own risk and not on anything you care about, (this is no
longer being used, and I have not even checked if it still does
anything) but it should give you some helpful clues...
Also, Here is a little script that called the output once my modified
MajorCool updated its notion of the majordomo aliases file...
Again, this is really old, and just for some hints. I now do other
things with OpenLDAP, and sendmail... Randall
#!/bin/sh
# ./aliases2ldif.pl o="domain.com" < .majordomo_aliases > .majordomo_aliases.ldif
/usr/local/bin/ldapadd -h some.domain.com -r -c -D "cn=ldaproot,ou=Operators, o=domain.com" -w secret -f .majordomo_aliases.ldif
#!/usr/local/bin/perl
#
# -rsw@glue.umd.edu 10/12/99
#
$usage=<<EOU;
Usage $0 base < aliasesfile >aliasesfile.ldif
aliasesfile: The name of the aliases file being converted to ldif.
base : The LDAP search base. Remember the quotes.
EOU
my $fmt = "%-12s: %s\n";
my $base = $ARGV[0] or die $usage;
# my $base = "dc=yoyodyne,dc=com";
my $aliasname = undef;
my $line = undef;
while (<STDIN>) {
chomp;
next if (/^#/ || /^\s*$/);
if(defined $line && /^\s/) {
$line .= $_;
}
else {
if(defined $line) {
if($line =~ s/^([^:]+):/ /) {
$aliasname = $1;
$aliasname =~ s/(\A\s+|\s+\Z)//g;
}
# print "The UniqueMember:$aliasname\n";
# print "The ForwardingAddresses:$line\n";
my @vals = split(/\s+/,$line);
my $addresses = join(' ',@vals);
print "dn: cn=$aliasname, ou=Groups, $base\n";
printf "$fmt","changetype", "delete";
print "\n";
print "dn: cn=$aliasname, ou=Groups, $base\n";
printf "$fmt","changetype", "add";
printf "$fmt","objectClass", "top";
printf "$fmt","objectClass", "groups";
printf "$fmt","objectClass", "groupOfUniqueNames";
printf "$fmt","objectClass", "mailRecipient";
printf "$fmt","uniquemember","$aliasname";
printf "$fmt","uid","$aliasname";
printf "$fmt","cn","$aliasname";
if (($aliasname =~ /^owner-/) && ($addresses =~ /,$/) && !($addresses =~ /,./)) {
$addresses =~ s/^ //;
printf "$fmt","mailForwardingAddress", $addresses;
}
else {
my $address;
foreach $address (split(/,/, $addresses)) {
$address =~ s/^ //;
printf "$fmt","mailForwardingAddress", $address;
}
}
print "\n";
$line = undef; $aliasname = undef;
}
$line = $_;
# print "The Alias:$line\n";
}
}
On Fri, 2 May 2003, Brian Jones wrote:
: Hi,
:
: I hope this is an easy one. I have a nis aliases map which sendmail uses,
: and it contains commands to handle some mailing list stuff, so you get
: entries like this:
:
: myMailingList: "|/usr/local/majordomo/wrapper myList"
:
: I haven't seen any docs regarding putting commands like this into an alias
: entry under SendmailMTAAliasValue or anything, so I was looking for the
: syntax and confirmation that it'll even work and stuff before I go
: populating that whole branch of the directory.
:
: Anyone with a quick LDIF entry they could cut&paste to me?
:
: Thanks
: brian.
:
: