Skip to content

Instantly share code, notes, and snippets.

@githubcom13
Forked from ibaiul/Protonmail.md
Last active April 14, 2024 20:51
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save githubcom13/2f30f46cd5273db2453a6e7fdb3c422b to your computer and use it in GitHub Desktop.
Save githubcom13/2f30f46cd5273db2453a6e7fdb3c422b to your computer and use it in GitHub Desktop.
Configure the protonmail bridge linux client on Ubuntu 20.04 and Debian 10 server

Protonmail on Ubuntu 20.04 and Debian 10 server

#protonmail #debian #linux

Before you start

Currently protonmail bridge for linux is distributed as part of an open beta program, but soon it will be made public (https://protonmail.com/bridge/install).

Consider that the bridge linux client requires a paid protonmail account to work.

Get the protonmail bridge linux installer

Download the latest package into your computer.

wget --no-check-certificate https://protonmail.com/download/bridge/protonmail-bridge_2.1.3-1_amd64.deb

The link above is working at the time of writing this article, but as the bridge team pointed out, they will expire all the previous links once they release a new version to encourage the installation of the latest version.

To get the latest version try replacing/increasing the version numbers on the link provided or write an email to bridge@protonmail.ch (https://protonmail.com/support/knowledge-base/bridge-for-linux/)

Install protonmail bridge

We will need root access for the setup

su root

Import the protonmail bridge public key

nano bridge_pubkey.gpg
(copy the content of the file and save) or the public key bridge_pubkey.gpg can found:https://protonmail.com/download/bridge_pubkey.gpg
rpm --import bridge_pubkey.gpg

Download the protonmail-bridge package

cd /tmp
wget --no-check-certificate https://protonmail.com/download/bridge/protonmail-bridge_2.1.3-1_amd64.deb

Check the rpm package is correctly signed

rpm --checksig protonmail-bridge_2.1.3-1_amd64.deb

Install dependencies for protonmail-bridge

apt install qt5-default libqt5designer5 libqt5multimediawidgets5 libqt5quickwidgets5 libpulse-mainloop-glib0 libsecret-1-0 ttf-dejavu net-tools libsecret-common libsecret-tools

Install the protonmail bridge client

dpkg -i protonmail-bridge_2.1.3-1_amd64.deb

Install additional tools required for the setup

Install the "pass" password manager that protonmail bridge will use to store the passwords

apt install pass

Install the "screen" utility to daemonize the protonmail bridge client

apt install screen

Create a new user

We will create a new user mainly to isolate the access to the passwords of other users.

Notice that the new user will be locked to disable access to this user from outside.

useradd protonmail
usermod -L protonmail

Create a protonmail directory in /home

cd /home
mkdir protonmail

Change folder owner

chown -R protonmail:protonmail /home/protonmail

Setup "pass" password manager

Login as the new isolated user

su protonmail
cd ~

Run a script session to avoid the PGP key passphrase prompt to fail (https://bugzilla.redhat.com/show_bug.cgi?id=659512).

This is required if we are not using a graphical interface due to the way our isolated user runs the shell commands

script /dev/null

Generate PGP key pair for the new user with an empty passphrase.

The empty passphrase is required to run the protonmail bridge on the background on system startup without being prompted for the password and hence causing the process to fail.

gpg --full-generate-key
>>>> Choose 1                (1) RSA and RSA (default)
>>>> Choose 2048             (default)
>>>> Choose 0                0 = key does not expire
>>>> Type your name          e.g. Proty McProtonFace
>>>> Type your email         e.g. a@a.com
>>>> Leave empty comment
>>>> Leave empty passphrase

List the keys to ensure they were created correctly

gpg --list-keys

Init the password manager for the chosen email address in the PGP keys step

pass init a@a.com

Setup the protonmail bridge client

At this point we already set up the password manager that will allow the protonmail bridge to store the passwords so we will now setup your protonmail account.

protonmail-bridge --cli
>>>> add    (add your protonmail account to bridge)
>>>> (enter your protonmail account email address)
>>>> (enter your protonmail account password)
>>>> list   (list configured accounts)
>>>> info   (list SMTP credentials for configuring any local SMTP compatible service)
>>>> help   (get familiarized with the bridge options)
>>>> exit   (exit the bridge console which stops the local SMTP server created)

Exit the scripted mode of the isolated user if you previously ran "script /dev/null"

exit

Daemonize the protonmail bridge client

In order to start automatically the bridge client on system startup we will create a script to run it in the background.

Notice that we will use the "screen" utility since there is no way to run the protonmail linux client in the background currently without a graphical interface.

For this we will need root access again.

exit

Create a basic script that will be able to launch the protonmail bridge client in the background and kill it.

mkdir /var/lib/protonmail
nano /var/lib/protonmail/protonmail.sh
(copy the content of the file and save)
chmod +x /var/lib/protonmail/protonmail.sh

Create a systemd service

nano /etc/systemd/system/protonmail.service
(copy the content of the file and save)

Enable the script so that it can run on system startup

systemctl enable protonmail

Test the protonmail service

systemctl start protonmail
netstat -tulpn | grep 1025

Reboot you system and check if protonmail bridge is bound to the default ports

reboot
netstat -tulpn | grep 1025

Protonmail on Fedora

All the instructions above should work in Fedora. You can replace "yum" commands with "dnf"

Configure SMTP services

Now that you have the protonmail bridge running in the background you can configure SMTP emails on local instances of Jenkins, Jira, Bitbucket, Thunderbird or any service of your choice.

Remember that required credentials and configuration details can be found by executing:

protonmail-bridge --cli
>>>> info
>>>> exit

Problems

Note: When sending an email via PHPMailer, the following message is displayed:

Connection failed. Error #2: stream_socket_client(): unable to connect to 127.0.0.1:1026 (Connection refused)
SMTP ERROR: Failed to connect to server: Connection refused (111)

OR

SMTP INBOUND: "454 4.7.0 account is logged out, use the app to login again"
SERVER -> CLIENT: 454 4.7.0 account is logged out, use the app to login again
SMTP ERROR: Password command failed: 454 4.7.0 account is logged out, use the app to login again
SMTP Error: Could not authenticate.

Solution 1 :

More than one process listens on the same port. Changing the port in Protonmail-bridge may correct the problem.

To solve it I had to: Login as the new isolated user

su protonmail
cd ~

This is required if we are not using a graphical interface due to the way our isolated user runs the shell commands

script /dev/null

Change port setting

change port

Solution 2 :

Two user processes (root and protonmail) are executed at the same time.

  1. Stopping the "proton-bridge" process using the killall command
killall -9 proton-bridge
  1. Full uninstall protonmail-bridge
apt purge protonmail-bridge
  1. remove all protonmail folders and configuration files in the 'root' profile

  2. remove the protonmail folder in the "home" folder

rm -rf /home/protonmail
  1. reboot

  2. Repeat the protonmail-bridge installation procedure

Problems

Note: When running Bridge on command line, I the following message is printed:

WARN[0000] Failed to add test credentials to keychain error="exit status 1: gpg: Passwords: skipped: No public key\ngpg: [stdin]: encryption failed: No public key\nPassword encryption aborted.\n" helper="*pass.Pass"

He had a bug with your keyring and pass.

Solution:

To solve it I had to:

  1. uninstall gnupg and pass

apt remove gnupg pass

  1. delete the .gnupg and .password-store folders
rm -rf /home/protonmail/.gnupg
rm -rf /home/protonmail/.password-store
  1. reinstall gnupg and pass

apt install gnupg pass

  1. login as the new isolated user
su protonmail
cd ~
  1. run a script session to avoid the PGP key passphrase prompt to fail

script /dev/null

  1. run gpg to create the database and its folder

gpg --list-keys

  1. create a new key
gpg --full-generate-key
>>>> Choose 1 (1) RSA and RSA (default)
>>>> Choose 2048 (default)
>>>> Choose 0 0 = key does not expire
>>>> Type your name e.g. Proty McProtonFace
>>>> Type your email e.g. a@a.com
>>>> Leave empty comment
>>>> Leave empty passphrase
  1. Init the password manager for the chosen email address in the PGP keys step

pass init a@a.com

  1. List the keys to ensure they were created correctly

gpg --list-keys

  1. Setup the protonmail bridge client, follow the procedure I described here
[Unit]
Description=Service to run the Protonmail bridge client
After=network.target
[Service]
Type=oneshot
User=protonmail
ExecStart=/var/lib/protonmail/protonmail.sh start
ExecStop=/var/lib/protonmail/protonmail.sh stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
#!/bin/bash
case "$1" in
start)
# will create an screen in detached mode (background) with name "protonmail"
screen -S protonmail -dm protonmail-bridge --cli
echo "Service started."
;;
status)
# ignore this block unless you understand how screen works and that only lists the current user's screens
result=$(screen -list | grep protonmail)
if [ $? == 0 ]; then
echo "Protonmail bridge service is ON."
else
echo "Protonmail bridge service is OFF."
fi
;;
stop)
# Will quit a screen called "protonmail" and therefore terminate the running protonmail-bridge process
screen -S protonmail -X quit
echo "Service stopped."
;;
*)
echo "Unknown command: $1"
exit 1
;;
esac
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFo9OeEBEAC+fPrLcUBY+YUc5YiMrYJQ6ogrJWMGC00h9fAv3PsrHkBz0z7c
QFDyNdNatokFDtZDX115M0vzDwk5NkcjmO7CWbf6nCZcwYqOSrBoH8wNT9uTS/6p
R3AHk1r3C/36QG3iWx6Wg4ycRkXWYToT3/yh5waE5BbLi/9TSBAdfJzTyxt4IpZG
3OTMnOwuz6eNRWVHkA48CJydWS6M8z+jIsBwFq4nOIChvLjIF42PuAT1VaiCYSmy
4sU1YxxWof5z9HY0XghRpd7aUIgzAIsXUb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wz2fTfdkE4CNpxlrxwfxCDVPvYTUQPzAve+qRIarRx7
K8npGSq2pMNBZLeaQXvZbslT9Scuu5NuHSCjrGQ5TpVg1yMpN39Pu3nnB0STwvOp
qcnaHGfvM0wURA7ValXh2xTLc6Oxe8hw+nAFFFXFBqou8qw1zD/DAQFUWGh+yu5q
9MxmtaewGA67fYf098EEqKql+sktYTa0cjDk6qdYkSO9clcLFkYZspmK04k2y1jO
7VYtlSdoeHH1ag+HWKx5KXdsWaE4dE+maUbcsRwc7UVC4111cv94mlOcSWpITxPG
kIV8ldNSpauzaAqHs3qaMO/5rBZbLMynvzjE30JFTdBiepvj88YeAPFols3qa8KO
00IsXQemR6I8Qw==
=QiAL
-----END PGP PUBLIC KEY BLOCK-----
@githubcom13
Copy link
Author

Sorry for my late reply, what is the error message ?
The port is probably already occupied by another process. Try to change the port in the /home/protonmail/.config/protonmail/bridge/prefs.json file.
I finish just performed a new successful installation of Protonmail bridge on a new Debian server.
I updated the tutorial.

@LukasSliacky
Copy link

LukasSliacky commented Aug 22, 2021

Thank you. Tested on clean Ubuntu Server 20.04 install and works fine (before restart).

@curtney
Copy link

curtney commented Dec 3, 2021

Wouldn't you et an access denied when you try to access the cert from user protonmail home directory?

in .mbsyncrc
CertificateFile /home/protonmail/.config/prontonmail/bridge/cert.pem

@denics
Copy link

denics commented Feb 16, 2022

Thanks for this guide. I confirm that this works fine in raspberry pi 3 with a 64bit image.

@JVT038
Copy link

JVT038 commented Feb 24, 2022

is there some way to do this on a Synology NAS? (docker?)

@jimsander
Copy link

I wasn't able to enter an empty passphrase with gpg... ended up going the --batch method

$ cat ./batchthis 
%no-protection
Key-Type:1
Key-Length:2048
Subkey-Type:1
Subkey-Length:2048
Name-Real: Foo Bar (ProtonMail)
Name-Email: foo@bar.io
Expire-Date:0

