Skip to content

access to protonmail bridge #247

@abcnorio

Description

@abcnorio

Hello,

OS = debian bookworm
I use the docker and a json config file, but it fails for a locally running protonmail bridge (which works well for e.g. with sylpheed email client).

config:

$ cat IMAP_proton/config.json
{
  "version": "2.2",
  "accounts": [
    {
      "username": "PROTONMAILACCOUNT@pm.me",
      "password": "PWD-COPIED-FROM-PROTONBRIDGE",
      "status": "active",
      "local_path": "/data/PROTONMAILACCOUNT",
      "folders": [

      ],
      "server": "127.0.0.1",
      "connection_options": {
        "port": "1143",
        "ssl": {"verify_mode": 0}
      },
      "multi_fetch_size": 1
    }
  ],
  "download_strategy": "delay_metadata"

The docker call:

docker run --volume $(pwd)/IMAP_proton:/data ghcr.io/joeyates/imap-backup:latest imap-backup backup --config /data/config.json --verbose

The debug log:

D, [2025-12-05T08:53:12.478790 #1] DEBUG -- : Loading configuration
D, [2025-12-05T08:53:12.478969 #1] DEBUG -- : Starting backup of 1 accounts
I, [2025-12-05T08:53:12.478998 #1]  INFO -- : Running backup of account 'PROTONMAILACCOUNT@pm.me'
D, [2025-12-05T08:53:12.479015 #1] DEBUG -- : Creating IMAP instance
D, [2025-12-05T08:53:12.479055 #1] DEBUG -- : Logging in: dragwonizdom@pm.me/xxxxxxxxxxxxxxxxxxxxxx
E, [2025-12-05T08:53:12.480671 #1] ERROR -- : Backup for account 'PROTONMAILACCOUNT@proton.me' failed with error Connection refused - connect(2) for 127.0.0.1:1143
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `__connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:60:in `connect_internal'
/usr/local/lib/ruby/3.2.0/socket.rb:141:in `connect'
/usr/local/lib/ruby/3.2.0/socket.rb:645:in `block in tcp'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `each'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `foreach'
/usr/local/lib/ruby/3.2.0/socket.rb:635:in `tcp'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap.rb:3369:in `tcp_socket'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap.rb:1121:in `initialize'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap/deprecated_client_options.rb:82:in `initialize'
/app/lib/imap/backup/client/default.rb:91:in `new'
/app/lib/imap/backup/client/default.rb:91:in `imap'
/app/lib/imap/backup/client/default.rb:44:in `login'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:46:in `block in do_first_login'
/app/lib/imap/backup/retry_on_error.rb:18:in `retry_on_error'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:45:in `do_first_login'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:30:in `method_missing'
/app/lib/imap/backup/account/backup.rb:23:in `run'
/app/lib/imap/backup/cli/backup.rb:40:in `block in run'
/app/lib/imap/backup/cli/backup.rb:38:in `each'
/app/lib/imap/backup/cli/backup.rb:38:in `run'
/app/lib/imap/backup/cli.rb:74:in `backup'
/usr/local/bundle/gems/thor-1.4.0/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/thor-1.4.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.4.0/lib/thor.rb:538:in `dispatch'
--network=host
/usr/local/bundle/gems/thor-1.4.0/lib/thor/base.rb:584:in `start'
/app/lib/imap/backup/cli.rb:49:in `start'
/app/bin/imap-backup:16:in `block in <main>'D, [2025-12-05T08:53:12.478790 #1] DEBUG -- : Loading configuration
D, [2025-12-05T08:53:12.478969 #1] DEBUG -- : Starting backup of 1 accounts
I, [2025-12-05T08:53:12.478998 #1]  INFO -- : Running backup of account 'PROTONMAILACCOUNT@pm.me'
D, [2025-12-05T08:53:12.479015 #1] DEBUG -- : Creating IMAP instance
D, [2025-12-05T08:53:12.479055 #1] DEBUG -- : Logging in: dragwonizdom@pm.me/xxxxxxxxxxxxxxxxxxxxxx
E, [2025-12-05T08:53:12.480671 #1] ERROR -- : Backup for account 'PROTONMAILACCOUNT@proton.me' failed with error Connection refused - connect(2) for 127.0.0.1:1143
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `__connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:60:in `connect_internal'
/usr/local/lib/ruby/3.2.0/socket.rb:141:in `connect'
/usr/local/lib/ruby/3.2.0/socket.rb:645:in `block in tcp'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `each'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `foreach'
/usr/local/lib/ruby/3.2.0/socket.rb:635:in `tcp'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap.rb:3369:in `tcp_socket'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap.rb:1121:in `initialize'
/usr/local/bundle/gems/net-imap-0.5.9/lib/net/imap/deprecated_client_options.rb:82:in `initialize'
/app/lib/imap/backup/client/default.rb:91:in `new'
/app/lib/imap/backup/client/default.rb:91:in `imap'
/app/lib/imap/backup/client/default.rb:44:in `login'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:46:in `block in do_first_login'
/app/lib/imap/backup/retry_on_error.rb:18:in `retry_on_error'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:45:in `do_fi
--network=hostrst_login'
/app/lib/imap/backup/client/automatic_login_wrapper.rb:30:in `method_missing'
/app/lib/imap/backup/account/backup.rb:23:in `run'
/app/lib/imap/backup/cli/backup.rb:40:in `block in run'
/app/lib/imap/backup/cli/backup.rb:38:in `each'
/app/lib/imap/backup/cli/backup.rb:38:in `run'
/app/lib/imap/backup/cli.rb:74:in `backup'
/usr/local/bundle/gems/thor-1.4.0/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/thor-1.4.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.4.0/lib/thor.rb:538:in `dispatch'
/usr/local/bundle/gems/thor-1.4.0/lib/thor/base.rb:584:in `start'
/app/lib/imap/backup/cli.rb:49:in `start'
/app/bin/imap-backup:16:in `block in <main>'
/app/lib/imap/backup/logger.rb:58:in `sanitize_stderr'
/app/bin/imap-backup:15:in `<main>'
/app/lib/imap/backup/logger.rb:58:in `sanitize_stderr'
/app/bin/imap-backup:15:in `<main>'

The backup runs well with some other external email provider.
The protonmail bridge runs on 127.0.0.1:1143 for imaps, but already configured above.
One can export the certs from protonmailbdrige (how to tell this in the config)?
The local protonmail bridge uses starttls - maybe that is a reason (how to configure that?) and self-signed cert, but that is included already in the options.
Assumed is the docker call does not require a port forwarding, because the imap-backup is not offering a service but just listening. But protonmailbridge listens only on 127.0.0.1 and not 0.0.0.0, and the docker probably has problems to reach $HOST:1143.

Also tried the docker call with

--network=host

without success.

Changing the server name in the config json to "host.docker.internal" did not work out as well. It could not resolve the name - using the call:

--add-host=host.docker.internal:host-gateway

and then change the server option accordingly in the config json. This brings back the connection refused error:

ERROR -- : Backup for account 'XXX' failed with error Connection refused - connect(2) for 172.17.0.1:1143

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions