KPScript not displaying generated password in linux console

  • jswalsh2000

    jswalsh2000 - 2013-10-11

    Software Versions:
    - KPScript and KeePass version: 2.23
    - Linux: RHEL 6.3. The server runs "headless", ie no gui only console access.
    - mono - Mono JIT compiler version 2.11.4
    - Mono is installed and successfully compiling and executing scripts.

    When executing the following command, I don't get the expected output:
    mono /apps/KeePass/KPScript.exe -c:GenPw

    I expect to get a Password in KeePass' default password profile format followed by "OK: Operation completed successfully." in green on separate lines. That is what I receive when the command KPScript.exe -c:GenPw is run on Windows or via cygwin running on Windows.

    The only output I receive on the Linux console is: "OK: Operation completed successfully." in green. I don't get the password.

    I've stepped through the source code for KPScript, simulating the above command to see if there were differences in the code. The only major difference I can determine is that Background and Foreground colours are modified prior to "OK: Operation completed successfully." being displayed then the colours are reset after the text is written to the console.

    Has anyone come across this problem previously?
    Any help would be appreciated.

    I'm using KeePass and KPScript to deploy and access user credentials for use in a controlled batch processing environment.

    Thanks for any assistance

  • Dominik Reichl

    Dominik Reichl - 2013-10-13

    I've tried KPScript 2.23 on Kubuntu 13.04 / Mono, and the GenPw command works perfectly fine.

    Thus I think the issue is either caused by a configuration problem (maybe the default password generation profile specifies 0 characters) or by a Mono bug.

    Best regards,

  • jswalsh2000

    jswalsh2000 - 2013-10-13

    I have had KeePass working in both ubuntu 13.04 and OEL 6.3 but I'm having trouble getting it to work on RHEL 6.3 in a headless config.

    Based on the documentation, I need a global KeePass.config.xml stored where KeePass was installed.

    Is there a template KeePass.config.xml available?

    For my own information, when does the KeePass.config.xml get created by KeePass?


    Last edit: jswalsh2000 2013-10-14
  • jswalsh2000

    jswalsh2000 - 2013-10-14

    Does KeePass assume that an X11 server is running on the linux machine?

    I'm trying to run this via an xterm/ssh session. The server does not have a GUI user interface, terminal only.

    Last edit: jswalsh2000 2013-10-14
  • Dominik Reichl

    Dominik Reichl - 2013-10-14

    In order to get a template KeePass.config.xml, run a fresh copy of the portable version of KeePass (this creates a new KeePass.config.xml).

    Within the configuration file, search for the node 'AutoGeneratedPasswordsProfile' and check whether it looks good.

    KeePass doesn't require X11 directly; maybe Mono does.

    Best regards,

  • jswalsh2000

    jswalsh2000 - 2013-10-17

    Hi Dominik,

    Thanks for the help.

    - Upon investigation, the KPScript/KeePass combination does require an X11 or similar display manager/server installed on Linux. The KeePass Password Generation code hides a exception by capturing the exception then doing nothing with it.

    • mono itself does not require a window/display manager it only requires one when the app being executed requires one. I wrote a simple test and mono will happily execute console style apps.

    Additionally, I wrote a simple test program that only attempted to generate the password then write the password to the console without any exception handling.

    The issue seems to be that when KPScript/KeePass initialises, it expects a window/display manager to be running , even though in my instance a display is not used or required as it is running in a batch mode.

    FYI: I've attached a file of my example c# code and the exception output for your information.

    Note: I tested various code configurations to see what would and wouldn't compile by commenting out various "using" code, all of the code that would compile then run on Linux produced essentially the same exceptions.

    Are there any thoughts or intentions to separate the KeePass UI and Functionality into separate assemblies so that a batch style of execution can occur with out the need to have window/display managers installed?

    For example KPScript would be dependant on the Functionality assembly with referencing the need to reference the UI assemblies.

    Great piece of software though, easy to incorporate into batch processing.

    Last edit: jswalsh2000 2013-10-17
  • Dominik Reichl

    Dominik Reichl - 2013-10-18

    The KeePass core and the UI already are separated. The 'KeePassLib' assembly (in the official source code package) contains just the core code, without any UI.

    The exception that you posted is thrown during the initialization of the cryptographically secure pseudo-random number generator. Here, KeePass collects as much environment data as possible (this includes the current date/time, data generated by the cryptographic pseudo-random number generator provided by the operating system, etc.), to build a seed from it. One of these environmental sources is the mouse cursor position. However, on your system this isn't available of course. The fix is simple: the mouse cursor position must only be used when it's really available. I've implemented this now.

    Here are the latest KPScript and KeePass development snapshots for testing:

    Best regards,

  • jswalsh2000

    jswalsh2000 - 2013-10-21

    Thank you so much that works brilliantly.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks