MYRIAD-244 Add https/ssl support for Myriad REST APIs and UI#95
MYRIAD-244 Add https/ssl support for Myriad REST APIs and UI#95yufeldman wants to merge 2 commits intoapache:masterfrom
Conversation
| } | ||
|
|
||
| ret.setName("Myriad"); | ||
| ret.setHost("0.0.0.0"); |
There was a problem hiding this comment.
We might want to be careful here, some people may prefer to only bind to one interface.
There was a problem hiding this comment.
Could you elaborate - I did not quite understand your comment?
There was a problem hiding this comment.
In the case of machines with multiple network interfaces each will have a separate ip address, it's sometimes preferable to only bind to only one ip. Cases include: 1 ip is used to admin, 1 nic is public, etc. I think it's fine for now but we may wish to revisit (I think I'd like it to bind to exactly the same ip(s) as the resourcemanager, though others may disagree).
There was a problem hiding this comment.
Aah, I was thinking you were commenting on my changes. Yes - we could bind it on RM host/ip - I think it is actually host not IP though.
There was a problem hiding this comment.
Sorry I noticed it without paying attention to when it was created. Let's make a mental note but shelve for now.
| if (keyStore != null) { | ||
| listener.setKeystore(keyStore); | ||
| listener.setKeystoreType(sslConf.get("ssl.server.keystore.type", "jks")); | ||
| listener.setPassword(getPassword(sslConf, WEB_APP_KEYSTORE_PASSWORD_KEY)); |
There was a problem hiding this comment.
getPassword has the potential to return null, how does listener.setPassword handle this? Should we throw a more informative exception earlier or pass a sane value?
There was a problem hiding this comment.
It is true that if password is null it will actually prompt for password, so we rely on Hadoop configuration to supply it. We could certainly give at least a warning on what may happen
There was a problem hiding this comment.
Might be worth a log.warn("No password found in config if you don't want prompted please set ..."), would help debugging if running the RM in Marathon.
| mesosMaster: 10.0.2.15:5050 | ||
| haEnabled: false | ||
| checkpoint: false | ||
| isSSLEnabled: false |
There was a problem hiding this comment.
Add to src/main/resources/myriad-default.conf as minimal documentaion.
There was a problem hiding this comment.
+1 to documenting new config options
| @@ -0,0 +1,63 @@ | |||
| <?xml version="1.0"?> | |||
There was a problem hiding this comment.
should this have an Apache Header?
There was a problem hiding this comment.
Most poms have:
<!-- ~ 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. -->
| @@ -18,26 +18,84 @@ | |||
| package org.apache.myriad.webapp; | |||
|
Again minor nits, I think the headers have to be resolved before the merge. |
|
Will update PR with headers and other comments |
|
@DarinJ - wonder if you have more comments to this PR? |
|
|
||
| String trustStore = sslConf.get("ssl.server.truststore.location"); | ||
|
|
||
| if (trustStore != null) { |
There was a problem hiding this comment.
Is there a config parameter to check as opposed to a null check? I think the former is a better design as the user will have to explicitly state whether he/she wants to enable SSL authentication and we'll perform checks based upon that as opposed to checking for null
There was a problem hiding this comment.
we do have config param to enable SSL and this code is executed only is check is satisfied. sslConf is hadoop Configuration object, not a Myriad one so it will be as good as turning on SSL in RM UI/REST
| static String getPassword(Configuration conf, String alias) { | ||
| String password = null; | ||
| try { | ||
| char[] passchars = conf.getPassword(alias); |
There was a problem hiding this comment.
Is there a config parameter to check as opposed to a null check? I think the former is a better design as the user will have to explicitly state whether he/she wants to enable SSL authentication and we'll perform checks based upon that as opposed to checking for null
| password = new String(passchars); | ||
| } | ||
| } catch (IOException ioe) { | ||
| password = null; |
There was a problem hiding this comment.
Is returning a null password going to cause a difficult-to-debug NPE elsewhere?
There was a problem hiding this comment.
A lot of @hokiegeek2 suggestions could be alleviated with guava's optional.
There was a problem hiding this comment.
Those params are hadoop Configuration params, not Myriad ones and I don't think we should duplicate them in Myriad configuration.
There was a problem hiding this comment.
I agree with not duplicating parameters.
|
Tested, a few caveats with self-signed certs and mesos but I think we should merge. |
adam-mesos
left a comment
There was a problem hiding this comment.
ASF doesn't like owning binaries (like ssl_keystore and ssl_truststore). Is there any way these can be generated or retrieved as part of the build process?
A few minor nits beyond that, and a +1 on adding docs.
|
|
||
| public Boolean isSSLEnabled() { | ||
| return Optional.fromNullable(isSSLEnabled).or(DEFAULT_SSL_ENABLED); | ||
| } |
There was a problem hiding this comment.
nit: needs blank line after
| password = null; | ||
| } | ||
| if (password == null) { | ||
| LOGGER.warn("No password found in config as property: {}. If you don't want prompted please set ...", alias); |
There was a problem hiding this comment.
"If you don't want to be prompted..."
| mesosMaster: 10.0.2.15:5050 | ||
| haEnabled: false | ||
| checkpoint: false | ||
| isSSLEnabled: false |
There was a problem hiding this comment.
+1 to documenting new config options
| <property> | ||
| <name>ssl.server.truststore.location</name> | ||
| <value>${tmptest.dir}/ssl_truststore</value> | ||
| <description>Truststore to be used by webservers. Must be specified. |
There was a problem hiding this comment.
Instead of "Must be specified", how about "Required"?
| <property> | ||
| <name>ssl.server.truststore.password</name> | ||
| <value>myriad</value> | ||
| <description>Optional. Default value is "". |
There was a problem hiding this comment.
Is the default "" or "myriad"?
This is a PR to cover enabling ssl for Myriad UI and REST APIs. It heavily relies on Hadoop/YARN since it is plugin to RM anyway.