Skip to content
CliprWiki

Mailboxes and Proton Mail

Mailboxes for fetching, own mail servers and Proton Mail Bridge.

Setting up a mailbox

Everyone sets up their own mailbox: Settings → Mailbox. Choose the provider (Gmail, GMX, WEB.DE, Outlook, iCloud, T-Online, mailbox.org, Posteo, Proton Mail via Bridge or your own server), enter the credentials, test the connection, set the sender domains (preset: bahn.de, eventim.de, ticketmaster.de). Many providers require an app password when two-factor sign-in is active.

Clipr only reads: emails are not marked as read, moved or deleted. Retrieval happens at system-wide times (CLIPR_IMAP_INTERVAL) through a small worker pool (CLIPR_IMAP_WORKERS), plus "Fetch now" with a minimum gap (CLIPR_IMAP_MANUAL_COOLDOWN).

Mail server in your own network

To protect against SSRF (the server being abused to reach internal services) Clipr rejects mail servers with private addresses. For your own mail server in the home network there are two ways:

Setting Effect
CLIPR_IMAP_ALLOW_HOSTS=mail.home.arpa:993 Recommended: exactly this server and port is allowed, nothing else.
CLIPR_IMAP_ALLOW_PRIVATE=1 All private addresses are allowed.

If the server uses a certificate from your own certificate authority, mount that certificate into the container and set CLIPR_IMAP_CA_FILE (path inside the container).

Proton Mail Bridge

Proton Mail offers no direct IMAP. The Proton Mail Bridge provides it locally, but only listens on 127.0.0.1 of the machine and uses its own certificate. The overlay docker-compose.protonbridge.yml closes the gap without switching off protections:

flowchart LR
  A["app"] -- "STARTTLS<br/>protonbridge:1143" --> R["imap-relay<br/>gateway of the Clipr network"]
  R -- "TCP" --> B["Proton Mail Bridge<br/>127.0.0.1:1143"]
  • imap-relay only forwards TCP. TLS runs end to end between Clipr and the bridge. The relay binds only to the gateway of the Clipr network and drops connections from outside CLIPR_SUBNET immediately.
  • Certificate: the bridge gets a certificate for the name protonbridge from its own certificate authority, restricted by name constraints. Clipr checks certificate and hostname like for any other provider.
  • SSRF protection: only protonbridge:1143 is allowed, not the whole private network.

Requirements: Bridge version 3 or later on the same machine as Docker, openssl.

1. Set up the bridge

protonmail-bridge --cli
>>> login          # Proton address and Proton password
>>> info           # IMAP port, username and bridge password for Clipr
>>> exit

The bridge needs a keyring: GNOME Keyring or KWallet in a desktop session, pass without a desktop (gpg --quick-gen-key …, then pass init <key-id>). If the GPG key is protected by a passphrase, the gpg-agent must be unlocked once after every reboot (e.g. pass show on any entry). For continuous operation without a login there is a user unit in contrib/systemd/protonmail-bridge.service.

2. Create and import the certificate

scripts/protonbridge-cert.sh          # creates secrets/protonbridge/ (ca.crt, ca.key, bridge.crt, bridge.key)

cliprctl setup offers this when you enable the overlay. Then stop the bridge, start it with protonmail-bridge --cli, choose cert → import and give bridge.crt as cert.pem and bridge.key as key.pem (GUI: Settings → Advanced → TLS certificates). Restart the bridge and check:

openssl s_client -connect 127.0.0.1:1143 -starttls imap </dev/null 2>/dev/null | openssl x509 -noout -subject
# expected: subject=CN=protonbridge

3. Enable the overlay and start

scripts/cliprctl overlay add docker-compose.protonbridge.yml
scripts/cliprctl deploy --build
scripts/cliprctl health                # also checks STARTTLS to the bridge

With a firewall using a restrictive inbound rule (e.g. ufw) allow the relay port for the Clipr network:

sudo ufw allow in from 172.30.53.0/24 to 172.30.53.1 port 1143 proto tcp
# only with outgoing email via the bridge (CLIPR_BRIDGE_SMTP_PORT):
sudo ufw allow in from 172.30.53.0/24 to 172.30.53.1 port 1025 proto tcp

4. Add the mailbox in Clipr

Choose the provider Proton Mail (via Bridge); server protonbridge, port 1143 and STARTTLS are preset. Enter username and password from the bridge's info – not your Proton password.

Outgoing email via the bridge

Optional, e.g. for registration and password resets. In .env:

CLIPR_BRIDGE_SMTP_PORT=1025
CLIPR_SMTP_HOST=protonbridge
CLIPR_SMTP_PORT=1025
CLIPR_SMTP_SECURITY=starttls
CLIPR_SMTP_USER=…            # from the bridge's "info"
CLIPR_SMTP_PASSWORD=…
CLIPR_SMTP_FROM=address@your-domain
CLIPR_SMTP_CA_FILE=/run/clipr/protonbridge-ca.crt

Renewing

The server certificate is valid for 825 days. Running scripts/protonbridge-cert.sh again issues a new one from the same certificate authority; then import it into the bridge, nothing changes in Clipr. ca.key is only needed for this and can be kept offline until then.

Error messages from the connection test are explained under Troubleshooting.