Andrew McGlashan
2016-Feb-22 06:52 UTC
Setup changes 1.x to 2.x -- custom POP3 account handling required.
Hi, Previously I did /special/ processing for some email accounts; if a particular file existed in the user's home directory, then I caused the account to use /var/mail/$USER file for POP -- otherwise it used IMAP. Now, because I adjusted the setup for POP only, IMAP still worked perfectly well. Some users have both POP and IMAP access for various reasons. The special POP processing was done using a shell script [1] in place of: /usr/lib/dovecot/pop3 - which in turn called the normal binary once setting up the environment. Now, I have been forced to upgrade my Debian from squeeze-lts to wheezy and the dovecot setup is quite different. How can I implement my /wrapper/ script for POP handling now? Here is my current setup with dovecot -n ... # 2.1.7: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-5-xen-amd64 x86_64 Debian 7.9 mail_location = maildir:~/Maildir namespace inbox { inbox = yes location mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Items" { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix } passdb { driver = pam } plugin { sieve = ~/.dovecot.sieve sieve_dir = ~/sieve } protocols = " imap pop3" service imap-login { inet_listener imap { port = 0 } } service pop3-login { inet_listener pop3 { port = 0 } } ssl = required ssl_cert = </etc/exim4/exim.crt ssl_key = </etc/exim4/exim.key userdb { driver = passwd } [1] This is the content of the original wrapper script: #!/bin/sh if [ -f $HOME/.use-mbox-for-pop3s ]; then export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER export USER_INBOX=/var/mail/$USER if [ -f $USER_INBOX ] then export USER_INBOX_GROUP=$(stat -c %G $USER_INBOX) if [ $USER_INBOX_GROUP != $USER ] then ( date ls -l $USER_INBOX chown Debian-exim:$USER $USER_INBOX ls -l $USER_INBOX ) >> /var/log/usr-lib-dovecot--pop3-affinity.log fi fi else if [ -d $HOME/Maildir ]; then export MAIL=Maildir:$HOME/Maildir else export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER fi fi # Finally execute the imap/pop3. If you use both, you'll need two scripts. # - this customization just for POP3S ... exec /usr/lib/dovecot/pop3 Thanks AndrewM
Andrew McGlashan
2016-Feb-22 12:40 UTC
Setup changes 1.x to 2.x -- custom POP3 account handling required.
No help? Is this possible to do as I had done before but with the newer version? Thanks A. On 22/02/2016 5:52 PM, Andrew McGlashan wrote:> Hi, > > Previously I did /special/ processing for some email accounts; if a > particular file existed in the user's home directory, then I caused the > account to use /var/mail/$USER file for POP -- otherwise it used IMAP. > > Now, because I adjusted the setup for POP only, IMAP still worked > perfectly well. Some users have both POP and IMAP access for various > reasons. > > The special POP processing was done using a shell script [1] in place of: > /usr/lib/dovecot/pop3 > - which in turn called the normal binary once setting up the > environment. > > Now, I have been forced to upgrade my Debian from squeeze-lts to wheezy > and the dovecot setup is quite different. > > How can I implement my /wrapper/ script for POP handling now? > > Here is my current setup with dovecot -n ... > > # 2.1.7: /etc/dovecot/dovecot.conf > # OS: Linux 2.6.32-5-xen-amd64 x86_64 Debian 7.9 > mail_location = maildir:~/Maildir > namespace inbox { > inbox = yes > location > mailbox Drafts { > special_use = \Drafts > } > mailbox Junk { > special_use = \Junk > } > mailbox Sent { > special_use = \Sent > } > mailbox "Sent Items" { > special_use = \Sent > } > mailbox "Sent Messages" { > special_use = \Sent > } > mailbox Trash { > special_use = \Trash > } > prefix > } > passdb { > driver = pam > } > plugin { > sieve = ~/.dovecot.sieve > sieve_dir = ~/sieve > } > protocols = " imap pop3" > service imap-login { > inet_listener imap { > port = 0 > } > } > service pop3-login { > inet_listener pop3 { > port = 0 > } > } > ssl = required > ssl_cert = </etc/exim4/exim.crt > ssl_key = </etc/exim4/exim.key > userdb { > driver = passwd > } > > > [1] This is the content of the original wrapper script: > > #!/bin/sh > > if [ -f $HOME/.use-mbox-for-pop3s ]; then > export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER > export USER_INBOX=/var/mail/$USER > if [ -f $USER_INBOX ] > then > export USER_INBOX_GROUP=$(stat -c %G $USER_INBOX) > if [ $USER_INBOX_GROUP != $USER ] > then > ( > date > ls -l $USER_INBOX > chown Debian-exim:$USER $USER_INBOX > ls -l $USER_INBOX > ) >> /var/log/usr-lib-dovecot--pop3-affinity.log > fi > fi > else > if [ -d $HOME/Maildir ]; then > export MAIL=Maildir:$HOME/Maildir > else > export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER > fi > fi > > # Finally execute the imap/pop3. If you use both, you'll need two scripts. > # - this customization just for POP3S ... > exec /usr/lib/dovecot/pop3 > > > > Thanks > AndrewM
Timo Sirainen
2016-Mar-01 22:29 UTC
Setup changes 1.x to 2.x -- custom POP3 account handling required.
More complicated, but still possible: http://wiki2.dovecot.org/PostLoginScripting> On 22 Feb 2016, at 14:40, Andrew McGlashan <andrew.mcglashan at affinityvision.com.au> wrote: > > No help? Is this possible to do as I had done before but with the newer > version? > > Thanks > A. > > On 22/02/2016 5:52 PM, Andrew McGlashan wrote: >> Hi, >> >> Previously I did /special/ processing for some email accounts; if a >> particular file existed in the user's home directory, then I caused the >> account to use /var/mail/$USER file for POP -- otherwise it used IMAP. >> >> Now, because I adjusted the setup for POP only, IMAP still worked >> perfectly well. Some users have both POP and IMAP access for various >> reasons. >> >> The special POP processing was done using a shell script [1] in place of: >> /usr/lib/dovecot/pop3 >> - which in turn called the normal binary once setting up the >> environment. >> >> Now, I have been forced to upgrade my Debian from squeeze-lts to wheezy >> and the dovecot setup is quite different. >> >> How can I implement my /wrapper/ script for POP handling now? >> >> Here is my current setup with dovecot -n ... >> >> # 2.1.7: /etc/dovecot/dovecot.conf >> # OS: Linux 2.6.32-5-xen-amd64 x86_64 Debian 7.9 >> mail_location = maildir:~/Maildir >> namespace inbox { >> inbox = yes >> location >> mailbox Drafts { >> special_use = \Drafts >> } >> mailbox Junk { >> special_use = \Junk >> } >> mailbox Sent { >> special_use = \Sent >> } >> mailbox "Sent Items" { >> special_use = \Sent >> } >> mailbox "Sent Messages" { >> special_use = \Sent >> } >> mailbox Trash { >> special_use = \Trash >> } >> prefix >> } >> passdb { >> driver = pam >> } >> plugin { >> sieve = ~/.dovecot.sieve >> sieve_dir = ~/sieve >> } >> protocols = " imap pop3" >> service imap-login { >> inet_listener imap { >> port = 0 >> } >> } >> service pop3-login { >> inet_listener pop3 { >> port = 0 >> } >> } >> ssl = required >> ssl_cert = </etc/exim4/exim.crt >> ssl_key = </etc/exim4/exim.key >> userdb { >> driver = passwd >> } >> >> >> [1] This is the content of the original wrapper script: >> >> #!/bin/sh >> >> if [ -f $HOME/.use-mbox-for-pop3s ]; then >> export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER >> export USER_INBOX=/var/mail/$USER >> if [ -f $USER_INBOX ] >> then >> export USER_INBOX_GROUP=$(stat -c %G $USER_INBOX) >> if [ $USER_INBOX_GROUP != $USER ] >> then >> ( >> date >> ls -l $USER_INBOX >> chown Debian-exim:$USER $USER_INBOX >> ls -l $USER_INBOX >> ) >> /var/log/usr-lib-dovecot--pop3-affinity.log >> fi >> fi >> else >> if [ -d $HOME/Maildir ]; then >> export MAIL=Maildir:$HOME/Maildir >> else >> export MAIL=mbox:$HOME/mail:INBOX=/var/mail/$USER >> fi >> fi >> >> # Finally execute the imap/pop3. If you use both, you'll need two scripts. >> # - this customization just for POP3S ... >> exec /usr/lib/dovecot/pop3 >> >> >> >> Thanks >> AndrewM