$ gpg --armor --batch --gen-key  ./batchthis

@itsathejoey
Copy link

root@dockersrv:/tmp# apt install qt5-default libqt5designer5 libqt5multimediawidgets5 libqt5quickwidgets5 libpulse-mainloop-glib0 libsecret-1-0 ttf-dejavu net-tools libsecret-common libsecret-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package qt5-default is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'qt5-default' has no installation candidate
E: Unable to locate package ttf-dejavu

@frtoor
Copy link

frtoor commented Dec 27, 2022

root@dockersrv:/tmp# apt install qt5-default libqt5designer5 libqt5multimediawidgets5 libqt5quickwidgets5 libpulse-mainloop-glib0 libsecret-1-0 ttf-dejavu net-tools libsecret-common libsecret-tools Reading package lists... Done Building dependency tree... Done Reading state information... Done Package qt5-default is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'qt5-default' has no installation candidate E: Unable to locate package ttf-dejavu

I have this issue as well. Is there an update to the dependencies?

@githubcom13
Copy link
Author

There is a way is to install all dependencies of qt5-defalt package with
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools

@with-tyler
Copy link

I have to say thank you. I was pulling my hair out for a minute adding my SMTP settings to my server instance. Your directions worked flawlessly for me. @githubcom13 THANK YOU!

