Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Configuration example for mbsync + dovecot + Gnus
@ 2021-01-25 11:01 Garjola Dindi
  2021-01-25 16:31 ` Eric Abrahamsen
  2021-01-25 21:01 ` Jeffrey DeLeo
  0 siblings, 2 replies; 6+ messages in thread
From: Garjola Dindi @ 2021-01-25 11:01 UTC (permalink / raw)
  To: info-gnus-english


Hi,

I would like to move from a nnmaildir + OfflineIMAP configuration to
something which:

1. scales better for large number of messages than nnmaildir and
2. does not use OfflineIMAP (Python 2 based and sometimes slow).

I understand that some Gnus users use a local IMAP server with dovecot
and the nnimap backend.

I found these interesting instructions here:

https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html

but I am having trouble making them work. 

I had to change some of the mbsync settings since they are now
deprecated (the post is 6 years old), but still no success (I have
failed authentications for mbsync while the same config works if I don't
use dovecot).

I would like to know if somebody could share their dovecot and mbsync
configurations for a more recent setup. I am running Debian stable, but
I guess that I can translate distribution specific things if needed.

Thanks for your help.

-- 

Garjola


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Configuration example for mbsync + dovecot + Gnus
  2021-01-25 11:01 Configuration example for mbsync + dovecot + Gnus Garjola Dindi
@ 2021-01-25 16:31 ` Eric Abrahamsen
  2021-01-25 18:11   ` Garjola Dindi
  2021-01-25 21:01 ` Jeffrey DeLeo
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2021-01-25 16:31 UTC (permalink / raw)
  To: Garjola Dindi; +Cc: info-gnus-english

Garjola Dindi <garjola@garjola.net> writes:

> Hi,
>
> I would like to move from a nnmaildir + OfflineIMAP configuration to
> something which:
>
> 1. scales better for large number of messages than nnmaildir and
> 2. does not use OfflineIMAP (Python 2 based and sometimes slow).
>
> I understand that some Gnus users use a local IMAP server with dovecot
> and the nnimap backend.
>
> I found these interesting instructions here:
>
> https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html

I'm still using this setup! You didn't say what was going wrong, but
here's a sample config block for one of my IMAP accounts:

IMAPAccount ea
Host mail.ericabrahamsen.net
User eric@ericabrahamsen.net
PassCmd "/usr/bin/pass email/ea"
SSLType STARTTLS
Port 143

IMAPStore ea-ro
Account ea

IMAPAccount local-ea-dovecot
SSLType None
Host localhost
User eric-local@ericabrahamsen.net
Pass <boguspassword>
AuthMechs LOGIN

IMAPStore ea-daemon-local
Account local-ea-dovecot

Channel ea
Master :ea-ro:
Slave :ea-daemon-local:
Patterns *
Create Both
Expunge Both
Remove Both

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Configuration example for mbsync + dovecot + Gnus
  2021-01-25 16:31 ` Eric Abrahamsen
@ 2021-01-25 18:11   ` Garjola Dindi
  2021-01-25 18:30     ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Garjola Dindi @ 2021-01-25 18:11 UTC (permalink / raw)
  To: info-gnus-english

On Mon 25-Jan-2021 at 17:31:14 +01, Eric Abrahamsen
<eric@ericabrahamsen.net> wrote: 
> Garjola Dindi <garjola@garjola.net> writes:
>
>> Hi,
>>
>> I would like to move from a nnmaildir + OfflineIMAP configuration to
>> something which:
>>
>> 1. scales better for large number of messages than nnmaildir and
>> 2. does not use OfflineIMAP (Python 2 based and sometimes slow).
>>
>> I understand that some Gnus users use a local IMAP server with dovecot
>> and the nnimap backend.
>>
>> I found these interesting instructions here:
>>
>> https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html
>
> I'm still using this setup! You didn't say what was going wrong, but
> here's a sample config block for one of my IMAP accounts:

Thanks for your answer! 

With respect to the 2014 post, for the mbsync part, I had to change

,----
| UseIMAPS no
| UseTLSV1 no 
`----

to this

,----
| SSLType IMAPS
| SSLVersions TLSv1.2
`----

and also add the port as you have in the example you just gave.

And now I also see that for the local dovecot, you have

,----
| AuthMechs LOGIN
`----

which was not the case in the blog post. This may be why I was getting
an authentication failure.

I will try again with this updated configuration (my next scheduled
session to play with this is next week-end!).

Do you remember having also updated dovecot.conf or other things?

Thanks!

>
> IMAPAccount ea
> Host mail.ericabrahamsen.net
> User eric@ericabrahamsen.net
> PassCmd "/usr/bin/pass email/ea"
> SSLType STARTTLS
> Port 143
>
> IMAPStore ea-ro
> Account ea
>
> IMAPAccount local-ea-dovecot
> SSLType None
> Host localhost
> User eric-local@ericabrahamsen.net
> Pass <boguspassword>
> AuthMechs LOGIN
>
> IMAPStore ea-daemon-local
> Account local-ea-dovecot
>
> Channel ea
> Master :ea-ro:
> Slave :ea-daemon-local:
> Patterns *
> Create Both
> Expunge Both
> Remove Both
>
> _______________________________________________
> info-gnus-english mailing list
> info-gnus-english@gnu.org
> https://lists.gnu.org/mailman/listinfo/info-gnus-english

-- 


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Configuration example for mbsync + dovecot + Gnus
  2021-01-25 18:11   ` Garjola Dindi
@ 2021-01-25 18:30     ` Eric Abrahamsen
  2021-01-31 10:56       ` Garjola Dindi
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2021-01-25 18:30 UTC (permalink / raw)
  To: Garjola Dindi; +Cc: info-gnus-english

Garjola Dindi <garjola@garjola.net> writes:

> On Mon 25-Jan-2021 at 17:31:14 +01, Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote: 
>> Garjola Dindi <garjola@garjola.net> writes:
>>
>>> Hi,
>>>
>>> I would like to move from a nnmaildir + OfflineIMAP configuration to
>>> something which:
>>>
>>> 1. scales better for large number of messages than nnmaildir and
>>> 2. does not use OfflineIMAP (Python 2 based and sometimes slow).
>>>
>>> I understand that some Gnus users use a local IMAP server with dovecot
>>> and the nnimap backend.
>>>
>>> I found these interesting instructions here:
>>>
>>> https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html
>>
>> I'm still using this setup! You didn't say what was going wrong, but
>> here's a sample config block for one of my IMAP accounts:
>
> Thanks for your answer! 
>
> With respect to the 2014 post, for the mbsync part, I had to change
>
> ,----
> | UseIMAPS no
> | UseTLSV1 no 
> `----
>
> to this
>
> ,----
> | SSLType IMAPS
> | SSLVersions TLSv1.2
> `----
>
> and also add the port as you have in the example you just gave.
>
> And now I also see that for the local dovecot, you have
>
> ,----
> | AuthMechs LOGIN
> `----
>
> which was not the case in the blog post. This may be why I was getting
> an authentication failure.

Looks like it's time to update the blog post...

> I will try again with this updated configuration (my next scheduled
> session to play with this is next week-end!).
>
> Do you remember having also updated dovecot.conf or other things?

I tried to keep dovecot as bog-standard as possible. The only changes I
made to dovecot.conf were to set the location of the password file and
where to store mail, and most importantly to turn on full-text search.
Then there was the passwd file itself.

I think that was it!

Eric

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Configuration example for mbsync + dovecot + Gnus
  2021-01-25 11:01 Configuration example for mbsync + dovecot + Gnus Garjola Dindi
  2021-01-25 16:31 ` Eric Abrahamsen
@ 2021-01-25 21:01 ` Jeffrey DeLeo
  1 sibling, 0 replies; 6+ messages in thread
From: Jeffrey DeLeo @ 2021-01-25 21:01 UTC (permalink / raw)
  To: info-gnus-english


[-- Attachment #1.1: Type: text/plain, Size: 1542 bytes --]


Here is my setup using offlineimap to sync mail with gmail and dovecot to speak imap with gnus.

** .gnus file

  (setq gnus-select-method
	  '(nntp "localhost"))

	(setq gnus-secondary-select-methods
	      '(
		(nnimap "Mail"
			(nnimap-stream shell)
			(nnimap-shell-program
                        "/usr/lib/dovecot/imap -o mail_location=maildir:~/Maildir/:LAYOUT=fs")
			 )
		(nnfolder "archive"
		  (nnfolder-directory   "~/Documents/gnus/Mail/archive")
		  (nnfolder-active-file "~/Documents/gnus/Mail/archive/active")
		  (nnfolder-get-new-mail nil)
		  (nnfolder-inhibit-expiry t))))

    (gnus-registry-initialize)

	  
** dovecot
Important line in /etc/dovecot/conf.d/10-mail.conf:

# this is the important line
mail_location = maildir:~/Maildir:LAYOUT=fs

** offlineimap
This is contents of ~/.offlineimaprc
   
[general]

# defines get_pass()
pythonfile = ~/.offlineimap.py
# List of accounts to be synced, separated by a comma.
accounts = Gmail

[Account Gmail]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = Gmail-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = Gmail-remote

[Repository Gmail-local]
type = Maildir
localfolders = ~/Maildir/Gmail

[Repository Gmail-remote]
type = Gmail
remoteuser = me@gmail.com
remotepasseval = get_pass("GMail")
folderfilter = lambda foldername: foldername in ['INBOX', 'Dev', '[Gmail]/Trash']
# Necessary as of OfflineIMAP 6.5.4
sslcacertfile = /etc/ssl/certs/ca-certificates.crt


[-- Attachment #1.2: Type: text/html, Size: 2318 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Configuration example for mbsync + dovecot + Gnus
  2021-01-25 18:30     ` Eric Abrahamsen
@ 2021-01-31 10:56       ` Garjola Dindi
  0 siblings, 0 replies; 6+ messages in thread
From: Garjola Dindi @ 2021-01-31 10:56 UTC (permalink / raw)
  To: info-gnus-english

On Mon 25-Jan-2021 at 19:30:23 +01, Eric Abrahamsen
<eric@ericabrahamsen.net> wrote: 
> Garjola Dindi <garjola@garjola.net> writes:
>
>> On Mon 25-Jan-2021 at 17:31:14 +01, Eric Abrahamsen
>> <eric@ericabrahamsen.net> wrote: 
>>> Garjola Dindi <garjola@garjola.net> writes:
>>>
>>>> Hi,
>>>>
>>>> I would like to move from a nnmaildir + OfflineIMAP configuration to
>>>> something which:
>>>>
>>>> 1. scales better for large number of messages than nnmaildir and
>>>> 2. does not use OfflineIMAP (Python 2 based and sometimes slow).
>>>>
>>>> I understand that some Gnus users use a local IMAP server with dovecot
>>>> and the nnimap backend.
>>>>
>>>> I found these interesting instructions here:
>>>>
>>>> https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html
>>>
>>> I'm still using this setup! You didn't say what was going wrong, but
>>> here's a sample config block for one of my IMAP accounts:
>>
>> Thanks for your answer! 
>>

[...]


Hi,

Thanks to Eric Abrahamsen and Jeffrey DeLeo for their help. I finally
managed configuring dovecot + mbsync + gnus to my liking.

Actually, the original post from Eric just needed a couple of tweaks to
work. As pointed out before, in the mbsync config, I had to change this

,----
| UseIMAPS no
| UseTLSV1 no 
`----

to this

,----
| SSLType IMAPS
| SSLVersions TLSv1.2
`----

and also add the port 

,----
| Port 993
`----

For the local dovecot, I had to add this

,----
| AuthMechs LOGIN
`----

Since my email provider uses Microsoft Exchange (or Outlook or Office365
or whatever they call it these days), I had to add a couple of options
to go around bugs in their server. These are documented in [1] and [2].

FWIW, my final mbsync config looks like this:

#+begin_src conf :tangle  mbsync/.mbsyncrc :mkdirp yes
IMAPAccount garjola
Host imap.domain.net
Port 993
User login@domain.net
PassCmd "emacsclient -e \"(my/lookup-password :host
\\\"imap.domain.net\\\" :user \\\"login@domain.net\\\")\" | cut -d '\"'
-f2" 
SSLType IMAPS
SSLVersions TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
PipelineDepth 1
Timeout 120 

IMAPStore garjola-remote
Account garjola

IMAPAccount garjola-dovecot
Host localhost
User login@domain.net
Pass passwurd  # local password I don't care much about
SSLType None
AuthMechs LOGIN

IMAPStore garjola-local
Account garjola-dovecot

Channel garjola
Master :garjola-remote:
Slave :garjola-local:
Patterns *
Create Both
Expunge Both
Remove Both        
#+end_src

The configuration of dovecot (dovecot.conf and passwd) don't need any
change. And nor does the .gnus part.

To look up the imap password, I use this (stolen from [3]):

#+begin_src emacs-lisp
(defun my/lookup-password (&rest keys)
  "Lookup a password using auth-source"
  (let ((result (apply #'auth-source-search keys)))
    (if result
        (funcall (plist-get (car result) :secret))
      nil)))
#+end_src


Cheers,

Garjola

[1]  https://kdecherf.com/blog/2017/05/01/mbsync-and-office-365/

[2]  https://www.chrislockard.net/posts/o365-mail-emacs-mbsync-mu4e/

[3]  https://github.com/daviwil/emacs-from-scratch/blob/master/
     show-notes/Emacs-Tips-Pass.org

-- 


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-31 10:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 11:01 Configuration example for mbsync + dovecot + Gnus Garjola Dindi
2021-01-25 16:31 ` Eric Abrahamsen
2021-01-25 18:11   ` Garjola Dindi
2021-01-25 18:30     ` Eric Abrahamsen
2021-01-31 10:56       ` Garjola Dindi
2021-01-25 21:01 ` Jeffrey DeLeo

Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/info-gnus-english

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 info-gnus-english info-gnus-english/ http://inbox.vuxu.org/info-gnus-english \
		info-gnus-english@inbox.vuxu.org
	public-inbox-index info-gnus-english

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.emacs.gnus.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git