|
Subject: |
Virtual hosting with majordomo - Was: (Re: bug? (double config files)) |
|
From: |
Daniel Liston <dliston @
sonny .
org> |
|
Date: |
Mon, 31 Mar 2003 12:22:15 -0600 |
|
To: |
Rob <rob @
OhReally .
com>, majordomo-users @
greatcircle .
com |
|
In-reply-to: |
<200303311853.30378.rob@OhReally.com> |
|
References: |
<200303311853.30378.rob@OhReally.com> |
|
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 |
Hi Rob,
I was not aware that virtual hosting samples were in the majordomo FAQ.
Nope, just read it again, and that was not there. Perhaps you could
provide a URL of where you are getting your config and setup information.
The only time a new config file will be created is if you have a flat
file by the same name in the lists directory, or somebody has tinkered
with the majordomo scripts. In other words, majordomo found a file with
the name example_com_list in the lists directory. This file should not
exist any more than the example_com_list.config should. Delete them
both. I authored this next snippet that you may find useful.
New notes are appended to end for postfix and exim. I am still looking for qmail details.
Here is the step by step recipe I recommend for virtual hosting of majordomo mailing lists with sendmail. I have posted this
information a couple times without comment or criticism, so I have to assume those that have used it, found it to be accurate.
Last posting was 11/24/2002.
ASSUMPTIONS:
Sendmail-8.8.8 and Majordomo-1.94.4 (I have used this recipe successfully into sendmail 8.12.8 and majordomo 1.94.5)
Sendmail is working properly for the primary domain before hosting domains of any kind.
The login ID for your majordomo user is "majordomo".
Sendmail "Trusts" the majordomo user.
Tmajordomo exists in sendmail.cf and/or submit.cf
or you have
majordomo on a line in sendmail.ct or /etc/mail/trusted-users
Sendmail is NOT using "smrsh". If it is, you know where the directory is for creating links that allow sendmail to execute programs.
Majordomo is working properly for the primary domain before hosting domains of any kind.
Sendmail knows about any aliases files you may be using to support majordomo and/or virtual domains.
You have "root" access to the server you are doing this configuration on.
If the commands in the examples do not live in the same locations on your OS, you know where they are or what will work instead.
The "root" user is responsible for maintaining all majordomo configurations for all virtual domains.
Your primary domain is mydomain.com and you want to host your own lists plus example.net and sample.org.
This implies that DNS MX records point to your host for all three domains.
You want to allow each domain to have listnames that could collide with each other.
Example; "test" test@mydomain.com, test@example.net, test@sample.org
Your primary /etc/majordomo.cf contains;
$whereami = "mydomain.com";
$homedir = "/usr/lib/majordomo";
$datadir = "/var/lib/majordomo";
$listdir = "$datadir/lists";
$digest_work_dir = "$datadir/digest";
$filedir = "$datadir/archive";
$filedir_suffix = "";
$log = "$datadir/Log";
STEPS:
As "root"
I. Configure sendmail for virtual hosting.
http://www.sendmail.org/virtual-hosting.html
1. Your sendmail.cf supports /etc/mail/virtusertable
2. Your sendmail.cw (or local-host-names) contains
mydomain.com
example.net
sample.org
As "majordomo"
II. Create directory trees and config information for your virtual domains.
1. cd /var/lib/majordomo
a. mkdir -m 755 example.net sample.org
2. cd /var/lib/majordomo/example.net
a. mkdir -m 755 lists digest archive
b. touch Log
c. cp /etc/majordomo.cf /var/lib/majordomo/example.net
d. vi /var/lib/majordomo/example.net/majordomo.cf so that
$whereami = "example.net";
$datadir = "/var/lib/majordomo/example.net";
3. cd /var/lib/majordomo/sample.org
a. mkdir -m 755 lists digest archive
b. touch Log
c. cp /etc/majordomo.cf /var/lib/majordomo/sample.org
d. vi /var/lib/majordomo/sample.org/majordomo.cf so that
$whereami = "sample.org";
$datadir = "/var/lib/majordomo/sample.org";
NOTE: If you have applied the .cf security patches to majordomo make sure to create links to the new majordomo.cf files in the
/usr/lib/majordomo/config directory, and reference these *.cf files in your aliases rather than the .cf
files in the actual hosted domain's directories. I would do something like this;
As "root",
ln -s /var/lib/majordomo/example.net/majordomo.cf /usr/lib/majordomo/config/example.cf
ln -s /var/lib/majordomo/sample.org/majordomo.cf /usr/lib/majordomo/config/sample.cf
As "root", then "majordomo", then some other "user",
III. Test your new directories and majordomo.cf files.
1. cd /usr/lib/majordomo
2. ./wrapper config-test /var/lib/majordomo/example.net/majordomo.cf
3. ./wrapper config-test /var/lib/majordomo/sample.org/majordomo.cf
4. Fix any "bad things" found from steps 2 and 3 above.
IV. To actually create lists called test for your own domain and for your hosted domains, using the same assumptions from above;
As "majordomo" create a list called test in all domains
1. cd /var/lib/majordomo
a. mkdir -m 755 archive/test archive/test-digest digest/test-digest
b. touch lists/test lists/test-digest lists/test-post
c. echo owner-test@mydomain.com > lists/test
d. echo owner-test@mydomain.com > lists/test-digest
e. echo owner-test@mydomain.com > lists/test-post
2. cd /var/lib/majordomo/example.net
a. mkdir -m 755 archive/test archive/test-digest digest/test-digest
b. touch lists/test lists/test-digest lists/test-post
c. echo owner-test@example.net > lists/test
d. echo owner-test@example.net > lists/test-digest
e. echo owner-test@example.net > lists/test-post
3. cd /var/lib/majordomo/sample.org
a. mkdir -m 755 archive/test archive/test-digest digest/test-digest
b. touch lists/test lists/test-digest lists/test-post
c. echo owner-test@sample.org > lists/test
d. echo owner-test@sample.org > lists/test-digest
e. echo owner-test@sample.org > lists/test-post
As "root"
4. vi /etc/aliases
# A majordomo user and owner would be good to have per domain.
# This first one is for the primary or hosting domain.
majordomo: "|/usr/lib/majordomo/wrapper majordomo"
majordomo-owner: owner-majordomo
owner-majordomo: real-person@anydomain.com,
test: "|/usr/lib/majordomo/wrapper resend -l test test-outgoing,nobody"
test-outgoing: :include:/var/lib/majordomo/lists/test,test-digestify,test-archiver
test-archiver: "|/usr/lib/majordomo/wrapper archive2.pl -f /var/lib/majordomo/archive/test/test -a -M"
test-digestify: "|/usr/lib/majordomo/wrapper digest -r -C -l test-digest test-digest-outgoing,nobody"
owner-test: real-person@anydomain.com,
test-owner: owner-test
test-digest: test
test-digest-outgoing: :include:/var/lib/majordomo/lists/test-digest,nobody
test-digest-owner: owner-test
test-request: "|/usr/lib/majordomo/wrapper majordomo -l test"
test-digest-request: "|/usr/lib/majordomo/wrapper majordomo -l test-digest"
test-approval: owner-test
test-digest-approval: owner-test
# This section for example.net could live in a separate aliases file
example.net-majordomo: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/example.net/majordomo.cf"
example.net-majordomo-owner: owner-majordomo
owner-example.net-majordomo: real-person@anydomain.com,
example.net-test: "|/usr/lib/majordomo/wrapper resend -C /var/lib/majordomo/example.net/majordomo.cf -l test -h example.net
example.net-test-outgoing,nobody"
example.net-test-outgoing: :include:/var/lib/majordomo/example.net/lists/test,example.net-test-digestify,example.net-test-archiver
example.net-test-archiver: "|/usr/lib/majordomo/wrapper archive2.pl -C /var/lib/majordomo/example.net/majordomo.cf -f
/var/lib/majordomo/example.net/archive/test/test -a -M"
example.net-test-digestify: "|/usr/lib/majordomo/wrapper digest -r -C -c /var/lib/majordomo/example.net/majordomo.cf -l test-digest
example.net-test-digest-outgoing,nobody"
owner-example.com-test: real-person@anydomain.com,
example.net-test-owner: owner-example.net-test
example.net-test-digest: example.net-test
example.net-test-digest-outgoing: :include:/var/lib/majordomo/example.net/lists/test-digest,nobody
example.net-test-digest-owner: owner-example.net-test
example.net-test-request: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/example.net/majordomo.cf -l test"
example.net-test-digest-request: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/example.net/majordomo.cf -l test-digest"
example.net-test-approval: owner-example.net-test
example.net-test-digest-approval: owner-example.net-test
# This section for sample.org could live in a separate aliases file
sample.org-majordomo: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/sample.org/majordomo.cf"
sample.org-majordomo-owner: owner-majordomo
owner-sample.org-majordomo: real-person@anydomain.com,
sample.org-test: "|/usr/lib/majordomo/wrapper resend -C /var/lib/majordomo/sample.org/majordomo.cf -l test -h sample.org
sample.org-test-outgoing,nobody"
sample.org-test-outgoing: :include:/var/lib/majordomo/sample.org/lists/test,sample.org-test-digestify,sample.org-test-archiver
sample.org-test-archiver: "|/usr/lib/majordomo/wrapper archive2.pl -C /var/lib/majordomo/sample.org/majordomo.cf -f
/var/lib/majordomo/sample.org/archive/test/test -a -M"
sample.org-test-digestify: "|/usr/lib/majordomo/wrapper digest -r -C -c /var/lib/majordomo/sample.org/majordomo.cf -l test-digest
sample.org-test-digest-outgoing,nobody"
owner-sample.org-test: real-person@anydomain.com,
sample.org-test-owner: owner-sample.org-test
sample.org-test-digest: sample.org-test
sample.org-test-digest-outgoing: :include:/var/lib/majordomo/sample.org/lists/test-digest,nobody
sample.org-test-digest-owner: owner-sample.org-test
sample.org-test-request: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/sample.org/majordomo.cf -l test"
sample.org-test-digest-request: "|/usr/lib/majordomo/wrapper majordomo -C /var/lib/majordomo/sample.org/majordomo.cf -l test-digest"
sample.org-test-approval: owner-sample.org-test
sample.org-test-digest-approval: owner-sample.org-test
# Don't forget to rebuild the aliases database by executing
a. /usr/sbin/sendmail -bi
or
b. newaliases
As "root"
5. vi /etc/mail/virtusertable
#whitespace between columns must contain at least one tab character.
#addresses for primary mydomain.com do not need to be listed here.
#virtual test list for example.net
majordomo@example.net example.net-majordomo
owner-majordomo@example.net owner-example.net-majordomo
majordomo-owner@example.net example.net-majordomo-owner
test@example.net example.net-test
owner-test@example.net owner-example.net-test
test-owner@example.net example.net-test-owner
test-request@example.net example.net-test-request
test-approval@example.net example.net-test-approval
test-digest@example.net example.net-test-digest
owner-test-digest@example.net owner-example.net-test-digest
test-digest-owner@example.net example.net-test-digest-owner
test-digest-request@example.net example.net-test-digest-request
test-digest-approval@example.net example.net-test-digest-approval
#additional lists for example.net inserted /\above/\ this line
#catchall for all other example.net addresses so they do not
#accidentally go to the same name at mydomain.com \/below\/
@example.net error:nouser User unknown
#virtual test list for sample.com
majordomo@sample.org sample.org-majordomo
owner-majordomo@sample.org owner-sample.org-majordomo
majordomo-owner@sample.org sample.org-majordomo-owner
test@sample.org sample.org-test
owner-test@sample.org owner-sample.org-test
test-owner@sample.org sample.org-test-owner
test-request@sample.org sample.org-test-request
test-approval@sample.org sample.org-test-approval
test-digest@sample.org sample.org-test-digest
owner-test-digest@sample.orgm owner-sample.org-test-digest
test-digest-owner@sample.org sample.org-test-digest-owner
test-digest-request@sample.org sample.org-test-digest-request
test-digest-approval@sample.org sample.org-test-digest-approval
#additional lists for sample.org inserted ^above^ this line
#catchall for all other sample.org addresses so they do not
#accidentally go to the same name at mydomain.com v-below-v
@sample.org error:nouser User unknown
#the following is added so spammers cannot easily get to my lists
test-outgoing@mydomain.com error:nouser User unknown
test-outgoing@localhost error:nouser User unknown
test-outgoing@example.net error:nouser User unknown
test-outgoing@sample.org error:nouser User unknown
a. If you are not already there, cd /etc/mail
and
b. /usr/sbin/makemap hash virtusertable < virtusertable
or
c. /usr/sbin/makemap dbm virtusertable < virtusertable
or possibly, depending on your "Makefile"
d. make all
V. Mail can now travel in and out of your lists from the internet. The test owners for each domain still need to configure their lists.
1. mailto:majordomo@mydomain.com?body=config%20test%20test.admin
a. When the "majordomo results" get mailed to you, edit the config file to change the admin_passwd, and other settings regarding
security, moderation, policies, etc. Make sure you do not change/cause any line wrapping during your edits.
b. Send the modified config file back with a newconfig command.
Make sure your email client does not line wrap when sending your config file back to majordomo or you will get errors.
c. Use the newintro and newinfo commands for your list.
2. The owner of test@example.net does the same steps 1, 1a, 1b, 1c replacing mydomain.com with example.net.
3. The owner of test@sample.org does the same steps 1, 1a, 1b, 1c replacing mydomain.com with sample.org.
Of course, if the list will NOT be archived or a digest version made available, the applicable virtusertable and aliases file
entries can be skipped or commented out. The test.config files should make use of the "resend_host = applicable-domain" rather than
using -h on the alias's resend line. A test-post file is not necessary, but available if the owner should decide their list is an
announcement only type list, in which case the restrict_post = test-post setting should be used. If test-post is used, it can also
be configured remoted via email commands, but does not require any entries in an aliases file. And finally, if the passwd command
is expected to actually change the admin password for the list, the admin_passwd = should be left blank in the test.config file.
Separate aliases files can be used for each domain, but must be preconfigured in sendmail.cf, and still follow the same format as if
there were only one aliases file.
Hint for archiving:
Use the capital letter switches for Daily, Monthly, and Yearly archiving, so your filenames will have y2k compliant 4-digit years.
See my recent post on Archive/Digest HOW-TO for a patch to archive2.pl if your version's file suffix stamp is off by 100 yrs.
Hint for digests:
If you want a periodic digest vs. a digest based on size or lines, and you do not want to wait for the next message to come in after
this period to trigger the digest, you will need a crontab entry. This entry should NOT be owned or ran by, root or majordomo, and
does not need to reside on the same host as majordomo. It may be preferable to use this cron from an alternate host so a fully
qualified email address would be present for majordomo replies.
SHELL=/bin/sh
MAILTO=""
# +---------- minute 0-59
# | +-------- hour 0-23
# | | +------ day 1-31
# | | | +---- month 1-12 or 3 letter month
# | | | | +-- weekday 0-7 or 3 letter day (0=Sun)
# | | | | | + here to % or EOL is field 6 for commands
59 23 * * * echo mkdigest listname listname-digest.passwd | mail majordomo@whatever.domain
The above cron sends out the digest every day at 11:59PM and assumes your -outgoing alias is listname-digest-outgoing. If you do
not use the -outgoing address for your delivery alias, the last line of cron would look like this;
59 23 * * * echo mkdigest listname listname-digest-delivery listname-digest.passwd | mail majordomo@whatever.domain
If your majordomo does live on the same host as this cron job, you will also have to ensure that short names are accepted by
majordomo, or that the mail command appends your domain to your username before it is seen by majordomo. Version 1.94.4 does not
have this limitation, but 1.94.5 does. You might also be able to replace the mail command with "sendmail -f user@domain.com" if the
cron belongs to a trusted user in the sendmail.cf file or sendmail.ct file. In most recent versions of sendmail, the filename is now
/etc/mail/trusted-users.
Another note on digests:
If you do use cron, be sure your maxlength, digest_maxdays, and digest_maxlines are set high enough to allow your cron to execute
before majordomo tries to do the job itself.
Hint for modifying sendmail files and majordomo directories to support virtual mailing lists:
Download, extract, read, possibly modify, and execute my interactive perl script at
ftp://ftp.ccsf.org/majordomo-contrib/listadd.pl.gz (formerly newlist3.pl)
Dan Liston
PS. If anyone finds discrepancies in this recipe, please send me your comments via this mailing list at
majordomo-users@greatcircle.com, and I will make changes or incorporate suggestions before reposting this again the next time
someone asks about virtual hosting of lists. The same goes for use of the perl script for creating new lists too.
POSTFIX:
For postfix users, do not forget to execute `postalias aliases.database` and `postfix reload`, then this goes in your main.cf:
allow_mail_to_files = include
References to /etc/mail/virtusertable may be /etc/postfix/virtual and use the same format above.
# DELIVERED-TO
#
# The prepend_delivered_header controls when Postfix should prepend
# a Delivered-To: message header.
#
# By default, Postfix prepends a Delivered-To: header when forwarding
# mail and when delivering to file (mailbox) and command. Turning off
# the Delivered-To: header when forwarding mail is not recommended.
#
# prepend_delivered_header = command, file, forward
# prepend_delivered_header = forward
Please use the latter form of "prepend_delivered_header = forward" to prevent breaking the approve command in majordomo.
To make up for removing the "Delivered-To:" header via postfix by making the change above, you can add it back in via the config
file for each list's message_header section, or automate this by modifying the config_parse.pl script.
/^Delivered-To: $LIST/
EXIM:
For exim users, this goes in /etc/exim/exim.conf:
#near the top
trusted_users = exim:majordomo
#after system_aliases director and before local_users director
majordomo_aliases:
driver = aliasfile
pipe_transport = address_pipe
file = /etc/aliases
search_type = lsearch
user = majordomo
group = majordomo
suffix = "+*"
suffix_optional
Rob wrote:
> Hi,
>
> Let me first state that I have no experience with majordomo or other
> mailinglists, so I may be doing something wrong...
>
> Having that said... I think I found a bug....
>
> I just set up my first mailinglist (using Majordomo 1.94.5).
> I have more then 1 domain on my server, so I used the virtual hosting example
> from the faq.
>
> The list is list@example.com, and the line in virtusertable is
> list@example.com example_com_list
>
> After setting it up, I typed 'echo "lists" | mail majordomo@example.com' to
> generate list.config. This worked, so I edited it to my taste.
>
> But after sending a test message to the list (or after succesful subscription,
> I didn't check), majordomo created a new .config file named
> example_com_list.config (so it used the alias name in stead of the list
> name).
> Some variables (like admin_passwd) are now taken from list.config, and others
> (like reply_to) are taken from example_com_list.config.
>
> I'm sorry I just dump this here, but at this moment I really don't have time
> to get into the code to provide a solution.
> Mail me if you need more info.
>
> TIA
> Rob
>
|
|