LuckPerms

LuckPerms

41.4k Downloads

No way to connect via ssh tunnel

reesercollins opened this issue ยท 1 comments

commented

I would try to implement this myself and make a pull request, but I've looked through your code, and can't seem to find the class which connects to database servers.

The issue is my hosting company uses shared servers, which only allow connection to the database via an ssh tunnel first to the server, then a connection to localhost:3306.

If you could think about implementing this in your next update, I would appreciate it very much.

commented

The best approach for this is using SSH tunneling.

https://www.ssh.com/ssh/tunneling/
https://www.ssh.com/ssh/tunneling/example

The JDBC drivers included with Java don't support setting this up automatically, and it has to be done using an extra library. This would be way out of scope for LuckPerms though, so you'll need to setup the tunnel yourself.

If you wanted to try implementing this in your own fork, the correct place to configure is here:

https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/hikari/HikariConnectionFactory.java#L75

And I think this library will let you set it up easily.

http://www.jcraft.com/jsch/

Relevant stack overflow answer:

https://stackoverflow.com/questions/1968293/connect-to-remote-mysql-database-through-ssh-using-java