@danieleperera
Copy link

Hi there,

I was able to follow the guide and installed everything correctly, however when I ran some tests with nc, telnet and swaks, i get this error:

=== Trying localhost:1025...
*** Error connecting to localhost:1025:
***     IO::Socket::INET6: connect: Connection refused

@githubcom13
Copy link
Author

Hi there,

I was able to follow the guide and installed everything correctly, however when I ran some tests with nc, telnet and swaks, i get this error:

=== Trying localhost:1025...
*** Error connecting to localhost:1025:
***     IO::Socket::INET6: connect: Connection refused

Check that port 1025 is open on your server

@ivan-boikov
Copy link

su protonmail
protonmail-bridge --cli

Does not work for me on newer versions (v.3.x.x, has worked on v1.x.x), throws

panic: runtime error: slice bounds out of range [90:63]
goroutine 1 [running]:
github.com/godbus/dbus.getSessionBusPlatformAddress()
        /home/ivan/.local/share/go/pkg/mod/github.com/godbus/dbus@v4.1.0+incompatible/conn_other.go:30 +0x1de
github.com/godbus/dbus.getSessionBusAddress()
        /home/ivan/.local/share/go/pkg/mod/github.com/godbus/dbus@v4.1.0+incompatible/conn.go:96 +0x106
github.com/godbus/dbus.SessionBusPrivate()
        /home/ivan/.local/share/go/pkg/mod/github.com/godbus/dbus@v4.1.0+incompatible/conn.go:101 +0x19
github.com/godbus/dbus.SessionBus()
        /home/ivan/.local/share/go/pkg/mod/github.com/godbus/dbus@v4.1.0+incompatible/conn.go:73 +0xc5
github.com/keybase/go-keychain/secretservice.NewService()
        /home/ivan/.local/share/go/pkg/mod/github.com/cuthix/go-keychain@v0.0.0-20220405075754-31e7cee908fe/secretservice/secretservice.go:73 +0x1d
github.com/ProtonMail/proton-bridge/v3/pkg/keychain.getSession()
        /home/ivan/.local/src/proton-bridge/pkg/keychain/helper_dbus_linux.go:43 +0x19
github.com/ProtonMail/proton-bridge/v3/pkg/keychain.(*SecretServiceDBusHelper).Add(0xc0001e8a80?, 0xc0003928d0)
        /home/ivan/.local/src/proton-bridge/pkg/keychain/helper_dbus_linux.go:98 +0x53
github.com/ProtonMail/proton-bridge/v3/pkg/keychain.isUsable({0x173aa20?, 0x217d340}, {0x0?, 0x0})
        /home/ivan/.local/src/proton-bridge/pkg/keychain/helper_linux.go:89 +0x26e
github.com/ProtonMail/proton-bridge/v3/pkg/keychain.init.0()
        /home/ivan/.local/src/proton-bridge/pkg/keychain/helper_linux.go:39 +0x52

However, it works in its own TTY. But then I have to type the email password and then bridge password manually (luckily, only once per machine).
Anyone has the same problem?

