Skip to content

Commit 76e6e57

Browse files
committed
Merge branch 'master' into issue-358
2 parents 265e9d2 + 2003a9f commit 76e6e57

File tree

17 files changed

+2128
-1486
lines changed

17 files changed

+2128
-1486
lines changed

README.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ signatures::
8181
`ssh-rsa`, `ssh-dss`, `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `ssh-ed25519`
8282

8383
mac::
84-
`hmac-md5`, `hmac-md5-96`, `hmac-sha1`, `hmac-sha1-96`, `hmac-sha2-256`, `hmac-sha2-512`
84+
`hmac-md5`, `hmac-md5-96`, `hmac-sha1`, `hmac-sha1-96`, `hmac-sha2-256`, `hmac-sha2-512`, `hmac-ripemd160`
8585

8686
compression::
8787
`zlib` and `[email protected]` (delayed zlib)
@@ -107,6 +107,9 @@ Google Group: http://groups.google.com/group/sshj-users
107107
Fork away!
108108

109109
== Release history
110+
SSHJ 0.24.0 (2018-??-??)::
111+
* Added support for hmac-ripemd160
112+
110113
SSHJ 0.23.0 (2017-10-13)::
111114
* Merged https://github.com/hierynomus/sshj/pulls/372[#372]: Upgrade to 'net.i2p.crypto:eddsa:0.2.0'
112115
* Fixed https://github.com/hierynomus/sshj/issues/355[#355] and https://github.com/hierynomus/sshj/issues/354[#354]: Correctly decode signature bytes

src/itest/docker-image/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ADD id_rsa.pub /home/sshj/.ssh/authorized_keys
44

55
ADD test-container/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key
66
ADD test-container/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
7+
ADD test-container/sshd_config /etc/ssh/sshd_config
78

89
RUN \
910
echo "root:smile" | chpasswd && \
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
2+
3+
# This is the sshd server system-wide configuration file. See
4+
# sshd_config(5) for more information.
5+
6+
# This sshd was compiled with PATH=/bin:/usr/bin:/sbin:/usr/sbin
7+
8+
# The strategy used for options in the default sshd_config shipped with
9+
# OpenSSH is to specify options with their default value where
10+
# possible, but leave them commented. Uncommented options override the
11+
# default value.
12+
13+
#Port 22
14+
#AddressFamily any
15+
#ListenAddress 0.0.0.0
16+
#ListenAddress ::
17+
18+
#HostKey /etc/ssh/ssh_host_rsa_key
19+
#HostKey /etc/ssh/ssh_host_dsa_key
20+
#HostKey /etc/ssh/ssh_host_ecdsa_key
21+
#HostKey /etc/ssh/ssh_host_ed25519_key
22+
23+
# Ciphers and keying
24+
#RekeyLimit default none
25+
26+
# Logging
27+
#SyslogFacility AUTH
28+
#LogLevel INFO
29+
30+
# Authentication:
31+
32+
#LoginGraceTime 2m
33+
PermitRootLogin yes
34+
#StrictModes yes
35+
#MaxAuthTries 6
36+
#MaxSessions 10
37+
38+
#PubkeyAuthentication yes
39+
40+
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
41+
# but this is overridden so installations will only check .ssh/authorized_keys
42+
AuthorizedKeysFile .ssh/authorized_keys
43+
44+
#AuthorizedPrincipalsFile none
45+
46+
#AuthorizedKeysCommand none
47+
#AuthorizedKeysCommandUser nobody
48+
49+
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
50+
#HostbasedAuthentication no
51+
# Change to yes if you don't trust ~/.ssh/known_hosts for
52+
# HostbasedAuthentication
53+
#IgnoreUserKnownHosts no
54+
# Don't read the user's ~/.rhosts and ~/.shosts files
55+
#IgnoreRhosts yes
56+
57+
# To disable tunneled clear text passwords, change to no here!
58+
#PasswordAuthentication yes
59+
#PermitEmptyPasswords no
60+
61+
# Change to no to disable s/key passwords
62+
#ChallengeResponseAuthentication yes
63+
64+
# Kerberos options
65+
#KerberosAuthentication no
66+
#KerberosOrLocalPasswd yes
67+
#KerberosTicketCleanup yes
68+
#KerberosGetAFSToken no
69+
70+
# GSSAPI options
71+
#GSSAPIAuthentication no
72+
#GSSAPICleanupCredentials yes
73+
74+
# Set this to 'yes' to enable PAM authentication, account processing,
75+
# and session processing. If this is enabled, PAM authentication will
76+
# be allowed through the ChallengeResponseAuthentication and
77+
# PasswordAuthentication. Depending on your PAM configuration,
78+
# PAM authentication via ChallengeResponseAuthentication may bypass
79+
# the setting of "PermitRootLogin without-password".
80+
# If you just want the PAM account and session checks to run without
81+
# PAM authentication, then enable this but set PasswordAuthentication
82+
# and ChallengeResponseAuthentication to 'no'.
83+
#UsePAM no
84+
85+
#AllowAgentForwarding yes
86+
#AllowTcpForwarding yes
87+
#GatewayPorts no
88+
#X11Forwarding no
89+
#X11DisplayOffset 10
90+
#X11UseLocalhost yes
91+
#PermitTTY yes
92+
#PrintMotd yes
93+
#PrintLastLog yes
94+
#TCPKeepAlive yes
95+
#UseLogin no
96+
#PermitUserEnvironment no
97+
#Compression delayed
98+
#ClientAliveInterval 0
99+
#ClientAliveCountMax 3
100+
#UseDNS no
101+
#PidFile /run/sshd.pid
102+
#MaxStartups 10:30:100
103+
#PermitTunnel no
104+
#ChrootDirectory none
105+
#VersionAddendum none
106+
107+
# no default banner path
108+
#Banner none
109+
110+
# override default of no subsystems
111+
Subsystem sftp /usr/lib/ssh/sftp-server
112+
113+
# the following are HPN related configuration options
114+
# tcp receive buffer polling. disable in non autotuning kernels
115+
#TcpRcvBufPoll yes
116+
117+
# disable hpn performance boosts
118+
#HPNDisabled no
119+
120+
# buffer size for hpn to non-hpn connections
121+
#HPNBufferSize 2048
122+
123+
124+
# Example of overriding settings on a per-user basis
125+
#Match User anoncvs
126+
# X11Forwarding no
127+
# AllowTcpForwarding no
128+
# PermitTTY no
129+
# ForceCommand cvs server
130+
131+
132+

src/itest/groovy/com/hierynomus/sshj/IntegrationBaseSpec.groovy

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,28 @@
1515
*/
1616
package com.hierynomus.sshj
1717

18+
import net.schmizz.sshj.Config
1819
import net.schmizz.sshj.DefaultConfig
1920
import net.schmizz.sshj.SSHClient
2021
import net.schmizz.sshj.transport.verification.PromiscuousVerifier
2122
import spock.lang.Specification
2223

2324
class IntegrationBaseSpec extends Specification {
24-
protected static final int DOCKER_PORT = 2222;
25-
protected static final String USERNAME = "sshj";
26-
protected final static String SERVER_IP = System.getProperty("serverIP", "127.0.0.1");
25+
protected static final int DOCKER_PORT = 2222
26+
protected static final String USERNAME = "sshj"
27+
protected static final String KEYFILE = "src/test/resources/id_rsa"
28+
protected final static String SERVER_IP = System.getProperty("serverIP", "127.0.0.1")
2729

28-
protected static SSHClient getConnectedClient() throws IOException {
29-
SSHClient sshClient = new SSHClient(new DefaultConfig());
30-
sshClient.addHostKeyVerifier(new PromiscuousVerifier());
31-
sshClient.connect(SERVER_IP, DOCKER_PORT);
30+
protected static SSHClient getConnectedClient(Config config) {
31+
SSHClient sshClient = new SSHClient(config)
32+
sshClient.addHostKeyVerifier(new PromiscuousVerifier())
33+
sshClient.connect(SERVER_IP, DOCKER_PORT)
34+
35+
return sshClient
36+
}
3237

33-
return sshClient;
38+
protected static SSHClient getConnectedClient() throws IOException {
39+
return getConnectedClient(new DefaultConfig())
3440
}
3541

3642
}

src/itest/groovy/com/hierynomus/sshj/IntegrationSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class IntegrationSpec extends IntegrationBaseSpec {
5151
SSHClient client = getConnectedClient()
5252

5353
when:
54-
client.authPublickey("sshj", "src/test/resources/id_rsa")
54+
client.authPublickey(USERNAME, KEYFILE)
5555

5656
then:
5757
client.isAuthenticated()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C)2009 - SSHJ Contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hierynomus.sshj.transport.mac
17+
18+
import com.hierynomus.sshj.IntegrationBaseSpec
19+
import net.schmizz.sshj.DefaultConfig
20+
import net.schmizz.sshj.transport.mac.HMACRIPEMD160
21+
import net.schmizz.sshj.transport.mac.HMACSHA2256
22+
import spock.lang.Unroll
23+
24+
class MacSpec extends IntegrationBaseSpec {
25+
26+
@Unroll
27+
def "should correctly connect with #mac MAC"() {
28+
given:
29+
def cfg = new DefaultConfig()
30+
cfg.setMACFactories(macFactory)
31+
def client = getConnectedClient(cfg)
32+
33+
when:
34+
client.authPublickey(USERNAME, KEYFILE)
35+
36+
then:
37+
client.authenticated
38+
39+
where:
40+
macFactory << [new HMACSHA2256.Factory(), new HMACRIPEMD160.Factory()]
41+
mac = macFactory.name
42+
}
43+
}

src/main/java/net/schmizz/sshj/AndroidConfig.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@
2323
import net.schmizz.sshj.transport.random.JCERandom;
2424
import net.schmizz.sshj.transport.random.SingletonRandomFactory;
2525

26+
/**
27+
* Registers SpongyCastle as JCE provider.
28+
*/
2629
public class AndroidConfig
2730
extends DefaultConfig {
2831

2932
static {
3033
SecurityUtils.registerSecurityProvider("org.spongycastle.jce.provider.BouncyCastleProvider");
3134
}
3235

33-
public AndroidConfig(){
34-
super();
35-
initKeyExchangeFactories(true);
36-
initRandomFactory(true);
37-
initFileKeyProviderFactories(true);
38-
}
39-
4036
// don't add ECDSA
4137
protected void initSignatureFactories() {
4238
setSignatureFactories(new SignatureRSA.Factory(), new SignatureDSA.Factory(),

src/main/java/net/schmizz/sshj/DefaultConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private String readVersionFromProperties() {
9292
properties.load(DefaultConfig.class.getClassLoader().getResourceAsStream("sshj.properties"));
9393
String property = properties.getProperty("sshj.version");
9494
return "SSHJ_" + property.replace('-', '_'); // '-' is a disallowed character, see RFC-4253#section-4.2
95-
} catch (IOException e) {
95+
} catch (Exception e) {
9696
log.error("Could not read the sshj.properties file, returning an 'unknown' version as fallback.");
9797
return "SSHJ_VERSION_UNKNOWN";
9898
}

0 commit comments

Comments
 (0)