exim4:enable_smtp-auth
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exim4:enable_smtp-auth [2016/11/06 19:36] – created peter | exim4:enable_smtp-auth [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Exim4 - Enable SMTP-Auth ====== | ====== Exim4 - Enable SMTP-Auth ====== | ||
- | Within the /etc/exim4 directory run: | + | ===== Generate an Exim SSL certificate ===== |
+ | |||
+ | Exim provides a script for this. Either run: | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | or create a certificate manually. | ||
<code bash> | <code bash> | ||
Line 31: | Line 39: | ||
</ | </ | ||
+ | This will create an **exim.key** and **exim.crt** file in /etc/exim. | ||
+ | |||
+ | |||
+ | ===== Enable the basic SMTP-Auth in the Exim config file ===== | ||
+ | |||
+ | Uncomment the following lines. | ||
+ | |||
+ | <file bash / | ||
+ | # plain_server: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | and | ||
+ | |||
+ | <file bash / | ||
+ | login_server: | ||
+ | driver = plaintext | ||
+ | public_name = LOGIN | ||
+ | server_prompts = " | ||
+ | server_condition = "${if crypteq{$auth2}{${extract{1}{: | ||
+ | server_set_id = $auth1 | ||
+ | .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS | ||
+ | server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}} | ||
+ | .endif | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== saslauthd Authentication ===== | ||
+ | |||
+ | You need to configure Exim4 to use the saslauthd for authentication. | ||
+ | |||
+ | <file bash / | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # don't send system passwords over unencrypted connections | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Configuring SASL ===== | ||
+ | |||
+ | This section provides details on configuring the saslauthd to provide authentication for Exim4. | ||
+ | |||
+ | Install the sasl2-bin package. | ||
+ | |||
+ | <code bash> | ||
+ | apt-get install sasl2-bin | ||
+ | </ | ||
+ | |||
+ | To configure saslauthd edit the / | ||
+ | |||
+ | <file bash / | ||
+ | START=yes | ||
+ | </ | ||
+ | |||
+ | Next the Debian-exim user needs to be part of the sasl group in order for Exim4 to use the saslauthd service: | ||
+ | |||
+ | <code bash> | ||
+ | sudo adduser Debian-exim sasl | ||
+ | </ | ||
+ | |||
+ | Now start the saslauthd service: | ||
+ | |||
+ | <code bash> | ||
+ | sudo / | ||
+ | </ | ||
+ | |||
+ | Exim4 is now configured with SMTP AUTH using TLS and SASL authentication. | ||
+ | |||
+ | |||
+ | ===== Enable TLS ===== | ||
+ | |||
+ | Create (or edit if it exists) / | ||
+ | |||
+ | Add the line: | ||
+ | |||
+ | <file bash / | ||
+ | MAIN_TLS_ENABLE = true | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Setup the users and passwords ===== | ||
+ | |||
+ | Users and their passwords are held within the **/ | ||
+ | |||
+ | < | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | |||
+ | Create **/ | ||
+ | |||
+ | Copy output from: | ||
+ | |||
+ | <code bash> | ||
+ | htpasswd -nd usernameforsmtp | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | <code bash> | ||
+ | mkpasswd -H md5 | ||
+ | </ | ||
+ | |||
+ | and paste it in / | ||
+ | |||
+ | Repeat for any other logins you'd like to add. | ||
+ | |||
+ | |||
+ | ==== Set the permissions and ownership ==== | ||
+ | |||
+ | This file should have permissions set to 640 and have ownership of root: | ||
+ | |||
+ | <code bash> | ||
+ | chmod 640 / | ||
+ | Chown root: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Update your configuration and Restart Exim4 ===== | ||
+ | |||
+ | <code bash> | ||
+ | update-exim4.conf | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== An SMTP AUTH session ===== | ||
+ | |||
+ | <code bash> | ||
+ | 220-mail.xxxxxxxx.com ESMTP Exim 4.34 #1 Wed, 23 Jun 2004 17:35:13 -0700 | ||
+ | EHLO mail.myserver.com | ||
+ | 250-mail.xxxxxxxx.com Hello mail.myserver.com [192.168.0.156] | ||
+ | 250-SIZE 52428800 | ||
+ | 250-PIPELINING | ||
+ | 250-AUTH PLAIN LOGIN | ||
+ | 250-STARTTLS | ||
+ | 250 HELP | ||
+ | AUTH LOGIN | ||
+ | 334 VXNlcm5hbWU6 | ||
+ | bXl1c2VybmFtZQ== | ||
+ | 334 UGFzc3dvcmQ6 | ||
+ | bXlwYXNzd29yZA== | ||
+ | 235 Authentication succeeded | ||
+ | </ | ||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | / | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// |
exim4/enable_smtp-auth.1478461014.txt.gz · Last modified: 2020/07/15 09:30 (external edit)