https://www.marcelpost.com/wiki/index.php?title=Dovecot_basic&feed=atom&action=history
Dovecot basic - Revision history
2024-03-29T14:17:33Z
Revision history for this page on the wiki
MediaWiki 1.39.5
https://www.marcelpost.com/wiki/index.php?title=Dovecot_basic&diff=1388&oldid=prev
Admin: /* IMAP sync with Gmail */
2014-04-24T01:57:21Z
<p><span dir="auto"><span class="autocomment">IMAP sync with Gmail</span></span></p>
<p><b>New page</b></p><div>Dovecot basic<br />
<br />
* dovecot-imapd<br />
* exim4<br />
* fetchmail<br />
<br />
<br />
<pre><br />
apt-get install dovecot-imapd exim4 fetchmail<br />
</pre><br />
<br />
===setting up exim===<br />
<br />
<br />
<pre><br />
dpkg-reconfigure exim4-config<br />
</pre><br />
<br />
General type of mail configuration: internet site<br />
<br />
System mail name: mydomain.com<br />
<br />
IP-addresses to listen on for incoming SMTP connections: No value (all interfaces)<br />
<br />
Other destinations for which mail is accepted: mydomain.com<br />
<br />
Domains to relay mail for: No value (no other domains)<br />
<br />
Machines to relay mail for: No value (no other machines)<br />
<br />
Keep number of DNS-queries minimal (Dial-on-Demand)? No<br />
<br />
Delivery method for local mail: Maildir format in home directory<br />
<br />
Split configuration into small files? Yes <br />
<br />
<br />
<br />
<br />
==setting up dovecot==<br />
<br />
create a new file /etc/dovecot/passwd<br />
<br />
<pre><br />
test:{PLAIN}pass<br />
bill:{PLAIN}secret<br />
timo@example.com:{PLAIN}hello123<br />
dave@example.com:{PLAIN}world234<br />
joe@elsewhere.org:{PLAIN}whee<br />
jane@elsewhere.org:{PLAIN}mypass<br />
</pre><br />
<br />
To store passwords encypted, use:<br />
<br />
<pre><br />
doveadm pw -s ssha<br />
Enter new password: foo<br />
Retype new password: foo<br />
{SSHA}DNODS3ZrOq1bu2MasNk79LxHhlU9iI03<br />
</pre><br />
<br />
Note that you won't get the same output after {SSHA} as above, because Dovecot uses random salts when creating the SSHA hash. This means that even if multiple users have the same password, you won't know that because their hashes are different.<br />
<br />
The passwd file entry would be:<br />
<pre><br />
bill:{SSHA}DNODS3ZrOq1bu2MasNk79LxHhlU9iI03<br />
</pre><br />
<br />
<br />
With the 2.x versions of Dovecot the configuration files have been split up (as opposed to a single dovecot.conf file in 1.x versions).<br />
<br />
Below are listed the modifications required on the default dovecot config files (after a fresh installation).<br />
<br />
* /etc/dovecot/dovecot.conf<br />
<br />
Leave as-is.<br />
<br />
<br />
* /etc/dovecot/conf.d/10-auth.conf<br />
<br />
<pre><br />
disable_plaintext_auth = no<br />
auth_mechanisms = plain<br />
!include auth-system.conf.ext<br />
</pre><br />
<br />
<br />
* /etc/dovecot/conf.d/10-mail.conf<br />
<br />
<pre><br />
mail_location = maildir:~/Maildir<br />
</pre><br />
<br />
<br />
* /etc/dovecot/conf.d/auth-passwdfile-conf.ext<br />
<br />
<pre><br />
passdb {<br />
driver = passwd-file<br />
args = /etc/dovecot/users<br />
}<br />
<br />
userdb {<br />
driver = passwd-file<br />
args = uid=vmail gid=vmail home=/home/vmail/%u<br />
}<br />
</pre><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
==setting up fetchmail==<br />
<br />
<br />
~/.fetchmailrc<br />
<br />
<pre><br />
poll localhost with proto POP3<br />
user abc@xyz.org<br />
pass bill123<br />
is yyy@gmail.com here<br />
</pre><br />
<br />
<br />
==IMAP sync with Gmail==<br />
<br />
apt-get install offlineimap<br />
<br />
<br />
* offlineimaprc example<br />
<br />
<pre><br />
[general]<br />
accounts = Gmail<br />
maxsyncaccounts = 1<br />
<br />
[Account Gmail]<br />
localrepository = Local<br />
remoterepository = Remote<br />
maxage = 365<br />
<br />
[Repository Local]<br />
sep = /<br />
type = Maildir<br />
localfolders = /disk/mail/dovecot/varvmail/mydomain.com/gmail/Maildir<br />
nametrans = lambda folder: re.sub('Junk', '[Gmail].Spam',<br />
re.sub('Drafts', '[Gmail].Drafts',<br />
re.sub('Inbox', '[Gmail].INBOX',<br />
re.sub('Trash', '[Gmail].Bin',<br />
re.sub('Sent', '[Gmail].Sent Mail',<br />
re.sub('Flagged', '[Gmail].Starred',<br />
re.sub('Trash', '[Gmail].Trash',<br />
re.sub('Important', '[Gmail].Important',<br />
re.sub('Archive', '[Gmail].All Mail', folder)))))))))<br />
<br />
[Repository Remote]<br />
type = Gmail<br />
remotehost = imap.gmail.com<br />
remoteuser = my.email.address@gmail.com<br />
remotepass = mypassword<br />
ssl = yes<br />
maxconnections = 3<br />
realdelete = no<br />
## One-way synching. Perfect for backups.<br />
readonly = true<br />
nametrans = lambda folder: re.sub('.*Spam$', 'Junk',<br />
re.sub('.*Drafts$', 'Drafts',<br />
re.sub('.*INBOX$', 'Inbox',<br />
re.sub('.*Sent Mail$', 'Sent',<br />
re.sub('.*Starred$', 'Flagged',<br />
re.sub('.*Trash$', 'Trash',<br />
re.sub('.*Bin$', 'Trash',<br />
re.sub('.*Important$', 'Important',<br />
re.sub('.*All Mail$', 'Archive', folder)))))))))<br />
</pre><br />
<br />
<br />
Usage:<br />
<br />
host#~: offlineimap -c offlineimaprc<br />
<br />
Afterwards I reassign vmail as owner and group to all folders to be sure that messages are not left as root:root.<br />
<br />
host#~: chmod -R vmail:vmail /disk/mail/dovecot/varvmail</div>
Admin