pimalaya / himalaya

CLI to manage emails
https://pimalaya.org
MIT License
3.17k stars 95 forks source link

Protonmail Bridge cannot connect to IMAP server due to self signed cert #405

Closed anpin closed 2 years ago

anpin commented 2 years ago

Hello, thank you for you effort in this project, I'm trying to use himalaya for the first time with nixos, home-manager and protonmail-bridge and I can access my accounts via thunderbird after confirming security exception, but himalaya shows me following error on startup

Error: cannot connect to IMAP server

Caused by:
    error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1919: (self signed certificate)

with this config

name = ""

["a@b.c"]
default = true
email = "a@b.c"
imap-host = "127.0.0.1"
imap-login = "a@b.c"
imap-passwd-cmd = "'cat' '~/.config/protonmail/bridge/.p'"
imap-port = 1143
imap-starttls = true
name = "My name"
smtp-host = "127.0.0.1"
smtp-login = "a@b.c"
smtp-passwd-cmd = "'cat' '~/.config/protonmail/bridge/.p'"
smtp-port = 1025
smtp-starttls = false

["a@b.c".mailboxes]
draft = "Drafts"
inbox = "Inbox"
sent = "Sent"

and if I change imap-starttls to false I get

Error: cannot connect to IMAP server

Caused by:
    error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:331:

Can you give any advice on how himalaya handles certificates and how to accept self-signed one? Thanks.

soywod commented 2 years ago

Have a look at this issue #60, especially this comment https://github.com/soywod/himalaya/issues/60#issuecomment-813514080. Also you can try the imap-insecure = true option. I hope it will help you, let me know!

soywod commented 2 years ago

There is also this issue that could help #347.

anpin commented 2 years ago

Thank you imap-insecure = true did the trick, somehow I missed it in the docs. I also had to change relative path to absolute in the imap-passwd-cmd in order for it to work.