Menu

Ubuntu - URL-CMD - password restrictions?

Help
2017-12-22
2018-01-01
  • Florian Schwarz

    Florian Schwarz - 2017-12-22

    Hello,

    My system:
    Ubuntu 17.10 with Keepass2 2.36 (from official Ubuntu repositories).

    Problem:
    I'm trying to mount an encrypted container via the URL-CMD-function and veracrypt. I noticed so far some undocumented(?) password/char set restrictions:
    Quotations (" and ') and backslashes in passwords are making troubles.
    Quotations trigger an error (invalid data) and backslashes are handled as an escape order, so just disappear and making the password false.

    Workaround:
    Adjust the password and escape these characters with backslash.

    Example:
    URL: cmd://veracrypt --mount {S:fFilepath} -p {PASSWORD} --pim='{S:#pim}' --fs-options=X-mount.mkdir=0700 {S:mPoint}
    Real password not working: \123'4"5
    Adjusted, working password: \\123\'4\"5

    Any ideas what to adjust (preferably not the password itself)?

    I'm also curious, how this is working on Windows.

    Thanks and best regards,
    Florian

     
  • Florian Schwarz

    Florian Schwarz - 2017-12-22

    I just tested the URL with plain password input without placeholder on Windows and that also didn't worked. So the Windows version of Keepass appears to process escaping stuff automatically on URL execution.
    So this may be the right solution to the Linux/Ubuntu version too.

    Best regards,
    Florian

     

    Last edit: Florian Schwarz 2017-12-22
  • Paul

    Paul - 2017-12-22

    Try escaping the entire password, that's what you have to do in Windows.
    e.g. URL: cmd://veracrypt --mount {S:fFilepath} -p '{PASSWORD}' --pim='{S:#pim}' --fs-options=X-mount.mkdir=0700 {S:mPoint}

    cheers, Paul

     
  • Florian Schwarz

    Florian Schwarz - 2017-12-22

    You mean frame the placeholder in apostrophes? Not working.
    I tested some configurations and here are the results:

    M: Mount successful
    E: Error message (s. above)
    W: Wrong password / password prompt
    *: Adjusted Password

    URL Test

    So sometimes Keepass is parsing {Password} right, sometimes not. In Ubuntu not at all.

    Best regards,
    Florian

    Edit: Maybe I should mention, that veracrypt help in Ubuntu is telling:

    -p, --password=PASSWORD
    Use specified password to mount/open a volume. An empty password can also be
    specified (-p ""). [...security issue...]

    So the results with quotes and apostrophes shouldn't be that surprising.

     

    Last edit: Florian Schwarz 2017-12-22
  • Paul

    Paul - 2017-12-23

    What do you get if you echo the command line to the console? Does the password show up as expected?

    cheers, Paul

     
  • Florian Schwarz

    Florian Schwarz - 2017-12-23

    I'm not quite sure, how to let Keepass open a visible bash so I piped stdout into a file:

    cmd://bash -c 'echo '{PASSWORD}'&> /home/florian/Downloads/test_kp.txt'
    

    Not working: Error (Invalid data)
    Invalid Data

    With password 1234 it's working and I can see the password in test_kp.txt...

    Best regards,
    Florian

     

    Last edit: Florian Schwarz 2017-12-23
  • Paul

    Paul - 2017-12-23

    Seems Linux doesn't like quotes on the command line, so a text conversion may work for you.
    {T-REPLACE-RX:!{PASSWORD}![\"']!\$0!}

    https://keepass.info/help/base/placeholders.html#texttrf

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2017-12-23

    Apparently Mono requires an additional special character encoding; I've implemented this as a workaround now.

    Here's the latest development snapshot for testing:
    https://keepass.info/filepool/KeePass_171223.zip

    Thanks and best regards,
    Dominik

     
  • Florian Schwarz

    Florian Schwarz - 2018-01-01

    Thanks, latest snapshot worked with the actual password.
    Any ideas, when this will be in the official repos?

    Best regards,
    Florian

     
  • Paul

    Paul - 2018-01-01

    The usual answer is "when it's ready". :)

    cheers, Paul

     

Log in to post a comment.

MongoDB Logo MongoDB