-
Notifications
You must be signed in to change notification settings - Fork 44
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
Unable to configure SshdSessionFactory without specifying files (SshDirectory & HomeDirectory) using SshdSessionFactoryBuilder #89
Comments
It definitely should be possible to run without SSH directory. The home directory is a bit more difficult since it is used in various places to do ~ substitution. It should fall back to Explicitly setting the home directory to null should probably be forbidden. I'll take a look, but the fix will not make it into the upcoming 7.0 release. |
Hi @tomaswolf
Apologies, are you saying it's possible right now to configure it to run without SSH directory? When I tried to exclude it in the factory builder by setting it to null or omitting it, the If it is currently possible, could you give me an example of how to configure it?
Thank you Thank You! |
I'm saying that was the intent.
Set it to any suitable directory. But choose one where you don't get files downloaded from the Internet. |
I've looked through the code and places that use the sshDir will have been overridden by other config on the builder we discussed earlier. (setServerKeyDatabase, ConfigStoreFactory etc.) Are we saying that the setter of the ssh directory on the sshhSessionFactory should/will be made nullable?
Would a temporary directory work? Will this temporary fix also be the case for setting the SshDirectory on the builder? Thanks |
Version
6.10.0.202406032230-r
Operating System
MacOS
Bug description
I want to build a SshdSessionFactory using the SshdSessionFactoryBuilder specifying an SSH key pair programatically without needing to set what Home Directory and SSH folder are.
"It should be possible to run this without any files"
As mentioned in apache/mina-sshd#532 specifically here, I am unable to build a
SshdSessionFactory
using theSshdSessionFactoryBuilder
without being forced to specify the File location for both HomeDirectory and SshDirectory.This can be reproduced by building a SshdSessionFactory using the SshdSessionFactoryBuilder.
When constructing an SshdSessionFactoryBuilder with:
.setHomeDirectory(null)
and
.setSshDirectory(null)
(or omitting entirely)
e.g.
I am required to set both HomeDirectory and SshDirectory to some directory despite providing my key pair through the
.setDefaultKeysProvider(ignoredSshDirBecauseWeUseAnInMemorySetOfKeyPairs -> keyPairs)
builder method.Actual behavior
A null pointer exception is thrown saying that the HomeDirectory and SshDirectory cannot be null.
When invoking
.build
on the builder, the following setters for these directories are called:Both the SSH directory and HomeDirectory are required to be non null:
SshdSessionFactory.setHomeDirectory
SshdSessionFactory.setSshDirectory
Expected behavior
To not have to provide an SSH Directory or Home Directory to the builder.
I provide the following to the builder:
Which should mean these directories are not required to be specified as they are not used when creating a session.
Relevant log output
Other information
Reference: apache/mina-sshd#532
CC: @tomaswolf
The text was updated successfully, but these errors were encountered: