diff options
author | pacien | 2017-09-07 14:27:37 +0200 |
---|---|---|
committer | pacien | 2017-09-07 14:27:37 +0200 |
commit | 4989dad67b68b38e75416916df406dcec908b399 (patch) | |
tree | 1857d313393788234ffa75b9203122d3ae822d3f /app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | |
parent | 9e5aa1a9f95a3b5541aba7e511e13ae51b614416 (diff) | |
download | tincapp-4989dad67b68b38e75416916df406dcec908b399.tar.gz |
Implement encrypted private keys support
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/commands/Tincd.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt b/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt index db113cc..d44d930 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | |||
@@ -7,14 +7,16 @@ import org.pacien.tincapp.context.AppPaths | |||
7 | */ | 7 | */ |
8 | object Tincd { | 8 | object Tincd { |
9 | 9 | ||
10 | fun start(netName: String, fd: Int) { | 10 | fun start(netName: String, deviceFd: Int, ed25519PrivateKeyFd: Int? = null, rsaPrivateKeyFd: Int? = null) { |
11 | Executor.forkExec(Command(AppPaths.tincd().absolutePath) | 11 | Executor.forkExec(Command(AppPaths.tincd().absolutePath) |
12 | .withOption("no-detach") | 12 | .withOption("no-detach") |
13 | .withOption("config", AppPaths.confDir(netName).absolutePath) | 13 | .withOption("config", AppPaths.confDir(netName).absolutePath) |
14 | .withOption("pidfile", AppPaths.pidFile(netName).absolutePath) | 14 | .withOption("pidfile", AppPaths.pidFile(netName).absolutePath) |
15 | .withOption("logfile", AppPaths.logFile(netName).absolutePath) | 15 | .withOption("logfile", AppPaths.logFile(netName).absolutePath) |
16 | .withOption("option", "DeviceType=fd") | 16 | .withOption("option", "DeviceType=fd") |
17 | .withOption("option", "Device=" + fd)) | 17 | .withOption("option", "Device=" + deviceFd) |
18 | .apply { if (ed25519PrivateKeyFd != null) withOption("option", "Ed25519PrivateKeyFile=/proc/self/fd/$ed25519PrivateKeyFd") } | ||
19 | .apply { if (rsaPrivateKeyFd != null) withOption("option", "PrivateKeyFile=/proc/self/fd/$rsaPrivateKeyFd") }) | ||
18 | } | 20 | } |
19 | 21 | ||
20 | } | 22 | } |