Skip to content

Sysadmin papilusion exim4 14 06 2012

Yannouk edited this page Jul 5, 2012 · 1 revision

Session

  • user : root
  • host : papilusion.reverse.seizam.com
  • date : 06/14/12 15:46
  • curpath : /home/yannouk

Commands

  • Temporary fix locale bug
 [email protected]# export LC_ALL=en_GB.UTF-8
 [email protected]# apt-get update
 [email protected]# apt-get install exim4
 [email protected]# dpkg-reconfigure exim4-config
Please select the mail server configuration type that best meets your needs.
mail sent by smarthost; no local mail 

System mail name:
papilusion.seizam.com

IP-addresses to listen on for incoming SMTP connections: 
127.0.0.1 ; ::1

Other destinations for which mail is accepted: 
<blank>

Visible domain name for local users:
papilusion.seizam.com

IP address or host name of the outgoing smarthost:
smtp.gmail.com::587

Keep number of DNS-queries minimal (Dial-on-Demand)?
No

Split configuration into small files?
No
  • This command shows us how Exim4 handles email header with root debian user
 [email protected]# exim -brw root
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • Edit /etc/email-addresses, see [1]
 [email protected]# exim -brw root
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • Edit /etc/exim4/exim4.conf.template, see [2]
 [email protected]# update-exim4.conf
 [email protected]# exim -brw root
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • We also check for Apache2 debian user
 [email protected]# exim -brw www-data
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • Now check that emails destinated to addresses @seizam.com are not delivered to sysadmin.papilusion:
 [email protected]# exim -brw [email protected]
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • Ok, this configuration works fine. For information, a bad configuration would output:
 [email protected]# exim -brw [email protected]
  sender: [email protected]
    from: [email protected]
      to: [email protected]
      cc: [email protected]
     bcc: [email protected]
reply-to: [email protected]
env-from: [email protected]
  env-to: [email protected]
  • Now, set password
  • Edit /etc/exim4/passwd.client, see [3]
 [email protected]# update-exim4.conf
 [email protected]# /etc/init.d/exim4 restart
  • Force to process any mail queued (not necessary, but just in case)
 [email protected]# exim4 -qff
  • Try to send an email to root
 [email protected]# echo "final test is working :)" | mail -s "final test" root
 [email protected]# tail -f /var/log/exim4/mainlog
  • Last lines talk about the email just sent
2012-06-14 16:16:26 1SfAqY-00030S-SI <= [email protected] U=root P=local S=550
2012-06-14 16:16:27 1SfAqY-00030S-SI => [email protected] R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [173.194.67.108] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com"
2012-06-14 16:16:27 1SfAqY-00030S-SI Completed
Return-Path: <[email protected]>
Received: from papilusion.reverse.seizam.com (papilusion.reverse.seizam.com. [94.23.214.219])
        by mx.google.com with ESMTPS id d3sm20748319wiz.9.2012.06.14.07.14.43
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 14 Jun 2012 07:14:43 -0700 (PDT)
Received: from root by papilusion.reverse.seizam.com with local (Exim 4.72)
	(envelope-from <[email protected]>)
	id 1SfAqY-00030S-SI
	for [email protected]; Thu, 14 Jun 2012 16:16:26 +0200
Message-Id: <[email protected]>
Date: Thu, 14 Jun 2012 16:16:26 +0200
To: [email protected]
Subject: final test
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: root <[email protected]>

final test is working :)

Files

[1]\* Edit /etc/email-addresses

--- old	2012-06-14 15:54:33.000000000 +0200
+++ new	2012-06-14 15:55:23.000000000 +0200
@@ -9 +9,12 @@
 #otheruser: [email protected]
+root: [email protected]
+root@localhost: [email protected]
+root@papilusion: [email protected]
[email protected]: [email protected]
[email protected]: [email protected]
+www-data: [email protected]
+www-data@localhost: [email protected]
+www-data@papilusion: [email protected]
[email protected]: [email protected]
[email protected]: [email protected]

[2]\* Edit /etc/exim4/exim4.conf.template

--- old	2012-06-14 15:55:47.000000000 +0200
+++ new	2012-06-14 15:57:27.000000000 +0200
@@ -1747,2 +1747,3 @@
 
+*@papilusion.seizam.com [email protected] tcbT

[3]\* Edit /etc/exim4/passwd.client

--- old	2012-06-14 16:04:29.000000000 +0200
+++ new	2012-06-14 16:04:38.000000000 +0200
@@ -7 +7,2 @@
 ### target.mail.server.example:login:password
+*.google.com:[email protected]:THE_PASSWORD
Clone this wiki locally