From 8afb12184176c54904d44dc2c9bbc0dc5fec3dac Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Sun, 2 Jul 2017 19:10:59 +0200 Subject: [PATCH 01/22] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d111a44..d3a1ba5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build Status](https://travis-ci.org/cryptomator/cli.svg?branch=develop)](https://travis-ci.org/cryptomator/cli) +[![Latest Release](https://img.shields.io/github/release/cryptomator/cli.svg)](https://github.com/cryptomator/cli/releases/latest) # Cryptomator CLI version From 812023b3b39301d08d6db448bba5a57b8d332701 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Sun, 2 Jul 2017 19:12:52 +0200 Subject: [PATCH 02/22] Update README.md [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3a1ba5..1bcfdc5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build Status](https://travis-ci.org/cryptomator/cli.svg?branch=develop)](https://travis-ci.org/cryptomator/cli) -[![Latest Release](https://img.shields.io/github/release/cryptomator/cli.svg)](https://github.com/cryptomator/cli/releases/latest) +[![Latest Release](https://img.shields.io/github/release/cryptomator/cli/all.svg)](https://github.com/cryptomator/cli/releases/latest) # Cryptomator CLI version From 6ccfd79a562c6f06f0662d866769b07c0cbfc187 Mon Sep 17 00:00:00 2001 From: Sebastian Dietrich Date: Sun, 9 Jul 2017 23:15:03 +0200 Subject: [PATCH 03/22] Change the bind IP in the commandline example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d111a44..74fdd8d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Cryptomator CLI depends on a Java 8 JRE. In addition the JCE unlimited strength java -jar cryptomator-cli-x.y.z.jar \ --vault demoVault=/path/to/vault --password demoVault=topSecret \ --vault otherVault=/path/to/differentVault --passwordfile otherVault=/path/to/fileWithPassword \ - --bind 0.0.0.0 --port 8080 + --bind 127.0.0.1 --port 8080 # you can now mount http://localhost:8080/demoVault/ ``` From fff9d4f867806ea74fd961a615db3406a7d9c953 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 20 Sep 2017 10:55:21 +0200 Subject: [PATCH 04/22] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 517a5d2..e772ae9 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,12 @@ java -jar cryptomator-cli-x.y.z.jar \ # you can now mount http://localhost:8080/demoVault/ ``` +Then you can access the vault using any WebDAV client, e.g. using `davfs2`: + +```sh +sudo mount -t davfs http://localhost:8080/demoVault/ /media/your/mounted/folder +``` + ## License This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license derived from the LGPL for independent software vendors and resellers. If you want to use this library in applications, that are *not* licensed under the AGPL, feel free to contact our [support team](https://cryptomator.org/help/). From e3d32aaaebdab0ef228a673606525537d661df4c Mon Sep 17 00:00:00 2001 From: David Pache Date: Wed, 20 Sep 2017 15:32:16 +0200 Subject: [PATCH 05/22] added basic instruction for creating a mount point --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e772ae9..6c6991a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,14 @@ java -jar cryptomator-cli-x.y.z.jar \ Then you can access the vault using any WebDAV client, e.g. using `davfs2`: +First you need to creat a mount point for your vault + +```sh +sudo mkdir /media/your/mounted/folder +``` + +Then you can mount the vault + ```sh sudo mount -t davfs http://localhost:8080/demoVault/ /media/your/mounted/folder ``` From 174eebb2d57d81f5abc7aefa332451d71dae18f0 Mon Sep 17 00:00:00 2001 From: David Pache Date: Wed, 20 Sep 2017 15:35:03 +0200 Subject: [PATCH 06/22] added basic instruction to unmount the vault --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6c6991a..b06d647 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ Then you can mount the vault sudo mount -t davfs http://localhost:8080/demoVault/ /media/your/mounted/folder ``` +To "eject"/unmount the vault use + +```sh +sudo umount /media/your/mounted/folder +``` + ## License This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license derived from the LGPL for independent software vendors and resellers. If you want to use this library in applications, that are *not* licensed under the AGPL, feel free to contact our [support team](https://cryptomator.org/help/). From 842d51f7bab748f65b157277629be5ee1f693454 Mon Sep 17 00:00:00 2001 From: David Pache Date: Wed, 20 Sep 2017 19:11:16 +0200 Subject: [PATCH 07/22] Update README.md fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b06d647..fa72402 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ java -jar cryptomator-cli-x.y.z.jar \ Then you can access the vault using any WebDAV client, e.g. using `davfs2`: -First you need to creat a mount point for your vault +First you need to create a mount point for your vault ```sh sudo mkdir /media/your/mounted/folder From 7bf9dc06af5985a9afead5a9689ceb03f2088744 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 22 Sep 2017 22:03:06 +0200 Subject: [PATCH 08/22] Update README.md --- README.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fa72402..2ddbc42 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ [![Build Status](https://travis-ci.org/cryptomator/cli.svg?branch=develop)](https://travis-ci.org/cryptomator/cli) [![Latest Release](https://img.shields.io/github/release/cryptomator/cli/all.svg)](https://github.com/cryptomator/cli/releases/latest) -# Cryptomator CLI version +# Cryptomator CLI -This is a minimal command line program which unlocks vaults, which can then be accessed via an embedded WebDAV server. +This is a minimal command-line program that unlocks vaults which can then be accessed via an embedded WebDAV server. ## Disclaimer @@ -11,9 +11,9 @@ This project is in an early stage and not ready for production use. We recommend ## Download and Usage -Download the jar file via [GitHub Releases](https://github.com/cryptomator/cli/releases) +Download the jar file via [GitHub Releases](https://github.com/cryptomator/cli/releases). -Cryptomator CLI depends on a Java 8 JRE. In addition the JCE unlimited strength policy files (needed for 256-bit keys) must be installed. +Cryptomator CLI depends on Java 8. In addition, the JCE unlimited strength policy files must be installed (needed for 256-bit keys). ```sh java -jar cryptomator-cli-x.y.z.jar \ @@ -23,9 +23,11 @@ java -jar cryptomator-cli-x.y.z.jar \ # you can now mount http://localhost:8080/demoVault/ ``` -Then you can access the vault using any WebDAV client, e.g. using `davfs2`: +Then you can access the vault using any WebDAV client. -First you need to create a mount point for your vault +### Linux via davfs2 + +First, you need to create a mount point for your vault ```sh sudo mkdir /media/your/mounted/folder @@ -37,12 +39,26 @@ Then you can mount the vault sudo mount -t davfs http://localhost:8080/demoVault/ /media/your/mounted/folder ``` -To "eject"/unmount the vault use +To unmount the vault, run ```sh sudo umount /media/your/mounted/folder ``` +### macOS via AppleScript + +Mount the vault with + +```sh +osascript -e 'mount volume "http://localhost:8080/demoVault/"' +``` + +Unmount the vault with + +```sh +osascript -e 'tell application "Finder" to if "demoVault" exists then eject "demoVault"' +``` + ## License This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license derived from the LGPL for independent software vendors and resellers. If you want to use this library in applications, that are *not* licensed under the AGPL, feel free to contact our [support team](https://cryptomator.org/help/). From 5c1f4862f8f608aebce18da49207e4f1f792b61d Mon Sep 17 00:00:00 2001 From: didlich Date: Wed, 20 Dec 2017 22:11:13 +0100 Subject: [PATCH 09/22] implement showing password prompt if password not provided implements feature https://github.com/cryptomator/cli/issues/11 --- .gitignore | 2 + src/main/java/org/cryptomator/cli/Args.java | 59 ++++++++++--------- .../org/cryptomator/cli/CryptomatorCli.java | 12 ++-- .../cli/pwd/PasswordFromFileStrategy.java | 43 ++++++++++++++ .../cli/pwd/PasswordFromPropertyStrategy.java | 29 +++++++++ .../cli/pwd/PasswordFromStdInputStrategy.java | 52 ++++++++++++++++ .../cryptomator/cli/pwd/PasswordStrategy.java | 6 ++ 7 files changed, 169 insertions(+), 34 deletions(-) create mode 100644 src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java create mode 100644 src/main/java/org/cryptomator/cli/pwd/PasswordFromPropertyStrategy.java create mode 100644 src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java create mode 100644 src/main/java/org/cryptomator/cli/pwd/PasswordStrategy.java diff --git a/.gitignore b/.gitignore index 5ddd9fc..3ef5c20 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ test-output/ out/ .idea_modules/ *.iws + +*.iml \ No newline at end of file diff --git a/src/main/java/org/cryptomator/cli/Args.java b/src/main/java/org/cryptomator/cli/Args.java index c87b0cf..13de342 100644 --- a/src/main/java/org/cryptomator/cli/Args.java +++ b/src/main/java/org/cryptomator/cli/Args.java @@ -8,14 +8,12 @@ *******************************************************************************/ package org.cryptomator.cli; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.DefaultParser; @@ -23,6 +21,10 @@ import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import org.cryptomator.cli.pwd.PasswordFromFileStrategy; +import org.cryptomator.cli.pwd.PasswordFromStdInputStrategy; +import org.cryptomator.cli.pwd.PasswordStrategy; +import org.cryptomator.cli.pwd.PasswordFromPropertyStrategy; /** * Parses program arguments. Does not validate them. @@ -76,10 +78,7 @@ public class Args { private final Properties vaultPaths; private final Properties vaultPasswords; private final Properties vaultPasswordFiles; - - private boolean hasPasswordOrPasswordFile(Object vaultPath) { - return vaultPasswords.containsKey(vaultPath) || vaultPasswordFiles.containsKey(vaultPath); - } + private final Map passwordStrategies; public Args(CommandLine commandLine) throws ParseException { this.bindAddr = commandLine.getOptionValue("bind", "localhost"); @@ -87,6 +86,7 @@ public Args(CommandLine commandLine) throws ParseException { this.vaultPaths = commandLine.getOptionProperties("vault"); this.vaultPasswords = commandLine.getOptionProperties("password"); this.vaultPasswordFiles = commandLine.getOptionProperties("passwordfile"); + this.passwordStrategies = new HashMap<>(); } public String getBindAddr() { @@ -98,32 +98,13 @@ public int getPort() { } public Set getVaultNames() { - return vaultPaths.keySet().stream().filter(this::hasPasswordOrPasswordFile).map(String.class::cast).collect(Collectors.toSet()); + return vaultPaths.keySet().stream().map(String.class::cast).collect(Collectors.toSet()); } public String getVaultPath(String vaultName) { return vaultPaths.getProperty(vaultName); } - public String getVaultPasswordPath(String vaultName) { - return vaultPasswordFiles.getProperty(vaultName); - } - - public String getVaultPassword(String vaultName) { - if (vaultPasswords.getProperty(vaultName) == null) { - Path vaultPasswordPath = Paths.get(vaultPasswordFiles.getProperty(vaultName)); - if (Files.isReadable(vaultPasswordPath) && Files.isRegularFile(vaultPasswordPath)) { - try (Stream lines = Files.lines(vaultPasswordPath)) { - return lines.findFirst().get().toString(); - } catch (IOException e) { - return null; - } - } - return null; - } - return vaultPasswords.getProperty(vaultName); - } - public static Args parse(String[] arguments) throws ParseException { CommandLine commandLine = new DefaultParser().parse(OPTIONS, arguments); return new Args(commandLine); @@ -133,4 +114,26 @@ public static void printUsage() { new HelpFormatter().printHelp(USAGE, OPTIONS); } + public PasswordStrategy addPasswortStrategy(final String vaultName) { + PasswordStrategy passwordStrategy = new PasswordFromStdInputStrategy(vaultName); + + if (vaultPasswords.getProperty(vaultName) != null) { + passwordStrategy = new PasswordFromPropertyStrategy( + vaultName, + vaultPasswords.getProperty(vaultName) + ); + } else if (vaultPasswordFiles.getProperty(vaultName) != null) { + passwordStrategy = new PasswordFromFileStrategy( + vaultName, + Paths.get(vaultPasswordFiles.getProperty(vaultName)) + ); + } + + this.passwordStrategies.put(vaultName, passwordStrategy); + return passwordStrategy; + } + + public PasswordStrategy getPasswordStrategy(final String vaultName) { + return passwordStrategies.get(vaultName); + } } diff --git a/src/main/java/org/cryptomator/cli/CryptomatorCli.java b/src/main/java/org/cryptomator/cli/CryptomatorCli.java index 76ec3df..ab7940b 100644 --- a/src/main/java/org/cryptomator/cli/CryptomatorCli.java +++ b/src/main/java/org/cryptomator/cli/CryptomatorCli.java @@ -12,6 +12,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Set; import org.apache.commons.cli.ParseException; import org.cryptomator.cryptofs.CryptoFileSystemProperties; @@ -40,22 +41,21 @@ public static void main(String[] rawArgs) throws IOException { } private static void validate(Args args) throws IllegalArgumentException { + Set vaultNames = args.getVaultNames(); if (args.getPort() < 0 || args.getPort() > 65536) { throw new IllegalArgumentException("Invalid WebDAV Port."); } - if (args.getVaultNames().size() == 0) { + if (vaultNames.size() == 0) { throw new IllegalArgumentException("No vault specified."); } - for (String vaultName : args.getVaultNames()) { + for (String vaultName : vaultNames) { Path vaultPath = Paths.get(args.getVaultPath(vaultName)); - if ((args.getVaultPasswordPath(vaultName) != null) && args.getVaultPassword(vaultName) == null) { - throw new IllegalArgumentException("Cannot read password from file: " + Paths.get(args.getVaultPasswordPath(vaultName))); - } if (!Files.isDirectory(vaultPath)) { throw new IllegalArgumentException("Not a directory: " + vaultPath); } + args.addPasswortStrategy(vaultName).validate(); } } @@ -67,7 +67,7 @@ private static void startup(Args args) throws IOException { for (String vaultName : args.getVaultNames()) { Path vaultPath = Paths.get(args.getVaultPath(vaultName)); LOG.info("Unlocking vault \"{}\" located at {}", vaultName, vaultPath); - String vaultPassword = args.getVaultPassword(vaultName); + String vaultPassword = args.getPasswordStrategy(vaultName).password(); CryptoFileSystemProperties properties = CryptoFileSystemProperties.cryptoFileSystemProperties().withPassphrase(vaultPassword).build(); Path vaultRoot = CryptoFileSystemProvider.newFileSystem(vaultPath, properties).getPath("/"); WebDavServletController servlet = server.createWebDavServlet(vaultRoot, vaultName); diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java new file mode 100644 index 0000000..f32f193 --- /dev/null +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java @@ -0,0 +1,43 @@ +package org.cryptomator.cli.pwd; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +public class PasswordFromFileStrategy implements PasswordStrategy { + private static final Logger LOG = LoggerFactory.getLogger(PasswordFromFileStrategy.class); + + private final String vaultName; + private final Path pathToFile; + + public PasswordFromFileStrategy(final String vaultName, final Path pathToFile) { + this.vaultName = vaultName; + this.pathToFile = pathToFile; + } + + @Override + public String password() { + LOG.info("Vault " + "'" + vaultName + "'" + " password from file."); + + if (Files.isReadable(pathToFile) && Files.isRegularFile(pathToFile)) { + try (Stream lines = Files.lines(pathToFile)) { + return lines.findFirst().get().toString(); + } catch (IOException e) { + return null; + } + } + return null; + } + + @Override + public void validate() throws IllegalArgumentException { + if (!Files.isReadable(pathToFile) || !Files.isRegularFile(pathToFile)) { + throw new IllegalArgumentException("Cannot read password from file: " + pathToFile); + } + } + +} diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordFromPropertyStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordFromPropertyStrategy.java new file mode 100644 index 0000000..8d5909b --- /dev/null +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordFromPropertyStrategy.java @@ -0,0 +1,29 @@ +package org.cryptomator.cli.pwd; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PasswordFromPropertyStrategy implements PasswordStrategy { + private static final Logger LOG = LoggerFactory.getLogger(PasswordFromPropertyStrategy.class); + + private final String vaultName; + private final String password; + + public PasswordFromPropertyStrategy(final String vaultName, final String password) { + this.vaultName = vaultName; + this.password = password; + } + + @Override + public String password() { + LOG.info("Vault " + "'" + vaultName + "'" + " password from property."); + return this.password; + } + + @Override + public void validate() throws IllegalArgumentException { + if (password.equals("")) { + throw new IllegalArgumentException("Invalid password"); + } + } +} diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java new file mode 100644 index 0000000..9614287 --- /dev/null +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java @@ -0,0 +1,52 @@ +package org.cryptomator.cli.pwd; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.Console; +import java.io.IOException; +import java.io.InputStreamReader; + +public class PasswordFromStdInputStrategy implements PasswordStrategy { + private static final Logger LOG = LoggerFactory.getLogger(PasswordFromStdInputStrategy.class); + + private final String vaultName; + + public PasswordFromStdInputStrategy(final String vaultName) { + this.vaultName = vaultName; + } + + @Override + public String password() { + LOG.info("Vault " + "'" + vaultName + "'" + " password from standard input."); + + String password = ""; + Console console = System.console(); + if (console == null) { + LOG.warn("No console: non-interactive mode, instead use insecure replacement, PW is shown!"); + + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + LOG.info("Enter password: "); + + try { + password = reader.readLine(); + } catch (IOException e) { + LOG.error("There was an error reading line from console."); + e.printStackTrace(); + } + } else { + LOG.info("Enter password: "); + password = new String(console.readPassword()); + } + + return password; + } + + @Override + public void validate() throws IllegalArgumentException { + if (vaultName.equals("")) { + throw new IllegalArgumentException("Invalid vault name"); + } + } +} diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordStrategy.java new file mode 100644 index 0000000..adf7c89 --- /dev/null +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordStrategy.java @@ -0,0 +1,6 @@ +package org.cryptomator.cli.pwd; + +public interface PasswordStrategy { + String password(); + void validate() throws IllegalArgumentException; +} From dc6f07623bba46f9aa598544eb48d7561f606fad Mon Sep 17 00:00:00 2001 From: didlich Date: Tue, 26 Dec 2017 11:40:04 +0100 Subject: [PATCH 10/22] use only Files.isReadable() to avoid problems in rare cases --- .../java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java index f32f193..cd20261 100644 --- a/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordFromFileStrategy.java @@ -35,7 +35,7 @@ public String password() { @Override public void validate() throws IllegalArgumentException { - if (!Files.isReadable(pathToFile) || !Files.isRegularFile(pathToFile)) { + if (!Files.isReadable(pathToFile)) { throw new IllegalArgumentException("Cannot read password from file: " + pathToFile); } } From 5dc24090672517a4131dcfede13fb15934ec5ab0 Mon Sep 17 00:00:00 2001 From: didlich Date: Tue, 26 Dec 2017 11:41:40 +0100 Subject: [PATCH 11/22] use explicit stdout to show password input message --- .../cryptomator/cli/pwd/PasswordFromStdInputStrategy.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java b/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java index 9614287..e374e7f 100644 --- a/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java +++ b/src/main/java/org/cryptomator/cli/pwd/PasswordFromStdInputStrategy.java @@ -12,6 +12,7 @@ public class PasswordFromStdInputStrategy implements PasswordStrategy { private static final Logger LOG = LoggerFactory.getLogger(PasswordFromStdInputStrategy.class); private final String vaultName; + private final String inputMessage = "Enter password for vault '%s': "; public PasswordFromStdInputStrategy(final String vaultName) { this.vaultName = vaultName; @@ -27,7 +28,7 @@ public String password() { LOG.warn("No console: non-interactive mode, instead use insecure replacement, PW is shown!"); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - LOG.info("Enter password: "); + System.out.println(String.format(inputMessage, vaultName)); try { password = reader.readLine(); @@ -36,7 +37,7 @@ public String password() { e.printStackTrace(); } } else { - LOG.info("Enter password: "); + System.out.println(String.format(inputMessage, vaultName)); password = new String(console.readPassword()); } From 333c6ba8a91eea275d2f501e570e4d6678c81658 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 14:55:03 +0200 Subject: [PATCH 12/22] updating essential dependencies --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0bba46a..a50e3aa 100644 --- a/pom.xml +++ b/pom.xml @@ -8,10 +8,10 @@ https://github.com/cryptomator/cli - 1.4.0 - 0.6.2 1.3.1 1.2.2 + 1.9.10 + 1.0.11 1.8 UTF-8 From 1f51991675aced15d7f0ac84c44b08e39fd1c760 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 15:10:57 +0200 Subject: [PATCH 13/22] updating java to version 11 and non-core dependencies --- README.md | 2 +- pom.xml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2ddbc42..abf1200 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This project is in an early stage and not ready for production use. We recommend Download the jar file via [GitHub Releases](https://github.com/cryptomator/cli/releases). -Cryptomator CLI depends on Java 8. In addition, the JCE unlimited strength policy files must be installed (needed for 256-bit keys). +Cryptomator CLI requires that at least JDK 11 is present on your system. ```sh java -jar cryptomator-cli-x.y.z.jar \ diff --git a/pom.xml b/pom.xml index a50e3aa..7002e4a 100644 --- a/pom.xml +++ b/pom.xml @@ -8,12 +8,12 @@ https://github.com/cryptomator/cli - 1.3.1 - 1.2.2 1.9.10 1.0.11 + 1.4 + 1.2.3 - 1.8 + 11 UTF-8 @@ -71,17 +71,18 @@ maven-compiler-plugin - 3.6.1 + 3.8.1 ${java.version} ${java.version} + ${java.version} true maven-assembly-plugin - 3.0.0 + 3.3.0 make-assembly From fe9b62beeee5cc2f862f1f6e77af2b17ab926109 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 15:49:05 +0200 Subject: [PATCH 14/22] switch from travis ci to github actions --- .github/workflows/build.yml | 63 +++++++++++++++++++++++++++++++++++++ .travis.yml | 24 -------------- README.md | 2 +- 3 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6e96854 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build + +on: + [push] + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 14 + - uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Ensure to use tagged version + run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' + if: startsWith(github.ref, 'refs/tags/') + - name: Build and Test + run: mvn -B install + - name: Upload cryptomator-cli-XXX.jar + uses: actions/upload-artifact@v1 + with: + name: cryptomator-cli.jar + path: target/cryptomator-cli-*.jar + + release: + name: Draft a Release on GitHub Releases + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download cryptomator-cli.jar + uses: actions/download-artifact@v1 + with: + name: cryptomator-cli.jar + path: . + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: | + :construction: Work in Progress + draft: true + prerelease: false + - name: Upload cryptomator-cli.jar to GitHub Releases + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: cryptomator-cli.jar + asset_name: cryptomator-cli-${{ github.ref }}.jar + asset_content_type: application/jar diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f862116..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: java -sudo: false -jdk: -- oraclejdk8 -install: -- mvn dependency:go-offline -script: -- mvn clean install -cache: - directories: - - "$HOME/.m2" -deploy: -- provider: releases - api_key: - secure: wclnmySSl1rMEWn5oe2cB1YamgmubDJxLo3vaQtpyKAVqdN6sy0VKa2/UjucxZY2mHJKQjWSjhpXSpROH2Ufp0RoC9wsBaICa+dEDcFO8dxxsczuOHsJzTr8ewfaIMzaPVxltOtyhEQcA+u5oX5l8aWFHpqYD8V86NKo5l0PF9wGTrjSksbzDq44lmU/dzjC1VaDjLTIjaGsqYQf6b3SXD8k3Loo1vlp/OFAryvOSZU9/53b7KfpAx7FckYZHLPOEPQDUIpKr5xTr2dRATaHXxT/9xqiIZz7kHOGDQYLo3lszdQdU+N8oL50RrPvkBtEFHIALv66CclTlP+Z6FoSLAgv13u+b2XpdmG/VeI1MM4tdW9fDPAQ1AQrH5nqiM4sKOLeViPtXYuKwH8TvNsTIA1Jl6QqjfmbEEGDefWUiRcc/g/O6Rxz3hjBB5lDvyKpT8nfuk0j1qYlLPjTuaGGRP5Ajjw+rGx4nTfA38Me5dldZ67bmbuBVDEKvSctTF86nntQm0Xf7vSUkd2eRZGT0Tj4SzeLVSroqFMOhlYqbNz4Zc67QwtRAjd3y5+6HqjwiVzzJM747PNFpy5jPee71z/Sdw/RtIGv0TroJmSwoIlJjbRYiYXT176xKZtzrOAUHwhDytzRqMi6DZj+ZSROOX+Rdwuc+lRRgvdFMDngMQI= - file_glob: true - file: - - "target/cryptomator-cli-*.jar" - skip_cleanup: true - prerelease: true - on: - repo: cryptomator/cli - branch: master - tags: true diff --git a/README.md b/README.md index abf1200..fe24100 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/cryptomator/cli.svg?branch=develop)](https://travis-ci.org/cryptomator/cli) +[![Build](https://github.com/cryptomator/cli/workflows/Build/badge.svg)](https://github.com/cryptomator/cli/actions?query=workflow%3ABuild) [![Latest Release](https://img.shields.io/github/release/cryptomator/cli/all.svg)](https://github.com/cryptomator/cli/releases/latest) # Cryptomator CLI From 94643c52ccfdb0463a2153e77d47ad5afcd5b052 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 17:17:37 +0200 Subject: [PATCH 15/22] updating github action workflow file --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e96854..e784cb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: - name: Build and Test run: mvn -B install - name: Upload cryptomator-cli-XXX.jar - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: cryptomator-cli.jar path: target/cryptomator-cli-*.jar From 72ef2fb052e32504f327e0a6a8f4e1f2c33d78c3 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:12:39 +0200 Subject: [PATCH 16/22] Update workflow "build" to read out and propagate the version --- .github/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e784cb3..ec9c123 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ jobs: build: name: Build and Test runs-on: ubuntu-latest + outputs: + artifact-version: ${{ steps.setversion.outputs.version }} steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -21,12 +23,17 @@ jobs: - name: Ensure to use tagged version run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' if: startsWith(github.ref, 'refs/tags/') + - name: Export the build version to the environment and fix it as an ouput of this job + id: setversion + run: | + echo "::set-env name=BUILD_VERSION::$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)" + echo "::set-output name=version::${BUILD_VERSION}" - name: Build and Test run: mvn -B install - - name: Upload cryptomator-cli-XXX.jar + - name: Upload snapshot artifact cryptomator-cli-${{ BUILD_VERSION }}.jar uses: actions/upload-artifact@v2 with: - name: cryptomator-cli.jar + name: cryptomator-cli-${{ BUILD_VERSION }}.jar path: target/cryptomator-cli-*.jar release: @@ -38,7 +45,7 @@ jobs: - name: Download cryptomator-cli.jar uses: actions/download-artifact@v1 with: - name: cryptomator-cli.jar + name: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar path: . - name: Create Release id: create_release @@ -59,5 +66,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: cryptomator-cli.jar - asset_name: cryptomator-cli-${{ github.ref }}.jar + asset_name: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar asset_content_type: application/jar From 5e897e81c22efb53ec22c7b8ff311b26a08a7f74 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:13:45 +0200 Subject: [PATCH 17/22] Update workflow "build" --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec9c123..1240505 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: echo "::set-output name=version::${BUILD_VERSION}" - name: Build and Test run: mvn -B install - - name: Upload snapshot artifact cryptomator-cli-${{ BUILD_VERSION }}.jar + - name: Upload snapshot artifact cryptomator-cli-XXX.jar uses: actions/upload-artifact@v2 with: name: cryptomator-cli-${{ BUILD_VERSION }}.jar From 17a43a3d74ecf11d1d76804de1841a412f92d087 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:20:24 +0200 Subject: [PATCH 18/22] Updating github actions workflow "build": * adding workflow wide version info --- .github/workflows/build.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1240505..99db079 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,9 @@ name: Build on: [push] +env: + BUILD_VERSION: SNAPSHOT + jobs: build: name: Build and Test @@ -26,14 +29,15 @@ jobs: - name: Export the build version to the environment and fix it as an ouput of this job id: setversion run: | - echo "::set-env name=BUILD_VERSION::$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)" - echo "::set-output name=version::${BUILD_VERSION}" + v=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) + echo "::set-env name=BUILD_VERSION::${v}" + echo "::set-output name=version::${v}" - name: Build and Test run: mvn -B install - - name: Upload snapshot artifact cryptomator-cli-XXX.jar + - name: Upload snapshot artifact cryptomator-cli-${{ BUILD_VERSION }}.jar uses: actions/upload-artifact@v2 with: - name: cryptomator-cli-${{ BUILD_VERSION }}.jar + name: cryptomator-cli-${BUILD_VERSION}.jar path: target/cryptomator-cli-*.jar release: From da0993961c166e8a0d54ece431a1ac811dd4f182 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:29:12 +0200 Subject: [PATCH 19/22] Updating github actions workflow "build": * access environment correctly --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99db079..bbd7871 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,10 +34,10 @@ jobs: echo "::set-output name=version::${v}" - name: Build and Test run: mvn -B install - - name: Upload snapshot artifact cryptomator-cli-${{ BUILD_VERSION }}.jar + - name: Upload snapshot artifact cryptomator-cli-${{ env.BUILD_VERSION }}.jar uses: actions/upload-artifact@v2 with: - name: cryptomator-cli-${BUILD_VERSION}.jar + name: cryptomator-cli-${{ env.BUILD_VERSION }}.jar path: target/cryptomator-cli-*.jar release: From 5aeff9bb878a2dd8ddd4993f05b1c03b42f20c02 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:42:22 +0200 Subject: [PATCH 20/22] Updating github actions workflow "build": * restrict env var BUILD_VERSION to job environment * update descriptions of steps * fix asset path for uploading release assets --- .github/workflows/build.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbd7871..57087b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,15 +3,14 @@ name: Build on: [push] -env: - BUILD_VERSION: SNAPSHOT - jobs: build: name: Build and Test runs-on: ubuntu-latest outputs: artifact-version: ${{ steps.setversion.outputs.version }} + env: + BUILD_VERSION: SNAPSHOT steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -26,7 +25,7 @@ jobs: - name: Ensure to use tagged version run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' if: startsWith(github.ref, 'refs/tags/') - - name: Export the build version to the environment and fix it as an ouput of this job + - name: Export the project version to the job environment and fix it as an ouput of this job id: setversion run: | v=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) @@ -37,11 +36,11 @@ jobs: - name: Upload snapshot artifact cryptomator-cli-${{ env.BUILD_VERSION }}.jar uses: actions/upload-artifact@v2 with: - name: cryptomator-cli-${{ env.BUILD_VERSION }}.jar + name: cryptomator-cli-${{ jobs.build.env.BUILD_VERSION }}.jar path: target/cryptomator-cli-*.jar release: - name: Draft a Release on GitHub Releases + name: Draft a Release on GitHub Releases and uploads the build artifacts to it runs-on: ubuntu-latest needs: build if: startsWith(github.ref, 'refs/tags/') @@ -63,12 +62,12 @@ jobs: :construction: Work in Progress draft: true prerelease: false - - name: Upload cryptomator-cli.jar to GitHub Releases + - name: Upload cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar to GitHub Releases uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cryptomator-cli.jar + asset_path: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar asset_name: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar asset_content_type: application/jar From 2dc1dc7f2a99dfb39991562c9897a6cafa066ccb Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:45:15 +0200 Subject: [PATCH 21/22] Updating github action workflow "build": * remove wrong prefix for enviroment --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57087b7..5a718df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: - name: Upload snapshot artifact cryptomator-cli-${{ env.BUILD_VERSION }}.jar uses: actions/upload-artifact@v2 with: - name: cryptomator-cli-${{ jobs.build.env.BUILD_VERSION }}.jar + name: cryptomator-cli-${{ env.BUILD_VERSION }}.jar path: target/cryptomator-cli-*.jar release: From 178acf4ffda9b992852320916ec46abd02f644ca Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 May 2020 18:47:29 +0200 Subject: [PATCH 22/22] preparing 0.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7002e4a..d0f1f12 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.cryptomator cli - 0.4.0-SNAPSHOT + 0.4.0 Cryptomator CLI Command line program to access encrypted files via WebDAV. https://github.com/cryptomator/cli