Subject: The mailing list for listmasters using Sympa
List archive
- From: Rance Hall <address@concealed>
- To: address@concealed
- Subject: [sympa-users] Help with sympa script
- Date: Mon, 23 Sep 2013 13:39:41 -0500
Back in August I sent a message to this list with some questions about a sympa server I inherited.
The server uses virtual domains.
Attached please find the script that the previous admin wrote to create new virtual domains.
This script is broken.
We found an error and fixed it reference the difference between user input $1 and the text value $1 which is needed in virtual domain setup.
We get the following error message when messages are sent with domains created by this script.
*******************************
Impossible to distribute your message for the following reason:
List '{virtualdomainlist}+owner' does not exist.
For further information, please contact listmaster@lists.{virtualdomain}
********************************
Ive tried walking through the documentation with this script and I'm missing something.
I should warn you that I can be a little dyslexic at times so I may have missed something easy.
Can you take a look at this script and see what issues it may have.
I see one already. It doesn't check to make sure you entered a domain with the prefix "lists" before adding it on. This creates a virtual domain of lists.lists.domain.org.
--
Rance Hall
Linux System Administrator
ESU10 - GNENC
address@concealed
Office: 308-698-1919 or 308-237-5927 ext. 319
The flag doesn't fly because wind blows it.
It flies with the last breath of each soldier
who died protecting it.
#!/bin/bash
# This script automatically modifies
# and generates the files necessary
# to create a new Sympa domain
# Author: Drew A. Blessing
# Date: November 2011
# Exit on error
set -e
# Check args
if [ "$#" -ne 1 ]; then
echo "1 argument required, $# provided. Argument must be domain name"
exit
fi
# Escaped domain
T1=`echo $1 | sed 's/\./\\\./g'`
# Create apache2 virtual host
if [ `grep -ic "lists.$1" /etc/apache2/sites-available/sympa-domains` = 0 ];
then
# Do append
echo "
# lists.$1
<VirtualHost *:80>
ServerName lists.$1
ServerAdmin admin@$1
DocumentRoot /var/www/sympa
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
SuexecUserGroup sympa sympa
Alias /wwsicons /home/sympa/static_content/icons
Alias /wws /var/www/_sympa_/wwsympa.fcgi
Alias /static-sympa /home/sympa/static_content
</VirtualHost>" >> /etc/apache2/sites-available/sympa-domains
# echo Added domain to /etc/apache2/sites-available/sympa-domains
else
echo Found domain in /etc/apache2/sites-available/sympa-domains.
Cannot continue
echo Error 1
exit 1
fi
# Add relay domain
if [ `grep -ic "lists.$1" /etc/postfix/main.cf` = 0 ]; then
`sed -i "/^relay_domains =/ s/\$/, lists.$1/" /etc/postfix/main.cf`
# echo Added domain to /etc/postfix/main.cf
else
echo Found domain in /etc/postfix/main.cf. Cannot continue
echo Error 2
exit 2
fi
# Create home directory
`su sympa -c "mkdir /home/sympa/etc/lists.$1"`
# Create robot file
`su sympa -c "cp /home/sympa/etc/lists.gnenc.org/robot.conf
/home/sympa/etc/lists.$1"`
`sed -i "s/lists.gnenc.org/lists.$1/g" /home/sympa/etc/lists.$1/robot.conf`
# Create list data directory
`su sympa -c "mkdir /home/sympa/list_data/lists.$1"`
# Add transport regexp
if [ `grep -ic "lists.$1" /etc/mail/transport_regexp` = 0 ]; then
echo "
# lists.$1
/^.*-owner\@lists\.$T1$/ sympabounce:
/^.*\@lists\.$T1$/ sympa:" >> /etc/mail/transport_regexp
# echo Added transport regex to /etc/mail/transport_regexp
else
echo Found domain in transport regex. Cannot continue
echo Error 3
exit 3
fi
# Add virtual regex
if [ `grep -ic "lists.$1" /etc/mail/virtual_regexp` = 0 ]; then
echo "
# lists.$1
/^(.*)-owner\@lists\.$T1$/ \$1+owner@lists.$1" >> /etc/mail/virtual_regexp
# echo Added transport regex to /etc/mail/virtual_regexp
else
echo Found domain in virtual regexp. Cannot continue
echo Error 4
exit 4
fi
# Run postalias and postmaps
`postalias /etc/mail/sympa_aliases`
`postmap /etc/mail/virtual_regexp`
`postmap /etc/mail/transport_regexp`
`newaliases`
# Restart services
echo Domain successfully created
echo Please restart apache2, sympa, and postfix to complete the process.
echo Also, be sure to add listmasters in robots.conf if necessary
- [sympa-users] Help with sympa script, Rance Hall, 09/23/2013
Archive powered by MHonArc 2.6.19+.