org.pacien.tincapp


Joining or creating a new network

This short guide explains how to generate an initial configuration for the new node, generating new private keys on the device itself. Configuration files can be edited with any Android text editor or, more conveniently, through a remote shell (by using Termux+sshd for example).

Bootstrapping the node configuration

A new node configuration and private keys can be generated by using the "Generate node configuration and keys" option on the application's configuration screen. The generated files will be written in the application's configuration directory, whose path is displayed above on the same screen.

Configuring the network interface

A minimal configuration specifying an IP address and a route can be as short as follows:

echo "Address = 10.0.0.100/32
Route = 10.0.0.0/24" >> $confdir/$netname/network.conf

Deploying host files

Nodes host files can be copied from and to the network's hosts directory as usual.

Quite Easily Done.


Joining a network via invitation URL

A network can be joined using a tinc 1.1 invitation URL. The node and its network interface configuration files are automatically created from the data received from the server. Key pairs are also generated and exchanged with the inviting server.

Generating an invitation

An invitation can be generated by using the tinc -n <netname> invite [nodename] command on the "server" side. An IP address and some routes can be added to the generated invitation file with the Ifconfig and Route parameters:

Name = client
Netname = vpn
ConnectTo = server
Ifconfig = 10.0.0.100/32
Route = 10.0.0.0/24
#-------------------------------------#
Name = server
Ed25519PublicKey = ...
Address = server.example.com

Joining using the invitation

The network can be joined from the configuration screen, by selecting "Join network via invitation URL" and pasting the invitation URL in the appearing input dialog. This will write the node and network configuration files, as well as the generated keys into the configuration directory displayed above on the same screen.

Quite Easily Done.


Migrating from other tinc Android apps

It is possible to migrate from other Android ports of tinc to tinc app while keeping an existing tinc network configuration with some adjustments, provided that the underlying tinc daemon was operating in router mode using a tun device.

Restoring system state

All other VPN applications must be stopped before using tinc app, whether or not they are using the Android VPN API. It is recommended to disable any autostart option in the former ones.

Some applications (such as Vilbrekin's Tinc GUI) may have required altering system routing tables to operate correctly. Those tables must be restored to their original state before using tinc app. This can be done simply by rebooting the device.

Copying and adapting configuration files and keys

A tinc network configuration directory can be imported in tinc app by copying it to the application's configuration directory (whose path is displayed on the configuration screen.

The tinc.conf file the current host's file in the hosts directory must be modified to take those platform specificities into account. In particular, a ramdom unprivileged port may be set in the current host's file as follows:

echo "Port = `shuf -i 1024-65535 -n 1`" >> $confdir/$netname/hosts/$hostname

The network interface configuration for IP allocation, route and DNS servers definition previously done in hook scripts (such as tinc-up) must converted into parameters in a network interface definition file, named network.conf. Usable parameters are listed here. Commands from an example tinc-up file can be translated into network.conf parameters as follows:

ifconfig $INTERFACE 10.0.0.100              ->  Address = 10.0.0.100/32
ip route add 10.0.0.0/24 dev $INTERFACE     ->  Route = 10.0.0.0/24
setprop net.eth0.dns1 10.0.0.1              ->  DNSServer = 10.0.0.1

Quite Easily Done.


Automating VPN connections

Connections can be managed from automation and scripting Android applications (such as LlamaLab Automate, Tasker or Locale) by using Intents to start or terminate VPN connections based on time, location, or network availability for example.

Connecting using an Intent

A connection can be initiated by starting an Activity with the following Intent parameters, replacing $netname and optionally $passphrase with arbitrary values:

ACTION = "org.pacien.tincapp.intent.action.CONNECT"
DATA URI = tinc:$netname#$passphrase
FLAGS = FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

Disconnecting using an Intent

A currently active connection can be terminated by starting an Activity with the following Intent parameters:

ACTION = "org.pacien.tincapp.intent.action.DISCONNECT"
FLAGS = FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

Quite Easily Done.