-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Question, how can I implement a custom transport with custom parameters? #174
Comments
Before you start doing anything please wait until I've finished my work at that point. |
Ok, yeh I saw some commits. Will await the go ahead. |
I just pushed my changes. Also |
Thanks for the fast response. This works good, I now have a working SSH transport. However, there is one further restriction I cannot see an obvious way to overcome. Take for example the bus address I would like to avoid to providing the password as part of the address string. Apart from the obvious security implications, address string parsing does not appear to support any kind of escaping, so there is a danger with any password that has as So ideally, passing a callback interface to the transport would be nice. E.g.
This is then called when the password is needed, and the user is prompted for the password, or it's retrieved from some other secure place. The address string appears to be the only way to communicate configuration to a transport before the connection is made. I can work around this for the moment by using |
The term 'authentication' would be confusing because DBus authentication is done by SASL and is completely independent of what your transport does.
I added a callback (a simple runnable) called The auto-connect option is indeed only accessible using the Disabling auto-connect would therefore only make sense when you want to create a listening socket (your own DBusDaemon (like shown in |
Thanks again, I see the new method. However, I still cannot see how I can actually get to Am I missing something? |
I updated the I also updated ITransportProvider so you will receive the |
Absolutely perfect, thanks. I have used static utility functions on the transport to help set these. E.g. var builder = DBusConnectionBuilder
.forAddress("ssh:path=/run/dbus/system_bus_socket,username=admin,via=blue,viaPort=2222");
SshTransport.setAuthenticationConfigurator(
(auths) -> Arrays.asList(new PasswordAuthenticator(() -> "admin")),
builder.transportConfig());
try (var connection = builder.build()) {
System.out.println(String.join(System.lineSeparator(), connection.getNames()));
} I'll be publishing this transport as open source at some point. The SSH support is provided by Maverick Synergy which is LGPL. However, it is using bleeding edge as-yet-unreleased support for Unix Domain Sockets, and the open source branch of Synergy lags behind the commercial branch a little. Thanks again, feel free to close this issue. Edit: The source for this transport can now be found at https://github.com/sshtools/dbus-java-transport-ssh |
Interesting, didn't know Maverick Synergy. I always used jsch or similar when trying to do ssh-client stuff with Java. |
Ah heh, "they" is actually me. I am involved with JAdaptive as well as LogonBox, and have been for a very long time. This is our 3rd (or maybe 4th depending on how you look at it) SSH API. Unix Domain Sockets is bleeding edge in terms of support for it in Maverick Synergy, because I only added it last week :). I am not aware of any other Java SSH APIs that support it yet. And yeh, it is using JDK16. Very much like dbus-java, the next release of Maverick will be Java 11, with optional support for unix domain sockets via a Java 16+ add on. |
I intend to implement a custom transport (an SSH one), and believe I have come across a design choice that makes this harder.
I would like to be able to use custom schemes and parameters in the address string. For example, the kind of string I envisage being used would look something like ..
ssh:host=dbustest.acme.com,port=22,path=/some/path/to/dbus.socket,username=joeb,privatekey=/home/joeb/.ssh/id_rsa
The above example would use Unix Domain Socket forwarding (supported by OpenSSH servers for example).
However, I do not see how I can get at any parameters from a
BusAddress
that are not well known. At first glance, it looks like a simplegetParameter()
andhasParameter()
would suffice, but I would appreciate any further suggestions you have before I dive in and make a PR.The text was updated successfully, but these errors were encountered: