Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

two qmail instances running on the same box, at the same time

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


anderson at brasilenergia

Sep 11, 2007, 2:13 PM

Post #1 of 7 (3692 views)
Permalink
two qmail instances running on the same box, at the same time

Hi all,

I have a running qmail instance serving as my primary MX server (gw.brasilenergia.com.br). at the very same box, I would like to have another qmail instance running, with an exclusive, unique queue and port (say, 2255, for example). This second qmail instance would be used for a lot of internal things, specially to be used by corporation systems and applications being developed indoor atm.

what I would like to know is the proper way to set this second qmail instance up and running. I did copied the whole /var/qmail tree to a new /var/qmail2 tree, with the same user/group permissions, edited my /var/qmail2/rc script to reflect the changes, as well as the /var/qmail2/bin/qmail-scanner-queue.pl script and the /var/qmail/supervise/*/run scripts (including the ones for the logs, which will be saved at /var/log/qmail2/*). Inside the /var/qmail2/supervise/qmail-smtpd/run I also changed the port value and used a different cdb file for separate tcp rules.

After doing the above mentioned changes, I edited my /etc/init.d/qmaild script so it would also start/stop the svscan for the /var/qmail2/supervise files as well. When I tested, things seemed to work, but the qmail-send process of the first qmail instance (the one at /var/qmail) does not seems to work that fine, as it remains as <defunct> in my process list.

What am I missing? is there a better approach to make this work flawless?

Another thing I'd like to know, after both qmail instances are running, how can I bind the qmail-remote of the second instance to only deliver mails through one specific IP (my box has several IPs on the same interface, but I'd like to make the second instance of qmail to only send mails through a specific IP).

So, am I making this way too complex or is it no big deal at all?...
Thanks in advance for your replies.

Regards,
asm


hugo.monteiro at fct

Sep 11, 2007, 3:36 PM

Post #2 of 7 (3568 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

Anderson Miranda wrote:
> Hi all,
>
> I have a running qmail instance serving as my primary MX server
> (gw.brasilenergia.com.br). at the very same box, I would like to have
> another qmail instance running, with an exclusive, unique queue and
> port (say, 2255, for example). This second qmail instance would be
> used for a lot of internal things, specially to be used by corporation
> systems and applications being developed indoor atm.
>
> what I would like to know is the proper way to set this second qmail
> instance up and running. I did copied the whole /var/qmail tree to a
> new /var/qmail2 tree, with the same user/group permissions, edited my
> /var/qmail2/rc script to reflect the changes, as well as the
> /var/qmail2/bin/qmail-scanner-queue.pl script and the
> /var/qmail/supervise/*/run scripts (including the ones for the logs,
> which will be saved at /var/log/qmail2/*). Inside the
> /var/qmail2/supervise/qmail-smtpd/run I also changed the port value
> and used a different cdb file for separate tcp rules.
>
> After doing the above mentioned changes, I edited my
> /etc/init.d/qmaild script so it would also start/stop the svscan for
> the /var/qmail2/supervise files as well. When I tested, things seemed
> to work, but the qmail-send process of the first qmail instance (the
> one at /var/qmail) does not seems to work that fine, as it remains as
> <defunct> in my process list.
>
> What am I missing? is there a better approach to make this work flawless?
>
> Another thing I'd like to know, after both qmail instances are
> running, how can I bind the qmail-remote of the second instance to
> only deliver mails through one specific IP (my box has several IPs on
> the same interface, but I'd like to make the second instance of qmail
> to only send mails through a specific IP).
>
> So, am I making this way too complex or is it no big deal at all?...
> Thanks in advance for your replies.
>
> Regards,
> asm

Assuming you do want a completely separate new qmail instance, you need
to recompile qmail. It's work dir (home) is hardcoded uppon compilation.
You just need to edit the conf-qmail in the qmail source dir, change the
first line to whatever new qmail installation point you wish, rebuild
and install like the first time.

Regards,

Hugo Monteiro.

--
ci.fct.unl.pt:~# cat .signature

Hugo Monteiro
Email : hugo.monteiro [at] fct
Telefone : +351 212948300 Ext.15307

Centro de Informática
Faculdade de Ciências e Tecnologia da
Universidade Nova de Lisboa
Quinta da Torre 2829-516 Caparica Portugal
Telefone: +351 212948596 Fax: +351 212948548
www.ci.fct.unl.pt apoio [at] fct

ci.fct.unl.pt:~# _


kyle-qmail at memoryhole

Sep 11, 2007, 4:55 PM

Post #3 of 7 (3602 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

> I did copied the whole /var/qmail tree to a new /var/qmail2 tree,

That was your first mistake.

qmail contains the full paths of its own binaries compiled into
itself. This is generally considered a security feature.

You need to make a copy of your qmail source, edit conf-qmail to
specify /var/qmail2, recompile, and do a make setup check. Then you
can copy over your config files.

> the /var/qmail2/supervise files as well. When I tested, things
> seemed to work, but the qmail-send process of the first qmail
> instance (the one at /var/qmail) does not seems to work that fine,
> as it remains as <defunct> in my process list.

Because both qmail-send instances are fighting for control over the
same queue (/var/qmail/queue), because you needed to recompile your
second qmail installation.

> What am I missing? is there a better approach to make this work
> flawless?

It's probably worth pointing you that you don't have to have a
separate queue just to get qmail to listen on a second port.

> Another thing I'd like to know, after both qmail instances are
> running, how can I bind the qmail-remote of the second instance to
> only deliver mails through one specific IP (my box has several IPs
> on the same interface, but I'd like to make the second instance of
> qmail to only send mails through a specific IP).

You'll want to apply the outboundip patch:
http://www.memoryhole.net/qmail/#outgoingip

> So, am I making this way too complex or is it no big deal at all?...
> Thanks in advance for your replies.

Unless you *need* the separation, you're probably duplicating too
much, but otherwise, it sounds like you've mostly got the right idea.

~Kyle
--
Science has proof without any certainty. Creationists have certainty
without any proof.
-- Ashley Montague


anderson at brasilenergia

Sep 12, 2007, 10:37 AM

Post #4 of 7 (3588 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

Thanks Kyle and Hugo for the quick reply!

I was about to recompile it already. But, if I set a new
/var/qmail/supervise/qmail-smtpd/* as something like
/var/qmail/supervise/qmail-smtpd2/*, logging the second one to a separate
log file and setting it to listen to another port other than 25, does it
make my qmail instance to listen to a second port without causing any
concurrency problems?

Also, thanks for pointing out the outboundip patch, that is just what I am
looking for, indeed.

Once again, TYVM.

Regards,
asm

----- Original Message -----
From: "Kyle Wheeler" <kyle-qmail [at] memoryhole>
To: <qmail [at] list>
Sent: Tuesday, September 11, 2007 8:55 PM
Subject: Re: two qmail instances running on the same box, at the same time


kyle-qmail at memoryhole

Sep 12, 2007, 12:30 PM

Post #5 of 7 (3580 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

On Wednesday, September 12 at 02:37 PM, quoth Anderson Miranda:
> I was about to recompile it already. But, if I set a new
> /var/qmail/supervise/qmail-smtpd/* as something like
> /var/qmail/supervise/qmail-smtpd2/*, logging the second one to a
> separate log file and setting it to listen to another port other
> than 25, does it make my qmail instance to listen to a second port
> without causing any concurrency problems?

Yes, exactly.

> Also, thanks for pointing out the outboundip patch, that is just
> what I am looking for, indeed.

Happy to help.

~Kyle
--
Die for the person who will catch a cold for you.
-- Persian saying


GMANE at faerber

Sep 13, 2007, 6:26 AM

Post #6 of 7 (3592 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

Hugo Monteiro <hugo.monteiro [at] fct> schrieb/wrote:
> Assuming you do want a completely separate new qmail instance, you
> need to recompile qmail. It's work dir (home) is hardcoded uppon
> compilation. You just need to edit the conf-qmail in the qmail source
> dir, change the first line to whatever new qmail installation point
> you wish, rebuild and install like the first time.

Another solution would be chroot or another os-level virtualization
(jail, vserver, ...). The later could also do network/IP address
isolation.

Claus


tim at icukhosting

Sep 13, 2007, 3:09 PM

Post #7 of 7 (3590 views)
Permalink
Re: two qmail instances running on the same box, at the same time [In reply to]

Claus Färber wrote:
> Another solution would be chroot or another os-level virtualization
> (jail, vserver, ...). The later could also do network/IP address
> isolation.

We've had some really good results using plain chroots to run multiple
qmails on single boxes, using the outgoingip patch. We generally have up
to four chroots per box: one for local delivery and primary MX, another
for remote with SMTP auth only, a third for webmail, and on some
machines, a fourth for smarthosting from web servers. On the high end
quad-xeon machines it made sense to run it this way, instead of having a
single machine for each purpose. It also makes it very easy when
provisioning new machines, as the prebuilt chroots only need to have
their listening/outgoing IP addresses updated.

On the really high priority, low load (~5000 messages per day) machines
we have a similar setup, but for redundancy we have two identical
servers in an active/passive config, using DRBD to replicate the queues
and Maildirs between servers (effectively network RAID 0), and heartbeat
to manage the failover. The software in each chroot uses a floating IP
managed by heartbeat that floats between servers during failover.
Typically we see downtimes of 10-30secs during manual failover, and
60-120 secs during automatic. Really amazing technologies.


Tim

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.