Skip to content

Private key authentication #14

@davidkroell

Description

@davidkroell

Goal: Add a mechanism for private key authentication instead of / in addition to a password.

Wanted functionality: When adding a connection, there should be any sort of input to add a SSH private key.

Below is a mockup of the view where the changes have to be made
mockup

This view has to be updated: activiy_connection_details.xml.
This view is used in the ConnectionDetailsActivity class.

You therefore have to add a new column in our SQLite Database to persist the private key. Either by saving it directly into the database as byte array or as file and attach a filepath to the model class and database. Furthermore, a field to decide if a private key should be used has to be added.

Connection model class seen below

public class Connection extends SugarRecord {
private String hostname;
private String username;
private String password;
private Integer sshPort;
private Integer timesConnected = 0;
private String operatingSystem = "";
private String hostKey;

This has to be implemented into the underlying connection manager. We use the awesome library JSch for this.

@Override
protected void onPreExecute() {
this.ces = new CommandExecutionSummary();
// bootstrap connection to server
try {
JSch jsch = new JSch();
this.jschSession = jsch.getSession(
this.connection.getUsername(),
this.connection.getHostname(),
this.connection.getSshPort());
this.jschSession.setPassword(this.connection.getPassword());

If any questions come to your mind feel free to ask.
Thanks in advance,

David

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions