mwolson: Mail delivery works now. Yay!
authorroot@deleuze.hcoop.net <>
Sun, 18 Mar 2007 05:55:35 +0000 (01:55 -0400)
committerroot <root@deleuze.hcoop.net>
Sun, 18 Mar 2007 05:55:35 +0000 (01:55 -0400)
Add some truly awful hacks to all of the transports which allow pipes,
maildir delivery, or writing to some user-controlled file so that AFS
tokens can be retrieved at the right time.

conf.d/router/550_exim4-get_token
conf.d/transport/10_exim4-config_mailman
conf.d/transport/30_exim4-config_address_file
conf.d/transport/30_exim4-config_address_pipe
conf.d/transport/30_exim4-config_maildir_home
conf.d/transport/30_exim4-config_maildrop_pipe
conf.d/transport/30_exim4-config_procmail_pipe
get-token

index 2bc47f4..b297982 100644 (file)
@@ -1,11 +1,14 @@
 # hcoop-change: acquire AFS token for the user -- the condition
 # statement is executed for side-effects only, and nothing should ever
 # be accepted by this router
+#
+# Currently disabled in favor of getting the token during transport --
+# that is, after changing uid.
 
-get_token:
-  driver = accept
-  domains = +local_domains
-  condition = ${run{/etc/exim4/get-token ${local_part}}{0}{0}}
-  transport = dev_null
-  no_verify
-  no_expn
+get_token:
+  driver = accept
+  domains = +local_domains
+  condition = ${run{/etc/exim4/get-token ${local_part}}{0}{0}}
+  transport = dev_null
+  no_verify
+  no_expn
index f6ddf40..3c7fb26 100644 (file)
@@ -1,4 +1,5 @@
 # hcoop-change: Transport for mailman lists
+# TODO: get an appropriate AFS token
 mailman_transport:
   debug_print = "T: mailman for $local_part@$domain"
   driver = pipe
index 82b55e2..67e089c 100644 (file)
@@ -2,9 +2,11 @@
 # This transport is used for handling deliveries directly to files that are
 # generated by aliasing or forwarding.
 #
+# hcoop-change: Add bogus group line to make sure get-token gets executed
 address_file:
   debug_print = "T: address_file for $local_part@$domain"
   driver = appendfile
+  group = mail${run{/etc/exim4/get-token ${local_part}}{}}
   delivery_date_add
   envelope_to_add
   return_path_add
index c5f1828..1c19408 100644 (file)
@@ -3,8 +3,12 @@
 # .forward files. If the commands fails and produces any output on standard
 # output or standard error streams, the output is returned to the sender
 # of the message as a delivery error.
+#
+# hcoop-change: Set a nonsensical environment variable in order that a
+# the token-acquiring command may be run
 address_pipe:
   debug_print = "T: address_pipe for $local_part@$domain"
   driver = pipe
+  environment = AFS_IS=${run{/etc/exim4/get-token ${local_part}}{}}enabled
   return_fail_output
 
index dd48466..2705667 100644 (file)
@@ -6,11 +6,13 @@
 # home-directory - change the definition of LOCAL_DELIVERY
 #
 # hcoop-change: Deliver to MAILDIR_HOME_MAILDIR_LOCATION/$local_part
+#
+# hcoop-change: Make sure get-token gets executed
 maildir_home:
   debug_print = "T: maildir_home for $local_part@$domain"
   driver = appendfile
   .ifdef MAILDIR_HOME_MAILDIR_LOCATION
-  directory = MAILDIR_HOME_MAILDIR_LOCATION/$local_part
+  directory = MAILDIR_HOME_MAILDIR_LOCATION/$local_part${run{/etc/exim4/get-token ${local_part}}{}}
   .else
   directory = $home/Maildir
   .endif
index 0ba27bc..edfc8ba 100644 (file)
@@ -1,8 +1,11 @@
+# hcoop-change: Set a nonsensical environment variable in order that a
+# the token-acquiring command may be run
 
 maildrop_pipe:
   debug_print = "T: maildrop_pipe for $local_part@$domain"
   driver = pipe
   path = "/bin:/usr/bin:/usr/local/bin"
+  environment = AFS_IS=${run{/etc/exim4/get-token ${local_part}}{}}enabled
   command = "/usr/bin/maildrop"
   return_path_add
   delivery_date_add
index 5fb03ff..bab810d 100644 (file)
@@ -1,8 +1,11 @@
+# hcoop-change: Set a nonsensical environment variable in order that a
+# the token-acquiring command may be run
 
 procmail_pipe:
   debug_print = "T: procmail_pipe for $local_part@$domain"
   driver = pipe
   path = "/bin:/usr/bin:/usr/local/bin"
+  environment = AFS_IS=${run{/etc/exim4/get-token ${local_part}}{}}enabled
   command = "/usr/bin/procmail"
   return_path_add
   delivery_date_add
index 23c32c0..808820b 100755 (executable)
--- a/get-token
+++ b/get-token
@@ -3,12 +3,24 @@
 #
 # This is used to deliver mail with the appropriate credentials.
 
+touch /tmp/get-token-was-called
+
+exec 2>&1
+exec  >&  /tmp/get-token-log
+
+echo ==============================================================================
+echo invoked: get-token $@
+echo userid:  `who am i`
+
 USER=$1
 export KRB5CCNAME=FILE:/tmp/krb5cc_$USER.email
 kdestroy
 unlog
 
-#echo kinit -kt /etc/keytabs/$USER.email.keytab $USER/mailfilter@HCOOP.NET > /tmp/script-log
-kinit -kt /etc/keytabs/$USER.email.keytab $USER/mailfilter@HCOOP.NET
-#aklog
-#tokens
+KEYTAB=/etc/keytabs/email/$USER.email.keytab
+echo kinit -kt $KEYTAB $USER/mailfilter@HCOOP.NET
+kinit -kt $KEYTAB $USER/mailfilter@HCOOP.NET
+aklog
+tokens
+echo ..............................................................................
+