23c7e521ca505b748b888740564d6e8bcca2d1fc
[honeycomb.git] / release-notes / src / main / asciidoc / user_guide / user_honeycomb_and_ODL.adoc
1 = Honeycomb and ODL
2
3 link:release_notes.html[< Home]
4
5 Honeycomb can be managed using ODL as any NETCONF-enabled device. Please follow https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf for detailed instructions how to mount and connect to a NETCONF device
6
7 == Troubleshooting
8
9 Issues with Honeycomb and ODL integration
10
11 === Unable to open SSH session due to invalid crypto configuration
12
13 If ODL fails to open ssh session due to InvalidAlgorithmParameterException, e.g.:
14
15 [srouce]
16 ====
17 2016-09-13 13:52:34,852 | WARN  | NioProcessor-3   | ClientSessionImpl | 180 -
18 org.apache.sshd.core - 0.14.0 | Exception caught
19 java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64,
20 and can only range from 512 to 2048 (inclusive)
21  at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120)
22    [sunjce_provider.jar:1.8.0_45]
23  at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:674)
24    [:1.8.0_45-internal]
25  at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:411)
26    [:1.8.0_45-internal]
27  at org.apache.sshd.common.kex.DH.getE(DH.java:65)[180:org.apache.sshd.core:0.14.0]
28
29 ...
30
31 2016-09-13 13:52:34,852 | DEBUG | NioProcessor-3   | ClientSessionImpl | 180 -
32 org.apache.sshd.core - 0.14.0 | Closing ClientSessionImpl[admin@/127.0.0.1:2835] immediately
33 ====
34
35 It probably means BouncyCastle provider is not properly configured/loaded on the ODL side.
36
37 There are 2 solutions to this problem:
38
39 ==== Solution 1, HC side, less secure:
40
41 First solution is to not use BouncyCastle in Honeycomb. This limits its capabilities in terms of security (using just default Java stuff), but makes it compatible with Opendaylight:
42
43 As a workaround start honeycomb with (must be placed into Honeycomb's startup script)
44
45  -Dorg.apache.sshd.registerBouncyCastle=false
46
47 As a result 1024 bit DH group will be used for SSH key exchange.
48
49 ==== Solution 2, ODL side, more secure
50 Second solution is to locate mina sshd jar in ODL distribution's system folder. For Boron it is:
51
52  system/org/apache/sshd/sshd-core/0.14.0/sshd-core-0.14.0.jar
53
54 Open the jar (it's just a zip archive), locate META-INF/MANIFEST.MF file, open it and update the Import-Package section. Find this piece:
55
56  org.bouncycast.openssl;version="[1.51,2)";resolution:=optional
57
58 and replace it with:
59
60  org.bouncycast.openssl;version="[1.51,2)"
61
62 This needs to be done before ODL is started the first time or it needs to be started with "clean" parameter.
63
64 === Background
65 This issue is caused by a couple of reasons:
66
67 * ODL and HC both use mina-sshd 0.14 for SSH
68 * mina-sshd relies partially on bouncy-castle as a security provider
69 * mina-sshd only defines bouncy-castle dependencies as optional for OSGi environment (which is not correct since there are bugs in the mina-sshd where missing bouncy-castle is just not expected, causing various problems... but that's a different topic)
70 * netconf features in ODL make sure to first load bouncy-castle bundles and only then mina-sshd (in addition, bouncy-castle provider is placed in karaf's lib/ext and marked to be a security provider in karaf's etc/custom.properties)
71 * however, when loading netconf features as initial features, there seems to be some sort of race condition in karaf and mina is started without bouncy-castle available, making it work only partially
72 * but so far so good, everything loads and mina should just use less secure provider from Java
73 * however when an SSH connection is started from ODL to e.g. Honeycomb. Mina-sshd is picking key size that's only supported by bouncy-castle (not by plain JDK) during negotiation
74 * this means that if remote supports such size, mina-sshd in ODL subsequently fails, since it finds out bouncy-castle is not present and Java is unable to handle it
75
76 NOTE: If loading netconf post karaf startup manually, the issue does not appear