Adding headless capabilities to the Tresorit backup software using Xpra / Winswitch in Linux

Recently I have changed my backup solution from SpiderOak to Tresorit. I have been very happy with SpiderOak since I started with them around 2009, But last year backups and sync started to fail. Eg: backups taking ages or not finishing at all, etc. Also support response time was not good enough and didn’t find a proper fix for my problems, so finally I decided to move my business elsewhere. The chosen one was Tresorit, a Swiss based company that offered two things important for me de-duplication and client side encryption.

Both solutions works in Linux but Tresorit needs a GUI to work (SpiderOak support a headless mode). This was a problem as I wanted to run the Tresorit client in a headless VPS servers. To add a kind of pseudo headless support to the Tresorit client I decided to use the Xpra software a multi-platform (Microsoft Windows, Linux, Mac) screen and application forwarding system or as they say in the web page “screen for X11”.

To use the Xpra it is necessary to install it as usually is not installed by default by the different Linux distribution. In fact we are gonna install Winswitch which is a front-end for Xpra which also supports VNC, NX, RDP, SSH, etc.

It is recommended to install the software from project’s repositories as distribution’s repositories are often not updated.

The links and instructions can be found in the Xpra downloads page. In my case I am gonna install it in a Debian stretch server. The instructions are:

Administrator privileges

sudo su -

Import the packager’s key

apt-get install curl
curl http://winswitch.org/gpg.asc | apt-key add -

Debian Stretch

echo "deb http://winswitch.org/ stretch main" > /etc/apt/sources.list.d/winswitch.list;
apt-get update;
apt-get install winswitch

Both Xpra / Winswitch are installed in our system.

Let’s suppose the Tresorit client is already downloaded using Tresorit’s Linux download page, and installed using Tresorit’s Linux instruction page.

At this Tresorit  point can be launched from the user’s home folder

~/.local/share/tresorit/tresorit

If a DISPLAY local or forwarded is available the Tresorit GUI will be shown and the backup process will start and here resides the problem. The GUI will not be shown in headless servers like VPS or servers without X-Windows started or even in servers without the user logged on. This is a big problem as the backup should be independent if the user is logged or not or if it has X-Windows.

Xpra can launch applications that are GUI dependent and keep the GUI in a pseudo DISPLAY that can be accessed later from the same or different computer.

To launch the client and keep it in this pseudo DISPLAY:

xpra start :100 --start-child=/home/USER/.local/share/tresorit/tresorit

This command will launch the client in the pseudo DISPLAY :100. So the GUI will start and the backup will run.

Existing Xpra session can be listed using:

xpra list
Found the following xpra sessions:
/var/run/user/1000/xpra:
        LIVE session at :100
/home/juan/.xpra:
        LIVE session at :100

So there is a session listening in the :100 pseudo DISPLAY

To attach to the running session:

xpra attach :100

And the GUI will appear embedded in a Xpra window. The windows tittle shows: Tresorit Premiun on mediacenter.vnet. Where mediacenter is the server where the client is running.

If we close this windows the Tresorit application will continue running as we have closed the windows that connect to the Xpra, not the application itself, so we can connect again to the session with the same command.

xpra attach :100

In a way we can say the we have “daemonized the application’s GUI”.

The last step is to add to the cron the right entry to ensure that our daemonized application will start on all server start.

@reboot xpra start :100 --start-child=/home/USER/.local/share/tresorit/tresorit

Another useful commands are

xpra stop :100

To stop application running in the :100 pseudo display

And finally Xpra support connect to a remote pseudo DISPLAYS using ssh

xpra attach ssh/juan@localhost/100

This is a very useful feature as if we have several clients running in several servers all of then can be checked remotely 🙂

Xpra is a fantastic tool that allow GUI daemonization, remote desktop sharing, remote application sharing. As they say: “screen for X11” or as I am a tmux guy “Tmux for X11”

Share

Leave a Reply

Your email address will not be published. Required fields are marked *