I've been trying to SSL-ify my gRPC service (which works fine in plaintext mode). Note: this is in a commercial context which limits some of my options (such as development environment & deployment platform).
I followed SECURITY.md which recommends using OpenSSL ... and therefore netty-tcnative ... which leads to Forked Tomcat Native and a number of choices:
netty-tcnative-{arch}
- dynamically linked, requires APR and OpenSSL already installed on target systemsnetty-tcnative-boringssl-static-{os_arch}
- statically linked to APR and google's OpenSSL forknetty-tcnative-boringssl-static
- statically linked uber jar with native libraries for common platformsnetty-tcnative-openssl-static-{os_arch}
- statically linked to APR and OpenSSL ... but isn't on maven central so not my first choice
#3
The doc says #3 is the simplest artifact to use. But, for me, that results in a failure to find netty-tcnative.dll (which, in this case, should come from the jar AFAIK).
#2
This looks to be the next simplest.
Supposedly I can use os-maven-plugin to figure out, at build time, the classifier to use for the versions of these artifacts that require one (i.e. 2 and 4).
Although it correctly works them out (according to mvn compile
output), I get different runtime behaviour:
- using
<classifier>${os.detected.classifier}</classifier>
I getjava.lang.ClassNotFoundException: org.apache.tomcat.jni.SSL
- hard-coding to
<classifier>windows-x86_64</classifier>
I get further but still no cigar: now netty-tcnative won't load:java.lang.UnsatisfiedLinkError: C:\Temp\netty-tcnative1392766600896877072.dll: Can't find dependent libraries
(an unusual path because the DLL's been copied from the jar to my temp directory andSystem.load
'ed from there)- According to dependency walker, that DLL has a whole stack of dependencies some of which really don't appear on my filesystem. But it seems that's because depends.exe hasn't kept up with the times.
- The same code also doesn't work on a colleague's PC so it's not just me.
- And I still have a problem because my target system is RHEL, not Windows (my kingdom for a Linux workstation!). So I'd have to figure out how to fix the
${os.detected.filesystem}
problem...
#4
This might work I guess. But it's not on maven central so is not my favoured path.
#1
Probably would work. But means installing APR and OpenSSL on whichever servers we deploy upon. I don't like my chances of that for internal PaaS I have to use. Avoid for now.
TLS with JDK
I might try this. But the doc strongly recommends against it as you have to fiddle with Java's bootclasspath (I can imagine more PaaS obstacles here, perhaps unfounded...). And it's apparently not overly performant (>10x slower than OpenSSL). And it's brittle (Jetty-ALPN version must correspond exactly with JRE in use although it sounds like there may be solutions to this).
The bottom line
If I can't solve this problem, it may kill gRPC for my project. Whether or not that's a bad thing is up for debate... In the meantime, does anyone have any ideas or a working SSL-ified gRPC client/server app (grpc-java/examples all use plaintext only).