This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
new 7ef7ccd [KARAF-5485] Add the sftpEnabled property in
org.apache.karaf.shell configuration to control the SSH SFTP system startup
7ef7ccd is described below
commit 7ef7ccd04beb02649a3427c2c6c882de30e14f17
Author: Jean-Baptiste Onofré <[email protected]>
AuthorDate: Wed Dec 13 15:52:51 2017 +0100
[KARAF-5485] Add the sftpEnabled property in org.apache.karaf.shell
configuration to control the SSH SFTP system startup
---
assemblies/features/standard/src/main/feature/feature.xml | 5 +++++
.../ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/assemblies/features/standard/src/main/feature/feature.xml
b/assemblies/features/standard/src/main/feature/feature.xml
index 3291f1c..80f4248 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -260,6 +260,11 @@
sshRealm = karaf
#
+ # Defines if the SFTP system is enabled or not in the SSH server
+ #
+ sftpEnabled=true
+
+ #
# The location of the hostKey file defines where the
private/public key of the server
# is located. If no file is at the defined location it will be
ignored.
#
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
index f8b0676..5c6a536 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
@@ -153,6 +153,7 @@ public class Activator extends BaseActivator implements
ManagedService {
String kexAlgorithms = getString("kexAlgorithms",
"diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1");
String welcomeBanner = getString("welcomeBanner", null);
String moduliUrl = getString("moduli-url", null);
+ boolean sftpEnabled = getBoolean("sftpEnabled", true);
AbstractGeneratorHostKeyProvider keyPairProvider;
if ("simple".equalsIgnoreCase(hostKeyFormat)) {
@@ -185,12 +186,14 @@ public class Activator extends BaseActivator implements
ManagedService {
server.setCipherFactories(SshUtils.buildCiphers(ciphers));
server.setKeyExchangeFactories(SshUtils.buildKexAlgorithms(kexAlgorithms));
server.setShellFactory(new ShellFactoryImpl(sessionFactory));
- server.setCommandFactory(new
ScpCommandFactory.Builder().withDelegate(new
ShellCommandFactory(sessionFactory)).build());
-
server.setSubsystemFactories(Arrays.<NamedFactory<org.apache.sshd.server.Command>>asList(new
SftpSubsystemFactory()));
+ if (sftpEnabled) {
+ server.setCommandFactory(new
ScpCommandFactory.Builder().withDelegate(new
ShellCommandFactory(sessionFactory)).build());
+
server.setSubsystemFactories(Arrays.<NamedFactory<org.apache.sshd.server.Command>>asList(new
SftpSubsystemFactory()));
+ server.setFileSystemFactory(new
VirtualFileSystemFactory(Paths.get(System.getProperty("karaf.base"))));
+ }
server.setKeyPairProvider(keyPairProvider);
server.setPasswordAuthenticator(authenticator);
server.setPublickeyAuthenticator(authenticator);
- server.setFileSystemFactory(new
VirtualFileSystemFactory(Paths.get(System.getProperty("karaf.base"))));
server.setUserAuthFactories(authFactoriesFactory.getFactories());
server.setAgentFactory(KarafAgentFactory.getInstance());
server.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].