Two issues with Cryptomator vault sanitizer v0.14

Hi there, I am trying to include the Cryptomator sanitizer into my backup script by have it check consistency of my containers before they get saved away.
To determine integrity I am looking for “Errors” in the output file which is when I noticed I always get an error referring to an invalid configuration file logback.xml:

10:03:04,332 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
10:03:04,332 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
10:03:04,332 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/thomas/Cryptomator/CryptomatorSanitizer.jar!/logback.xml]
10:03:04,353 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@5419f379 - URL [jar:file:/home/thomas/Cryptomator/CryptomatorSanitizer.jar!/logback.xml] is not of type file
10:03:04,442 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10:03:04,444 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
10:03:04,444 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - See also http://logback.qos.ch/codes.html#ifJanino
10:03:04,447 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
10:03:04,449 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7dc7cbad - Registering current configuration as safe fallback point

Second issue is that I can’t take the vault password from a file. Whenever I specify the passphrasefile option the application crashes with the error below. “-passphrase pwd” works but obviously this is not a suitable option.

sudo java -Dcrypto.policy=unlimited -jar ~/Cryptomator/CryptomatorSanitizer.jar check -vault /media/data/OneDrive/Container -deep --passphraseFile ~/.config/cryptomator.txt

# Cryptomator vault sanitizer v0.14 #
Exception in thread "main" java.lang.IndexOutOfBoundsException
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:151)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at org.cryptomator.sanitizer.commands.CheckCommand.passphraseFromFile(CheckCommand.java:189)
        at org.cryptomator.sanitizer.commands.CheckCommand.passphrase(CheckCommand.java:161)
        at org.cryptomator.sanitizer.commands.CheckCommand.parse(CheckCommand.java:130)
        at org.cryptomator.sanitizer.commands.Commands.<init>(Commands.java:61)
        at org.cryptomator.sanitizer.commands.Commands.parse(Commands.java:26)
        at org.cryptomator.sanitizer.Sanitizer.main(Sanitizer.java:12)

My platform is Ubuntu server, Kernel 4.13.0-37-generic
Thanks
Thomas

We fixed both issues in v0.15: https://github.com/cryptomator/sanitizer/releases/tag/0.15

Thanks for the swift response, I can confirm both errors are gone but somehow it doesn’t want to accept what’s in the pwd file. Is there anything I need to consider re. how the password is written inside the file?
I tried following the PWD with a new line and without but neither did make a difference.
The pwd file exists and is accessible as can be seen form the ls statement below. If I replace ls with cat I get to see my password as expected.

$ sudo java -Dcrypto.policy=unlimited -jar ~/Cryptomator/sanitizer-0.15.jar check -vault /media/data/OneDrive/Container -deep -passphraseFile /home/thomas/.config/TZ/cryptomator.txt

Cryptomator vault sanitizer v0.15

Output file(s) exist. Overwrite [Y|n]? y
Scanning vault structure may take some time. Be patient…
Wrote structure to Container.structure.txt.
46786 files in vault

Checking the vault may take some time. Be patient…

Check failed: Invalid passphrase

~$ sudo ls -al /home/thomas/.config/TZ/cryptomator.txt
-rw------- 1 thomas thomas 11 Apr 20 12:07 /home/thomas/.config/TZ/cryptomator.txt

$ java --version
openjdk 9-Ubuntu
OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)
OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)

Have you made sure that your passphrase file doesn’t end with a newline?

I tried both options and just double checked again. No newline!
Set up a test vault to see if it’s got to do with my special character password, but same issue.

  1. Created a new vault with password “test”
  2. Successfully ran Sanitizer with “-passphrase test” option
  3. Copied password into file pwd
  4. Changed Sanitizer string to “-passphrasefile ./pwd”
  5. Check fails

Could you please use this command instead:

cat -e pwd

Happy to:
image

So… there is a newline. :smiley: The $ indicates that there is a newline. I admit that we could patch Sanitizer so that newlines aren’t an issue but it’d be easier for now if you’d remove the newline.

Ok, I must admit I don’t know how I can get rid of it.
I created the file with echo test > pwd, and after things didn’t work used nano to check the content.
Not even vi shows that there is something behind the last character.

image

Some references because I have no idea as well:

1 Like

Thanks a lot!
This did the trick:

printf %s "$(< input.txt)" > output.txt

Things are working now!

Edit:
Shot too quick, it just took a lot longer for the error message as usual.

I’ve tried the same commands here and noticed one thing that could be the issue: Try passphraseFile instead of passphrasefile. Sanitizer’s interpreter isn’t that smart. :sweat_smile:

Unfortunately that didn’t work either. All lower case:

I meant -passphraseFile out.txt instead of -passphrasefile out.txt. Uppercase F.

1 Like

Bingo! What a difference a letter makes :slight_smile:

Problem solved, this time for real :slight_smile:
Thanks a lot for you help Tobi!

1 Like