# Decoupling mail and web services

**URL:** <https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750>\
**Category:** Blue Skies\
**Created:** [February 1, 2016, 3:33pm UTC](https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750 "2016-02-01T15:33:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuerst](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/fuerst/32/86_2.png) [@fuerst](https://forum.virtualmin.com/u/fuerst)\
**Post date:** [February 1, 2016, 3:33pm UTC](https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750/1 "2016-02-01T15:33:34Z")

</div>

After hassled one more time with hacked Wordpress installations used to mass send Spam mails I think about using different servers for web and mail services. This is to avoid having the combined web/mail server blacklisted at CBL et al. Running Virtualmin I think that can be done this way - described earlier hier [https://www.virtualmin.com/node/37931:](https://www.virtualmin.com/node/37931:)

I saw the idea to decouple mail services from web and others is [nearly 10 years old](https://www.virtualmin.com/node/800). Me [asking this 8 years ago](https://www.virtualmin.com/node/8477) too. Time to move forward I guess 🙂

My proposal to achieve this - assuming two machines:

- First server (_web_): Web, DNS, Virtualmin, etc.
- Second server (_mail_): Postfix, Dovecot, Spamassassin, ClamAV.
- Sync user records using NIS from _web_ to _mail_.
- Mount user directories from _web_ using NFS at _mail_.
- Let syslog at _mail_ send logs to _web_.
- Virtualmin on _web_ needs NFS access to _mail:/etc_ for configuring mail related services. Easier: mount _mail:/etc/{postfix,dovecot,spamassassin,clamav}_ by NFS at _mail:/etc_. This way Virtualmin can write configuration where it is used to write.
- Avoid starting postfix et all at _web_.
- Virtualmin’s Install script needs to allow installing all, or _web_ stuff only or _mail_ stuff only.

As an alternative to the ideas above: Much easier to be implemented is to have Postfix listen and/or sending at a second IP address. May be that will just do the trick of decoupling. [smtp\_bind\_address](http://www.postfix.org/postconf.5.html#smtp_bind_address) and/or [inet\_interfaces](http://www.postfix.org/postconf.5.html#inet_interfaces) are appropriate Postfix configuration candidates.

---

<div class="post-metadata">

**Author:** ![Eric](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@Eric](https://forum.virtualmin.com/u/Eric)\
**Post date:** [February 1, 2016, 3:51pm UTC](https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750/2 "2016-02-01T15:51:44Z")

</div>

Howdy,

A couple of other ideas for dealing with web app breakins –

One, you could always setup sender dependent IP addresses for sending email. Doing that is described here:

[https://www.virtualmin.com/documentation/email/dependent](https://www.virtualmin.com/documentation/email/dependent)

Two, there’s an option within Virtualmin’s “Email Addresses” section for setting up email rate limiting. That can be used to automatically stop outgoing email if a flood of spam is discovered.

-Eric

---

<div class="post-metadata">

**Author:** ![fuerst](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/fuerst/32/86_2.png) [@fuerst](https://forum.virtualmin.com/u/fuerst)\
**Post date:** [February 1, 2016, 4:10pm UTC](https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750/3 "2016-02-01T16:10:11Z")

</div>

Thanks so far! Sender dependent IP addresses sounds good although I rather think of a general way. So I guess setting _smtp\_bind\_address_ in _/etc/postfix/main.cf_ is the way.

I enabled mail rate limiting now but have to figure out how to limit per domain without configuring every domain manually.  
I also had to configure it for use wit Postfix in _/etc/milter-greylist/greylist.conf_. It was set for Sendmail here.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [April 30, 2020, 6:17am UTC](https://forum.virtualmin.com/t/decoupling-mail-and-web-services/52750/4 "2020-04-30T06:17:55Z")

</div>

Closed on April 30, 2020, 6:17am UTC


