User Tools

Site Tools


local_imap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
local_imap [2015/05/16 14:35] – external edit 127.0.0.1local_imap [2016/03/27 14:37] (current) – [Local Dovecot IMAP server] breetai
Line 36: Line 36:
  
 <code> <code>
-apt-get istall dovecot-common dovecot-core dovecot-imapd+apt-get install dovecot-common dovecot-core dovecot-imapd
 </code> </code>
 Standard settings don't allow dovecot to manage /var/mail/ and it goes bonkers because of that. It shows this with the following error in /var/log/syslog. Change the configuration of dovecot to use the mail group for accessing the mail spool. Standard settings don't allow dovecot to manage /var/mail/ and it goes bonkers because of that. It shows this with the following error in /var/log/syslog. Change the configuration of dovecot to use the mail group for accessing the mail spool.
Line 104: Line 104:
  
 ==== Local Roundcube server ==== ==== Local Roundcube server ====
-Debian just decided to drop Roundcube from 'Jessie'. So I will have pull it from unstable/experimental myself. :-(+Debian just decided to drop Roundcube from 'Jessie'. So I will have pull it from unstable/experimental myself. :-(  
 +(**Update 2015-10-23**: Roundcube is back in Debian again.)
  
-Manually pulled the roundcube packages from Debian Unstable. Went for th Sqlite edition. also got -plugins and -plugins-extra. Try to install them all using "dpkg -i ...." and see how it goes.+Manually pulled the roundcube packages from Debian Unstable. Went for the Sqlite edition. also got -plugins and -plugins-extra. Try to install them all using "dpkg -i ...." and see how it goes.
  
 roundcube-sqlite3: depends on php5-sqlite (done) roundcube-sqlite3: depends on php5-sqlite (done)
Line 197: Line 198:
 imapcopy --host1 imap.xs4all.nl --user1 jhaand --host2 localhost --user2 jhaand imapcopy --host1 imap.xs4all.nl --user1 jhaand --host2 localhost --user2 jhaand
 </code> </code>
-And them we [[http://i0.kym-cdn.com/photos/images/original/000/159/334/9266932.jpg|wait]] until 1.15 GiB of mails are transported. Which took around and hour and produced the following statistics:+And them we [[http://i0.kym-cdn.com/photos/images/original/000/159/334/9266932.jpg|wait]] until 1.15 GiB of mails are transported. Which took around an hour and produced the following statistics:
  
 <code> <code>
Line 236: Line 237:
 ==== Configure fetchmail to deliver mail to local users ==== ==== Configure fetchmail to deliver mail to local users ====
 Currently I run fetchmail as a local user. Every time I open a shell, the login script checks if I'm already running fetchmail. If it isn't, then fetchmail is started. This needs to be reconfigured to a global fetchmail configuration that also delivers for the new user.  Currently I run fetchmail as a local user. Every time I open a shell, the login script checks if I'm already running fetchmail. If it isn't, then fetchmail is started. This needs to be reconfigured to a global fetchmail configuration that also delivers for the new user. 
 +**Update 2015-10-23** Procmail makes much more sense to use. Because the local exim server doesn't understand mailing lists and bcc's. Which results in mail ending up in the root account. [[http://www.tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot]]
  
    1 First disable the local E-mail for the local user.     1 First disable the local E-mail for the local user. 
-   Then configure the global /etc/fetchmailrc +   Configure the global /etc/procmailrc 
-   Test run with fetchmail as root+   Then configure the global /etc/fetchmailrc
    4 Enable fetchmail service via /etch/default/fetchmail     4 Enable fetchmail service via /etch/default/fetchmail 
      
Line 251: Line 253:
 fi fi
 </code> </code>
 +
 +=== Global procmailrc ===
 +This should just remain a back to basics procmailrc. Deliver all the mail in the user's mailbox.
 +It looks like this:
 +<code>
 +MAILDIR=/var/spool/mail
 +DEFAULT=$MAILDIR/$LOGNAME
 +LOGFILE=/var/log/procmail
 +VERBOSE=on
 +</code>
 +
 +Check that all the directories exist and the individual mail files have user and group owners as "user:mail" 
 +
 === Global fetchmailrc === === Global fetchmailrc ===
-Now lets create a new global /etc/fetchmailrc. Inspiration taken from [[https://www.howtoforge.com/debian_etch_fetchmail|here]] or you can also find it in /usr/share/doc/fetchmail/examples..+Now lets create a new global /etc/fetchmailrc. Inspiration taken from [[https://www.howtoforge.com/debian_etch_fetchmail|here]] or you can also find it in /usr/share/doc/fetchmail/examples.
 <code> <code>
 # /etc/fetchmailrc for system-wide daemon mode # /etc/fetchmailrc for system-wide daemon mode
Line 279: Line 294:
 poll  pop.xs4all.nl protocol POP3:  poll  pop.xs4all.nl protocol POP3: 
 envelope  X-XS4ALL-TO envelope  X-XS4ALL-TO
-aka xs4all.nl + user "some_user1" there with password "<password>" is "some_user1" here fetchall 
- user "some_user1" there with password "<password>" is "some_user1" here fetchall; +mda '/usr/bin/procmail -d some_user1' 
- user "some_user2" there with password "<password>" is "some_user2" here fetchall+ 
 +poll  pop.xs4all.nl protocol POP3:  
 +envelope  X-XS4ALL-TO 
 +user "some_user2" there with password "<password>" is "some_user2" here fetchall  
 +mda "/usr/bin/procmail -d some_user2"
 </code> </code>
 The with *envelope* is needed to prevent warnings from syslog. It identifies which header fetchmail should use to feed it to the local mail server.  The with *envelope* is needed to prevent warnings from syslog. It identifies which header fetchmail should use to feed it to the local mail server. 
  
-The second value with *akaproved more tricky. All the mail was delivered to the default user of localhost, because fetchmail doesn'know the mail address for the local userIt was delivered as jhaand@xs4all and fetchmail didn'know it should go to jhaand@localhost. This situation has worked for 15 years for the default userBecause it was a single user system up until now. I've seen the warning in the headers in the early 2000'but everything worked then, so it didn'need any follow-up\\ +The *mdacommand tells fetchmail to use procmail and tell procmail to deliver it to the local user. also don'use single quotes ( ' ) but double quotes on the command lineOtherwise strange stuff happens.  
-With the new user it didn't work that great. Now all the 160+ mails were delivered to the default user. By using some advanced tools from my mail client [[http://mutt.org|Mutt]], I was able to sort this out quicker than finding the correct setting to get everything goingIt took while but even that bug was squished.+ 
 +Also addressing multiple users was quite difficult. A lot of tutorials use either the multiple users per single drop and don'use the mdaOr use a single user and then use mda with procmail. I tried using the "procmail -d %T" method across multiple lines but then it ust didn'workSo it's better to have 2 complete separate definitions and hardcode procmail to the correct user per sessionHaven't had problem since
  
 Make sure that the daemon starts with the following setup for /etc/fetchmailrc: Make sure that the daemon starts with the following setup for /etc/fetchmailrc:
Line 295: Line 315:
  
 === Test run === === Test run ===
-The test run didn't pan out that well. It's better to just start the daemon in regular mode. But having acute logging open of /var/log/syslog and /var/log/mail.log via "tail -f" I observed what happened. Like for instance my mail being downloaded and then disappearing. Exim deemed the culprit in this case. It had a limit of only 10 new entries per delivery. Nice for a big site, but worthless for a small site like mine. So adapt the setting for Exim. Figuring this out is deemed out of scope for this article.+The test run didn't pan out that well. It's better to just start the daemon in regular mode. But having acute logging open of /var/log/syslog/var/log/mail.log and /var/log/procmail via "tail -f" I observed what happened. Like for instance my mail being downloaded and then disappearing. Exim deemed the culprit in this case. It had a limit of only 10 new entries per delivery. Nice for a big site, but worthless for a small site like mine. So adapt the setting for Exim. Figuring this out is deemed out of scope for this article.
  
 === Enable fetchmail globally ===  === Enable fetchmail globally === 
Line 309: Line 329:
  
 It should be possible to wipe all the mail folders using the IMAP protocol from a command line tool. Still need to figure out how.  It should be possible to wipe all the mail folders using the IMAP protocol from a command line tool. Still need to figure out how. 
 +
  
 ===== Enabe encrypted remote IMAP =====  ===== Enabe encrypted remote IMAP ===== 
local_imap.1431786901.txt.gz · Last modified: 2015/10/23 18:11 (external edit)