Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

Chapter 11. SSH Keys

Decision Central provides an SSH keystore service to enable user SSH authentication. It provides a configurable default SSH keystore, extensible APIs (for custom implementations), and support for multiple SSH public keys formats.

You can access the SSH Keys option from the Admin page to register your SSH public keys.

11.1. Default SSH keystore

The default SSH keystore included with Decision Central provides a file-based storage mechanism to store a user’s public keys. By default, Decision Central uses the *.security folder as the root directory. However, it is possible to use a custom storage path by setting the value of the appformer.ssh.keys.storage.folder system property point to a different folder.

The SSH public keys are stored in the {securityFolderPath}/pkeys/{userName}/ folder structure.

Each SSH public key consists of the following files, located in the storage folder:

  • {keyId}.pub: This file contains the SSH public key content. As the file name determines the logic key ID on the system, ensure that the file name is not modified during runtime.

    For example:

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDmak4Wu23RZ6XmN94bOsqecZxuTa4RRhhQmHmTZjMB7HM57/90u/B/gB/GhsPEu1nAXL0npY56tT/MPQ8vRm2C2W9A7CzN5+z5yyL3W01YZy3kzslk77CjULjfhrcfQSL3b2sPG5jv5E5/nyC/swSytucwT/PE7aXTS9H6cHIKUdYPzIt94SHoBxWRIK7PJi9d+eLB+hmDzvbVa1ezu5a8yu2kcHi6NxxfI5iRj2rsceDTp0imC1jMoC6ZDfBvZSxL9FXTMwFdNnmTlJveBtv9nAbnAvIWlilS0VOkdj1s3GxBxeZYAcKbcsK9sJzusptk5dxGsG2Z8vInaglN6OaOQ7b7tcomzCYYwviGQ9gRX8sGsVrw39gsDIGYP2tA4bRr7ecHnlNg1b0HCchA5+QCDk4Hbz1UrnHmPA2Lg9c3WGm2qedvQdVJXuS3mlwYOqL40aXPs6890PvFJUlpiVSznF50djPnwsMxJZEf1HdTXgZD1Bh54ogZf7czyUNfkNkE69yJDbTHjpQd0cKUQnu9tVxqmBzhX31yF4VcsMeADcf2Z8wlA3n4LZnC/GwonYlq5+G93zJpFOkPhme8c2XuPuCXF795lsxyJ8SB/AlwPJAhEtm0y0s0l1l4eWqxsDxkBOgN+ivU0czrVMssHJEJb4o0FLf7iHhOW56/iMdD9w== userName
  • .{keyId}.pub.meta: This file contains the key metadata in JSON format. A new metadata file is dynamically generated if a key has no metadata.

    For example:

    {
      "name":"Key",
      "creationDate":"Oct 10, 2018 10:10:50 PM",
      "lastTimeUsed":"Oct 11, 2018 12:11:23 PM"
    }

11.2. Custom SSH keystore

You can extend and customize the default SSH keystore according to your requirements. Use the appformer.ssh.keystore system property to specify the Java class name of the SSH service to use. If this property is not defined or it contains an incorrect value then the default SSH keystore is loaded.

Note

To create a custom implementation of the SSH keystore, your java class must implement the org.uberfire.ssh.service.backend.keystore.SSHKeyStore class defined in the uberfire-ssh-api module.

11.3. Creating an SSH key

Before you can add or register SSH keys to Decision Central, you must generate an SSH key on your system.

Procedure

  1. Open a terminal on your system.
  2. Run the ssh-keygen command to create the SSH key as shown in the following example, where <user_login> is your user name.

    ssh-keygen -t rsa -b 4096 -C "<user_login>"
    Note

    The SSH key formats supported by Decision Central keystore are ssh-rsa, ssh-dss, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, and ecdsa-sha2-nistp521.

  3. When prompted, press the Enter key and accept the default key file location as shown in the following example, where <user_login> is your user name.

    Enter a file in which to save the key (/home/<user_login>/.ssh/id_rsa): [Press enter]
  4. At the command prompt, enter and confirm the passphrase.

    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]
  5. Start the ssh-agent.

    eval "$(ssh-agent -s)"
    Agent pid <any-number-here>
  6. Add the new SSH private key to the ssh-agent. If you have used a different key name, replace id_rsa in code.

    ssh-add ~/.ssh/id_rsa

11.4. Registering your SSH public key with the SSH keystore

You must register your newly created SSH public key with the Decision Central keystore.

Procedure

  1. Open a terminal on your system.
  2. Run the cat command as shown in the following example, where id_rsa is your key name.

    cat ~/.ssh/id_rsa.pub
  3. Copy the contents of your SSH public key.
  4. Log in to Decision Central.
  5. Select AdminSSH Keys.
  6. From the SSH Keys page, click Add SSH Keys.
  7. In the Add SSH Key window, enter a name in the Name field and copy the contents of the SSH public key to the Keys field.

    Note

    The Name and the Key fields are mandatory.

  8. Click Add SSH Key to register the key.

11.5. Deleting an SSH key

You can delete an SSH key from Decision Central by from the SSH Keys page.

Procedure

  1. Log in to Decision Central.
  2. Select AdminSSH Keys.
  3. All of the SSH keys are listed on the SSH Keys page.
  4. To delete an SSH key, click the delete icon (trash can).
  5. Click the Delete SSH Key to confirm the deletion.