This is an automated email from the ASF dual-hosted git repository. lgoldstein pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit adf96e7b3321fd525922c0fec2acd411d584521a Author: Lyor Goldstein <lgoldst...@apache.org> AuthorDate: Sat Aug 1 11:04:34 2020 +0300 [SSHD-1004] Generate an ECDSA host key by default in SshServerMain --- CHANGES.md | 2 ++ sshd-cli/src/main/resources/.gitignore | 0 sshd-cli/src/test/resources/log4j.properties | 38 ++++++++++++++++++++++ .../AbstractGeneratorHostKeyProvider.java | 2 +- .../AbstractGeneratorHostKeyProviderTest.java | 1 - 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 96e094f..089fa2b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,8 @@ ## Major code re-factoring +* `SshServerMain` uses by default an ECDSA key instead of an RSA one. This can be overridden either by `-key-type / -key-size` +or `-key-file` command line option. * [SSHD-1034](https://issues.apache.org/jira/browse/SSHD-1034) Rename `org.apache.sshd.common.ForwardingFilter` to `Forwarder`. * [SSHD-1035](https://issues.apache.org/jira/browse/SSHD-1035) Move property definitions to common locations. * [SSHD-1038](https://issues.apache.org/jira/browse/SSHD-1038) Refactor packages from a module into a cleaner hierarchy. diff --git a/sshd-cli/src/main/resources/.gitignore b/sshd-cli/src/main/resources/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/sshd-cli/src/test/resources/log4j.properties b/sshd-cli/src/test/resources/log4j.properties new file mode 100644 index 0000000..51c6fee --- /dev/null +++ b/sshd-cli/src/test/resources/log4j.properties @@ -0,0 +1,38 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +# +# The logging properties used during tests.. +# +log4j.rootLogger=INFO, stdout, logfile +#log4j.logger.org.apache.sshd=TRACE +#log4j.logger.org.apache.sshd.common.channel.Window=DEBUG + +# CONSOLE appender +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d | %-5.5p | %-16.16t | %-32.32c{1} | %-64.64C %4L | %m%n + +# File appender +log4j.appender.logfile=org.apache.log4j.FileAppender +log4j.appender.logfile.layout=org.apache.log4j.PatternLayout +log4j.appender.logfile.layout.ConversionPattern=%d | %-5.5p | %-16.16t | %-32.32c{1} | %-64.64C %4L | %m%n +log4j.appender.logfile.file=target/sshd-cli-tests.log +log4j.appender.logfile.append=true diff --git a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java index dbd9204..0e348ff 100644 --- a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java +++ b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java @@ -60,7 +60,7 @@ import org.apache.sshd.common.util.security.SecurityUtils; public abstract class AbstractGeneratorHostKeyProvider extends AbstractKeyPairProvider implements AlgorithmNameProvider, KeySizeIndicator { - public static final String DEFAULT_ALGORITHM = KeyUtils.RSA_ALGORITHM; + public static final String DEFAULT_ALGORITHM = KeyUtils.EC_ALGORITHM; public static final boolean DEFAULT_ALLOWED_TO_OVERWRITE = true; private final AtomicReference<Iterable<KeyPair>> keyPairHolder = new AtomicReference<>(); diff --git a/sshd-common/src/test/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProviderTest.java b/sshd-common/src/test/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProviderTest.java index 79e07a6..fe5c38e 100644 --- a/sshd-common/src/test/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProviderTest.java +++ b/sshd-common/src/test/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProviderTest.java @@ -64,7 +64,6 @@ public class AbstractGeneratorHostKeyProviderTest extends JUnitTestSupport { private final AtomicInteger writes = new AtomicInteger(0); private TestProvider(Path file) { - setKeySize(512); setPath(file); }