# Use CipherMail Appliance as encrypt decrypt gateway with mailserver

**URL:** <https://community.ciphermail.com/t/use-ciphermail-appliance-as-encrypt-decrypt-gateway-with-mailserver/796>\
**Category:** Gateway\
**Tags:** mailcow\
**Created:** [December 16, 2022, 9:48am UTC](https://community.ciphermail.com/t/use-ciphermail-appliance-as-encrypt-decrypt-gateway-with-mailserver/796 "2022-12-16T09:48:12Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![martijn](https://dub1.discourse-cdn.com/flex017/user_avatar/community.ciphermail.com/martijn/32/127_2.png) [@martijn](https://community.ciphermail.com/u/martijn)\
**Post date:** [December 19, 2022, 9:05am UTC](https://community.ciphermail.com/t/use-ciphermail-appliance-as-encrypt-decrypt-gateway-with-mailserver/796/6 "2022-12-19T09:05:45Z")

</div>

You forgot to add a couple of important Postfix settings on the Mailcow server:

In **main.cf** :

`content_filter = smtp:[172.30.30.231]:25`

This tells Postfix on the Mailcow server to forward all incoming email to CipherMail on _172.30.30.231_.

The CipherMail appliance should allow relaying from the Mailcow IP address (i.e., add _172.30.30.230_ to `My networks`)

The CipherMail gateway will receive every email from Mailcow and do it’s thing (encrypt, decrypt etc.). After handling, the email should be sent back to Mailcow for further delivery.

If the CipherMail gateway would send the email back to Mailcow on port 25 the email will be sent back again to the CipherMail gateway, resulting in a mail loop.

You therefore need to add a ‘reinjection’ port configuration to the Postfix configuration of Mailcow which disables sending the email to CipherMail.

Add the following reinjection port on the Mailcow server ( **master.cf** )

```auto
# injection port for mail handled by the back-end
:10026 inet n - - - 10 smtpd
            -o content_filter= 
            -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters
            -o smtpd_helo_restrictions=
            -o smtpd_client_restrictions=
            -o smtpd_sender_restrictions=
            -o smtpd_recipient_restrictions=permit_mynetworks,reject
            -o mynetworks=172.30.30.231/32

```

After changing **master.cf** , you need to restart Postfix.

There should now be an extra SMTP daemon listening on port 10026.

You should now configure the CipherMail appliance to send all email to Mailcow on port 10026, i.e., set _Internal relay host_ and _External relay host_ to _172.30.30.230_.

**Note** : I have not tested the above setup but in principle this should work. The Postfix config files provided by the CipherMail appliance contain some additional settings which are strictly not required.

---

_[View the full topic](https://community.ciphermail.com/t/use-ciphermail-appliance-as-encrypt-decrypt-gateway-with-mailserver/796)._
