Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Tunnel support #246

Merged
merged 11 commits into from
Jan 6, 2025
Merged

SSH Tunnel support #246

merged 11 commits into from
Jan 6, 2025

Conversation

danvergara
Copy link
Owner

@danvergara danvergara commented Dec 17, 2024

SSH tunnel support

Description

This PR adds support for SSH Tunnel as requested many times in #205. It adds 6 new flags to the cli tool to perform the connection.

e.g.

dblab --host localhost --user postgres --pass password --schema public --ssl disable --port 5432 --driver postgres --limit 50 --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-key my_ssh_key --ssh-key-pass password

This change only adds support for MySQL and Postgres, more to come later.

Fixes #205

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

A new docker compose file has been added to the development environment, adding a service called ssh, with ubuntu-sshd being its underlying base image to act as the ssh server to test the connection against.

Also, a mock ssh server has been added to the test suite, to validate the use of the private key file as authentication method.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@danvergara danvergara self-assigned this Dec 17, 2024
@danvergara danvergara added kind/enhancement New feature or request expert Good for advanced developers and removed expert Good for advanced developers labels Jan 2, 2025
@danvergara danvergara marked this pull request as ready for review January 2, 2025 19:04
Copy link
Collaborator

@ThiagoMowszet ThiagoMowszet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow!

Copy link
Collaborator

@rkgarcia rkgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an excellent feature!!!

@danvergara danvergara merged commit 9386c11 into main Jan 6, 2025
8 checks passed
@danvergara danvergara deleted the add-ssh-tunnel-support branch January 6, 2025 16:28
return nil, err
}

defer sshConfig.Close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this result in the ssh tunnel closing before the application closes?

Copy link
Owner Author

@danvergara danvergara Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I messed it up.

Already fixed on #249

Please, check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] SSH tunnel support
4 participants