Your message dated Thu, 12 Apr 2012 21:10:16 -0600
with message-id <[email protected]>
and subject line Re: Bug#317018: postfix and virtual develery with mysql
has caused the Debian Bug report #317018,
regarding postfix and virtual delivery with mysql
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
317018: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=317018
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: postfix
Severity: important
Tags: patch
I have a suggestion to a patch for the rc-init.d script for postfix in
Sarge. Patch at the end of this email.
The patch solves the problem when you have enabled virtual delivery in
postfix thru an external source like a database or ldap and postfix runs
in chroot mode, which is the default configuration in Sarge. The problem
is that you in this situation will have to create a hardlink from the
external sources socket into the jail but at this moment this is not
done automatically which means you have to do this by hand after the
server has started. On several occasions I have restarted the server but
forgotten this which led to a stalled mail delivery system until I did
it. To prevent this situation in happening again I have made this patch
for the init script. At present it only handles mysql, which I use, but
could be easily extended to postgresql and openldap.
One requirement though is that the start order of postfix and the
external source is important so to make sure postfix starts after the
external sources it's start order should be 21 instead of 20.
--- postfix 2005-06-24 23:53:03.800662433 +0200
+++ postfix-2.1.5-sarge 2005-06-24 23:51:40.296970844 +0200
@@ -18,6 +18,11 @@
test -x $DAEMON && test -f /etc/postfix/main.cf || exit 0
+virtual=$(postconf -h virtual_alias_maps | cut -d: -f1)
+if [ "$virtual" = $(postconf -h virtual_alias_maps) ]; then
+ virtual=""
+fi
+
case "$1" in
start)
echo -n "Starting mail transport agent: Postfix"
@@ -39,6 +44,23 @@
chmod a+r etc/passwd
fi
fi
+ # Handle virtual delivery of mails
+ if ["$virtual" ]; then
+ case "$virtual" in
+ mysql)
+ # Make a hard link from mysqld.sock to jail
+ if [ ! -d var/run/mysqld]; then
+ mkdir -p var/run/mysqld
+ else
+ rm -f var/run/mysqld/mysqld.sock
+ fi
+ ln /var/run/mysqld/mysqld.sock var/run/mysqld
+ ;;
+ *)
+ echo "Cannot handle this virtual table automatically.
You must handle it manually."
+ ;;
+ esac
+ fi
FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
etc/nsswitch.conf"
for file in $FILES; do
@@ -63,6 +85,20 @@
${DAEMON} stop 2>&1 |
(grep -v 'stopping the Postfix' 1>&2 || /bin/true)
echo "."
+ if [ "$virtual" ]; then
+ cd $(postconf -h queue_directory)
+ case "$virtual" in
+ mysql)
+ # Remove the hard link to mysqld.sock in jail
+ if [ -d var/run/mysqld ]; then
+ rm -f var/run/mysqld/mysqld.sock
+ fi
+ ;;
+ *)
+ echo "Unknown virtual mail handling. You must remove it
manually."
+ ;;
+ esac
+ fi
;;
restart)
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=en_DK, LC_CTYPE=en_DK (charmap=ISO-8859-1)
--- postfix 2005-06-24 23:53:03.800662433 +0200
+++ postfix-2.1.5-sarge 2005-06-24 23:51:40.296970844 +0200
@@ -18,6 +18,11 @@
test -x $DAEMON && test -f /etc/postfix/main.cf || exit 0
+virtual=$(postconf -h virtual_alias_maps | cut -d: -f1)
+if [ "$virtual" = $(postconf -h virtual_alias_maps) ]; then
+ virtual=""
+fi
+
case "$1" in
start)
echo -n "Starting mail transport agent: Postfix"
@@ -39,6 +44,23 @@
chmod a+r etc/passwd
fi
fi
+ # Handle virtual delivery of mails
+ if [ "$virtual" ]; then
+ case "$virtual" in
+ mysql)
+ # Make a hard link from mysqld.sock to jail
+ if [ ! -d var/run/mysqld ]; then
+ mkdir -p var/run/mysqld
+ else
+ rm -f var/run/mysqld/mysqld.sock
+ fi
+ ln /var/run/mysqld/mysqld.sock var/run/mysqld
+ ;;
+ *)
+ echo "Cannot handle this virtual table automatically. You
must handle it manually."
+ ;;
+ esac
+ fi
FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
etc/nsswitch.conf"
for file in $FILES; do
@@ -63,6 +85,20 @@
${DAEMON} stop 2>&1 |
(grep -v 'stopping the Postfix' 1>&2 || /bin/true)
echo "."
+ if [ "$virtual" ]; then
+ cd $(postconf -h queue_directory)
+ case "$virtual" in
+ mysql)
+ # Remove the hard link to mysqld.sock in jail
+ if [ -d var/run/mysqld ]; then
+ rm -f var/run/mysqld/mysqld.sock
+ fi
+ ;;
+ *)
+ echo "Unknown virtual mail handling. You must remove it
manually."
+ ;;
+ esac
+ fi
;;
restart)
--- End Message ---
--- Begin Message ---
On Sat, Dec 09, 2006 at 07:32:32PM -0500, Andres Salomon wrote:
> Here's an updated way to do it. As it turns out, postfix doesn't appear
> to clear out /var/spool/postfix, so simply checking that var/run/mysqld
> exists is a bad way to test whether or not to bind mount the directory.
proxy:mysql:$mapname is the no-longer-new, correct way to get to the mysql map
outside the chroot.
lamont
--- End Message ---