Skip to content

Check, if keytool exists, before trying to execute it #445

Open

Description

@cocker-cc

Use Case

If keytool does not exist, sensitive Password is not “redacted” in Error-Message:

Error: /Stage[main]/Myprofilemodule/Java_ks[myRootCA]/ensure: change from 'absent' to 'latest' failed:  
Execution of 'keytool -importcert -noprompt -alias myrootca -file /etc/pki/tls/certs/myCA_root.pem -keystore /path/to/mykeystore -srcstorepass MyPassword -deststorepass MyPassword' returned 1:  
Error: Could not execute posix command: No such file or directory - keytool

Describe the Solution You Would Like

  • check, if keytool exists, before trying to execute it
  • prevent Password-Leak in other Error-Situations

Activity

  1. danifr commented on Nov 10, 2023

    @danifr

    @david22swan (apologies for tagging you, you seem to be the last one who contributed to the latest version of this module)

    I have a similar issue, I have installed 2 different version of java on the same machine and java_ks does not find the keytool one I'd like to use.

    It there a way to implement a way to provide the PATH where keytool is installed? Thanks

  2. danifr commented on Nov 13, 2023

    @danifr

    I worked around it creating a link:

      file { '/usr/local/bin/keytool':
        ensure  => link,
        target  => "${java_binaries_path}/keytool",
        require => Class['java'],
      }
    
  3. cocker-cc commented on Nov 13, 2023

    @cocker-cc
    ContributorAuthor

    @danifr: But you know, that this is not the Point of this Issue, right? This Issue is about leaking Secrets.

  4. danifr commented on Nov 13, 2023

    @danifr

    Yes yes sorry for hijacking your ticket :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions