Differences between revisions 1 and 2
Revision 1 as of 2013-06-04 05:51:40
Size: 2187
Editor: ?PetterReinholdtsen
Comment: Start on recipe. Still lots left.
Revision 2 as of 2013-06-04 06:51:24
Size: 3156
Editor: ?PetterReinholdtsen
Comment: A bit more on the recipe.
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
This recipe is based on Debian Edu Squeeze (6), and change the default mail server setup from using the Debian Edu configuration to using the default
exim4 configuration.
This recipe is based on Debian Edu Squeeze (6.0), and change the default mail server setup from using the Debian Edu configuration to using the default
exim4 configuration. The original setup is in /etc/exim4/exim-ldap-server-v4.conf, but it is easier to adjust the default exim4 setup than to edit the preloaded setup.

Setting this up consist of these steps:

 1. Prepare the default exim4 config to use LDAP for user information.
 1. Decide which DNS domain to use for public email (using example.com).
 1. Set up the exim4 configuration with the new DNS domain
 1. Change mail name for tjener to get valid addresses in outgoing email.
 1. Switch to generated contiguration instead of the Debian Edu provided configuration.
 1. Add port forwarding in the gateway, allowing connections from the outside for port 25 to make it to tjener.intern
 1. Update DNS, add MX entry for the selected DNS domain.
Line 8: Line 18:
Note
that root email is now delivered to /var/mail/mail, not /var/mail/root
Note that root email is now delivered to /var/mail/mail, not /var/mail/root
Line 13: Line 22:
diff --git a/exim4/conf.d/router/950_exim4_config_ldap_user
+b/exim4/conf.d/router/950_exim4_config_ldap_user
new file mode 100644
index 0000000..319af8d
--- /dev/null
+++ b/exim4/conf.d/router/950_exim4_config_ldap_user
@@ -0,0 +1,11 @@
+# LDAP Server info
+LDAPBASE = dc=skole,dc=skolelinux,dc=no
+LDAPSERVER = ldap.intern
+
+ldap_user:
+ debug_print = "R: ldap_user for $local_part@$domain"
+ driver = accept
+ condition = ${if eq {}{${lookup ldap
+{ldap://LDAPSERVER/LDAPBASE?uid?sub?(uid=${local_part})}}}{no}{yes}}
+ cannot_route_message = Recipent ${local_part} unknown.
+ retry_use_local_part
+ transport = LOCAL_DELIVERY
== Prepare the default exim4 config to use LDAP for user information. ==

This step add a config fragment to the generated exim4 configuration, telling exim to look up users in the Skolelinux/Debian Edu LDAP directory. It was partly based on the setup found in http://edin.no-ip.com/blog/hswong3i/exim4-ldap-0-0-5-initial-released .

{{{
cat > /etc/exim4/conf.d/router/950_exim4_config_ldap_user <<EOF
# LDAP Server info
LDAPBASE = dc=skole,dc=skolelinux,dc=no
LDAPSERVER = ldap.intern

ldap_user:
  debug_print = "R: ldap_user for $local_part@$domain"
  driver = accept
  condition = ${if eq {}{${lookup ldap {ldap://LDAPSERVER/LDAPBASE?uid?sub?(uid=${local_part})}} }{no}{yes}}
  cannot_route_message = Recipent ${local_part} unknown.
  retry_use_local_part
  transport = LOCAL_DELIVERY
EOF
chmod 644 /etc/exim4/conf.d/router/950_exim4_config_ldap_user
}}}

Recipe for making the SMTP/IMAP server a public mail server

This recipe is based on Debian Edu Squeeze (6.0), and change the default mail server setup from using the Debian Edu configuration to using the default exim4 configuration. The original setup is in /etc/exim4/exim-ldap-server-v4.conf, but it is easier to adjust the default exim4 setup than to edit the preloaded setup.

Setting this up consist of these steps:

  1. Prepare the default exim4 config to use LDAP for user information.
  2. Decide which DNS domain to use for public email (using example.com).
  3. Set up the exim4 configuration with the new DNS domain
  4. Change mail name for tjener to get valid addresses in outgoing email.
  5. Switch to generated contiguration instead of the Debian Edu provided configuration.
  6. Add port forwarding in the gateway, allowing connections from the outside for port 25 to make it to tjener.intern
  7. Update DNS, add MX entry for the selected DNS domain.

dpkg-reconfigure exim4-config

Note that root email is now delivered to /var/mail/mail, not /var/mail/root as before. This is the new default for exim, and I did not try to change it.

Prepare the default exim4 config to use LDAP for user information.

This step add a config fragment to the generated exim4 configuration, telling exim to look up users in the Skolelinux/Debian Edu LDAP directory. It was partly based on the setup found in http://edin.no-ip.com/blog/hswong3i/exim4-ldap-0-0-5-initial-released .

cat > /etc/exim4/conf.d/router/950_exim4_config_ldap_user <<EOF
# LDAP Server info
LDAPBASE = dc=skole,dc=skolelinux,dc=no
LDAPSERVER = ldap.intern

ldap_user:
  debug_print = "R: ldap_user for $local_part@$domain"
  driver = accept
  condition = ${if eq {}{${lookup ldap {ldap://LDAPSERVER/LDAPBASE?uid?sub?(uid=${local_part})}} }{no}{yes}}
  cannot_route_message = Recipent ${local_part} unknown.
  retry_use_local_part
  transport = LOCAL_DELIVERY
EOF
chmod 644 /etc/exim4/conf.d/router/950_exim4_config_ldap_user

diff --git a/exim4/exim4.conf b/exim4/exim4.conf deleted file mode 120000 index ae09dd8..0000000 --- a/exim4/exim4.conf +++ /dev/null @@ -1 +0,0 @@ -/etc/exim4/exim-ldap-server-v4.conf \ No newline at end of file diff --git a/exim4/update-exim4.conf.conf b/exim4/update-exim4.conf.conf index c9f3af6..ac68569 100644 --- a/exim4/update-exim4.conf.conf +++ b/exim4/update-exim4.conf.conf @@ -17,10 +17,10 @@

  • # This is a Debian specific file dc_eximconfig_configtype='internet'

-dc_other_hostnames='intern;postoffice.intern' +dc_other_hostnames='intern;postoffice.intern;domain.com;mail.domain.com'

  • dc_local_interfaces= dc_readhost=

-dc_relay_domains= +dc_relay_domains=

  • dc_minimaldns='false' dc_relay_nets='10.0.0.0/8'

    dc_smarthost=

@@ -28,4 +28,4 @@ CFILEMODE='644'

  • dc_use_split_config='true'

    dc_hide_mailname= dc_mailname_in_oh='true'

-dc_localdelivery='mail_spool' +dc_localdelivery='maildir_home' diff --git a/mailname b/mailname index 635da68..5b1866c 100644 --- a/mailname +++ b/mailname @@ -1 +1 @@ -tjener.intern +mail.domain.com