From: root Date: Mon, 5 Nov 2007 20:40:35 +0000 (-0500) Subject: Get vmail working! X-Git-Url: https://git.hcoop.net/hcoop/zz_old/config/exim4-hopper.git/commitdiff_plain/f4f251b1478856359168130fcb6821f3331d93f8 Get vmail working! --- diff --git a/conf.d/router/310_exim4-config_virtual_user b/conf.d/router/310_exim4-config_virtual_user dissimilarity index 66% index 6ff2d33..b2f28f8 100644 --- a/conf.d/router/310_exim4-config_virtual_user +++ b/conf.d/router/310_exim4-config_virtual_user @@ -1,9 +1,14 @@ -# hcoop-change: Route mail for hosted domains - -virtual_user: - driver = accept - transport = virtual_delivery -# require_files = /home/vmail/${domain}/${local_part} - condition = ${extract{mail}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/exim.dat} \ - }}{|}{ }}}} +# hcoop-change: Route mail for hosted domains + +virtual_user: + driver = accept + transport = virtual_delivery + # Look up the parameters for this email address, and store them in + # $address_data for later use. If no data exists for this address, + # then "fail", which causes Exim to move on to the next router. + # This allows us to access the contents of $address_data in the + # virtual_delivery transport later on, without having to do multiple + # accesses to exim.dat. + address_data = ${tr{${lookup{$local_part@$domain} \ + dbm{/etc/courier/exim.dat}{$value} fail }} \ + {|}{ }} diff --git a/conf.d/transport/40_exim4-config_virtual_delivery b/conf.d/transport/40_exim4-config_virtual_delivery dissimilarity index 60% index 49a27ef..d18a328 100644 --- a/conf.d/transport/40_exim4-config_virtual_delivery +++ b/conf.d/transport/40_exim4-config_virtual_delivery @@ -1,22 +1,16 @@ -# hcoop-change: This transport is used to deliver mail to virtual -# mailboxes (i.e. email accounts which have been granted to non-hcoop -# members by the owner of the domain) - -virtual_delivery: - debug_print = "T: virtual_delivery for $local_part@$domain" - driver = appendfile - user = ${extract{uid}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/exim.dat} \ - }}{|}{ }}}} - group = mail - mode = 0660 - mode_fail_narrower = false - envelope_to_add - return_path_add - directory = ${extract{mail}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/exim.dat} \ - }}{|}{ }}}}${run{/etc/exim4/get-token \ - ${extract{uid}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/exim.dat} \ - }}{|}{ }}}}}{}} - maildir_format +# hcoop-change: This transport is used to deliver mail to virtual +# mailboxes (i.e. email accounts which have been granted to non-hcoop +# members by the owner of the domain) + +virtual_delivery: + debug_print = "T: virtual_delivery for $local_part@$domain" + driver = appendfile + user = ${extract{uid}{$address_data}} + group = nogroup + mode = 0600 + mode_fail_narrower = false + envelope_to_add + return_path_add + directory = ${extract{mail}{$address_data}}${run{/etc/exim4/get-token \ + ${extract{uid}{$address_data}}}{}} + maildir_format diff --git a/get-token b/get-token index 4d6f282..0c7abe5 100755 --- a/get-token +++ b/get-token @@ -16,7 +16,7 @@ USER=$1 LOGFILE=/tmp/exim4/get-token-log.$USER if test "$REALUSER" = "root"; then - if test -n "$2"; then + if test "$2" = "norecurse"; then echo "Error: running as root even after trying to change to $USER" \ > $LOGFILE exit 1 @@ -34,6 +34,7 @@ fi # Make sure USER exists, and resolve UIDs to a login name USER=$(getent passwd "$USER" | cut -d':' -f 1) +LOGFILE=/tmp/exim4/get-token-log.$USER if test -z "$USER"; then echo "$USER is not a local user, so ignoring them" @@ -49,6 +50,12 @@ exec >& $LOGFILE # print name of user echo "Running as user $REALUSER" +# debugging output +if test "$2" = "debug"; then + shift; shift + echo "Debugging output: $*" +fi + # set the credentials cache export KRB5CCNAME=FILE:/tmp/exim4/krb5cc_$USER.email