| | 25 | |
| | 26 | === Autoresponder, LDAP, postfix, gnarwl === |
| | 27 | Use information stored in LDAP for autoresponder messages. |
| | 28 | |
| | 29 | This is using a specific LDAP schema ttdmin.schema (see attachements). |
| | 30 | ==== LDAP ==== |
| | 31 | The user has to belong to to ObjectClass TTDMinAccount. |
| | 32 | |
| | 33 | The following attributes are relevant for the vation autoresponder: |
| | 34 | {{{ |
| | 35 | accountActive (flag if the account is active - has to be true) |
| | 36 | delete (flag for deleten - has to be FALSE |
| | 37 | mailAutoreply (the mail address that is used to answer incomming mail - has to be set) |
| | 38 | vacationActive (flag if the autoresponder is active - has to be TRUE if vacation should be activated) |
| | 39 | vacationInfo (text in utf-8 encoding that is used to respond) |
| | 40 | }}} |
| | 41 | ==== gnarwl ==== |
| | 42 | installed from my clone of gnawrl at https://github.com/guhl/gnarwl |
| | 43 | |
| | 44 | Config at /etc/gnarwl.cfg |
| | 45 | {{{ |
| | 46 | map_sender $sender |
| | 47 | map_receiver $recepient |
| | 48 | map_subject $subject |
| | 49 | map_field $begin vacationStart |
| | 50 | map_field $end vacationEnd |
| | 51 | map_field $fullname cn |
| | 52 | map_field $deputy vacationForward |
| | 53 | map_field $reply mail |
| | 54 | server localhost |
| | 55 | port 389 |
| | 56 | scope sub |
| | 57 | login cn=Manager,dc=thinkthinkdo,dc=com |
| | 58 | password totally_secret |
| | 59 | protocol 0 |
| | 60 | base ou=People,dc=thinkthinkdo,dc=com |
| | 61 | queryfilter (&(mailAutoreply=$recepient)(vacationActive=TRUE)) |
| | 62 | result vacationInfo |
| | 63 | blockfiles /var/lib/gnarwl/block/ |
| | 64 | umask 0644 |
| | 65 | blockexpire 48 |
| | 66 | mta /usr/sbin/sendmail -F $recepient -t $sender |
| | 67 | maxreceivers 64 |
| | 68 | maxheader 512 |
| | 69 | charset utf-8 |
| | 70 | badheaders /var/lib/gnarwl/badheaders.db |
| | 71 | blacklist /var/lib/gnarwl/blacklist.db |
| | 72 | forceheader /var/lib/gnarwl/header.txt |
| | 73 | forcefooter /var/lib/gnarwl/footer.txt |
| | 74 | recvheader To Cc |
| | 75 | loglevel 3 |
| | 76 | }}} |
| | 77 | |
| | 78 | ==== postfix ==== |
| | 79 | The principle here is: |
| | 80 | All messages are BCCed to a gnarwl transport. This is done by adding this to /etc/postfix/main.cf |
| | 81 | {{{ |
| | 82 | recipient_bcc_maps = |
| | 83 | ldap:/etc/postfix/ldap_vacation.cf |
| | 84 | }}} |
| | 85 | in /etc/postfix/ldap_vacation.cf |
| | 86 | {{{ |
| | 87 | server_host = ldap://localhost |
| | 88 | search_base = ou=People,dc=thinkthinkdo,dc=com |
| | 89 | version = 3 |
| | 90 | bind = yes |
| | 91 | start_tls = no |
| | 92 | bind_dn = cn=Manager,dc=thinkthinkdo,dc=com |
| | 93 | bind_pw = totally_secret |
| | 94 | search_base = ou=People,dc=thinkthinkdo,dc=com |
| | 95 | scope = sub |
| | 96 | query_filter = (&(&(objectClass=TTDMinAccount)(mail=%s))(vacationActive=TRUE)(accountActive=TRUE)(delete=FALSE)) |
| | 97 | result_attribute = mailAutoreply |
| | 98 | result_format = %s,%s@autoreply.thinkthinkdo.com |
| | 99 | expansion_limit = 1 |
| | 100 | }}} |
| | 101 | This basically adds the @autoreply.thinkthinkdo.com to the mail-addressed that is defined to be used for autoresponding and later used in transport. |
| | 102 | |
| | 103 | This transport is defined in /etc/postfix/transport - add: |
| | 104 | {{{ |
| | 105 | autoreply.thinkthinkdo.com gnarwl: |
| | 106 | }}} |
| | 107 | after adding this use {{{ postmap /etc/postfix/transport }}} to convert this to the db format. |
| | 108 | |
| | 109 | In /etc/postfix/main.cf this transport is added by adding the line: |
| | 110 | {{{ |
| | 111 | transport_maps = hash:/etc/postfix/transport |
| | 112 | }}} |
| | 113 | |
| | 114 | gnawrl itself is added to /etc/postfix/master.cf by adding this: |
| | 115 | {{{ |
| | 116 | gnarwl unix - n n - - pipe |
| | 117 | flags=F user=gnarwl argv=/usr/bin/gnarwl -a ${user} -s ${sender} |
| | 118 | }}} |
| | 119 | |
| | 120 | afterwards restart postfix. |