Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information on how to use implicit TLS #26

Merged
merged 3 commits into from Mar 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 55 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2087,8 +2087,9 @@ You can use any Gmail account but I recommend you create one specific for this s
- `mail` configured to send e-mails from your server using [Gmail](https://mail.google.com/)

#### References

- https://php.quicoto.com/setup-exim4-to-use-gmail-in-ubuntu/
- https://wiki.debian.org/Exim
- https://wiki.debian.org/GmailAndExim4
- https://www.exim.org/exim-html-current/doc/html/spec_html/ch-encrypted_smtp_connections_using_tlsssl.html

#### Steps

Expand All @@ -2112,13 +2113,15 @@ You can use any Gmail account but I recommend you create one specific for this s
|Prompt|Answer|
|--:|--|
|General type of mail configuration|`mail sent by smarthost; no local mail`|
|System mail name|(default)|
|IP-addresses to listen on for incoming SMTP connections|`127.0.0.1`|
|System mail name|`Your FQDN or localhost`|
|IP-addresses to listen on for incoming SMTP connections|`127.0.0.1; ::1`|
|Other destinations for which mail is accepted|(default)|
|Visible domain name for local users|(default)|
|IP address or host name of the outgoing smarthost|`smtp.gmail.com::587`|
|Visible domain name for local users|`Your FQDN or localhost`|
|IP address or host name of the outgoing smarthost|`smtp.gmail.com::465`|
|Keep number of DNS-queries minimal (Dial-on-Demand)?|`No`|
|Split configuration into small files?|`No`|

If you prefer to use `STARTTLS`, then choose port `587`.

1. Make a backup of `/etc/exim4/passwd.client`:

Expand All @@ -2131,6 +2134,8 @@ You can use any Gmail account but I recommend you create one specific for this s
```
*.google.com:yourAccount@gmail.com:yourPassword
```

Always check `host smtp.gmail.com` for the most up-to-date domains to list.

Replace `yourAccount@gmail.com` and `yourPassword` with your details. If you have 2FA/MFA enabled on your Gmail then you'll need to create and use an app password.

Expand All @@ -2141,9 +2146,45 @@ You can use any Gmail account but I recommend you create one specific for this s
sudo chmod 640 /etc/exim4/passwd.client
```

1. The following instructions only apply if you choose implicit TLS (port 465) instead of `STARTTLS`. Skip to "restart `exim4`" if you are not using implicit TLS.

You need a TLS certificate. You can either use [Let's Encrypt](https://letsencrypt.org/), the `openssl` command or just let Exim generate it for you.

``` bash
sudo bash /usr/share/doc/exim4-base/examples/exim-gencert
```

1. Now instruct Exim4 to use TLS and port 465:

In `/etc/exim4/exim4.conf.localmacros`, add:

```
MAIN_TLS_ENABLE = 1
REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = *
TLS_ON_CONNECT_PORTS = 465
REQUIRE_PROTOCOL = smtps
```

In `/etc/exim4/exim4.conf.template`, CTRL+F for `REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS` and after the `ifdef` block add:

```
.ifdef REQUIRE_PROTOCOL
protocol = REQUIRE_PROTOCOL
.endif
```

CTRL+F for `MAIN_TLS_ENABLE` and inside the `ifdef` block add:

```
.ifdef TLS_ON_CONNECT_PORTS
tls_on_connect_ports = TLS_ON_CONNECT_PORTS
.endif
```

1. Restart `exim4`:

``` bash
sudo update-exim4.conf
sudo service exim4 restart
```

Expand All @@ -2157,6 +2198,13 @@ You can use any Gmail account but I recommend you create one specific for this s

You'll need to add all the local accounts that exist on your server.

1. Test your setup:

```
echo "test" | mail -s "Test" email@example.com
sudo tail /var/log/exim4/mainlog
```

([Table of Contents](#table-of-contents))

### Separate `iptables` Log File
Expand Down Expand Up @@ -2257,4 +2305,4 @@ For any questions, comments, concerns, feedback, or issues, submit a [new issue]

See [LICENSE](LICENSE.txt) for the full license.

([Table of Contents](#table-of-contents))
([Table of Contents](#table-of-contents))