@Decoherent
Copy link

A couple thoughts here, as I'm trying to get this to work in a very low-memory system, so I don't really want a desktop environment running. This is a single-purpose VM, so I'm just using my user account. This VM is a Debian 12 server, with their GNOME desktop installed as well. I think all the packages above were OK, but I believe I also had to install dbus-x11.

This is a better way to generate gpg keys, without needing script or a separate --batch file. Replace USER with your email or something:
$ gpg --batch --passphrase '' --quick-gen-key USER default default
Check & activate the key as above.

Now I had to log into the actual desktop, which was really slow. The application "Passwords and Keys" wasn't installed by default, so I added that. Once you run it, you can right-click on the "login" keyring, and select "Change password". It'll ask for your user password, and then you can leave the new password fields blank. It warns you this is a terrible idea, but again, single-purpose VM.

Since I don't want gnome-desktop & such using up my memory, you can disable X11 on boot via:
$ sudo systemctl set-default multi-user.target
To re-enable:
$ sudo systemctl set-default graphical.target

Reboot, and give everything a try.

As a side note, I'm using getmail6 to backup up my email, and it doesn't speak STARTTLS, but there's an un-documented CLI command to switch to just "SSL":
>>> change imap-security

Of course, this option is available in the GUI client, so it's not a hack or anything. There's a similar option for SMTP, but I'm not using this for outgoing mail.
Hope this helps! And also that my notes are accurate!

@BCSharp
Copy link

BCSharp commented Nov 30, 2023

Thanks, it was useful info. I am using ProtonMail Bridge v3.6.1, which, when run with option -h, lists --noninteractive as a supported option, but although that option is accepted, it doesn't seem to do anything. Perhaps work in progress. In the meantime, for those who prefer tmux rather than screen, here is my version of protonmail.sh:

#!/bin/bash

case "$1" in
  start)
    # Will create a tmux session in detached mode (background) with name "protonmail"
    tmux new-session -d -s protonmail protonmail-bridge --cli
    echo "Service started."
    ;;
  status)
    # ignore this block unless you understand how tmux works and that it only lists the current user's sessions
    if tmux has-session -t protonmail; then
      echo "Protonmail bridge service is ON."
    else
      echo "Protonmail bridge service is OFF."
    fi
    ;;
  stop)
    # Will quit a tmux session called "protonmail" and therefore terminate the running protonmail-bridge process
    tmux kill-session -t protonmail
    echo "Service stopped."
    ;;
  *)
    echo "Unknown command: $1"
    exit 1
  ;;
esac

@mattdale77
Copy link

Thanks, it was useful info. I am using ProtonMail Bridge v3.6.1, which, when run with option -h, lists --noninteractive as a supported option, but although that option is accepted, it doesn't seem to do anything. Perhaps work in progress. In the meantime, for those who prefer tmux rather than screen, here is my version of protonmail.sh:

#!/bin/bash

case "$1" in
  start)
    # Will create a tmux session in detached mode (background) with name "protonmail"
    tmux new-session -d -s protonmail protonmail-bridge --cli
    echo "Service started."
    ;;
  status)
    # ignore this block unless you understand how tmux works and that it only lists the current user's sessions
    result=$(screen -list | grep protonmail)
    if tmux has-session -t protonmail; then
      echo "Protonmail bridge service is ON."
    else
      echo "Protonmail bridge service is OFF."
    fi
    ;;
  stop)
    # Will quit a tmux session called "protonmail" and therefore terminate the running protonmail-bridge process
    tmux kill-session -t protonmail
    echo "Service stopped."
    ;;
  *)
    echo "Unknown command: $1"
    exit 1
  ;;
esac

Your status section still references screen, I'm sure there is a simple tmux equivalent but I'd have to look it up as I'm not that familiar

@BCSharp
Copy link

BCSharp commented Apr 5, 2024

Your status section still references screen, I'm sure there is a simple tmux equivalent but I'd have to look it up as I'm not that familiar

Indeed, thanks for noticing. That line result=$(screen -list | grep protonmail) should be deleted. The tmux equivalent on on the next line. I have updated my original listing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment