You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by pr...@apache.org on 2016/07/19 06:00:58 UTC
[1/2] apex-core git commit: APEXCORE-488: Issues in SSL communication
with StrAM - Fixed Application Master trackingURL - StramAgent shall not
assume always HTTP
Repository: apex-core
Updated Branches:
refs/heads/master d32ea3c04 -> 7ca1ed12d
APEXCORE-488: Issues in SSL communication with StrAM
- Fixed Application Master trackingURL
- StramAgent shall not assume always HTTP
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/4f3ab00a
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/4f3ab00a
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/4f3ab00a
Branch: refs/heads/master
Commit: 4f3ab00ac6738b5ec491dd1a6ec7ce6a201cd203
Parents: 1b1813f
Author: Pradeep A. Dalvi <pr...@apache.org>
Authored: Mon Jul 11 15:59:32 2016 -0700
Committer: Pradeep A. Dalvi <pr...@apache.org>
Committed: Wed Jul 13 20:35:32 2016 -0700
----------------------------------------------------------------------
.../stram/StreamingAppMasterService.java | 7 ++++++-
.../com/datatorrent/stram/client/StramAgent.java | 9 ++++++++-
.../com/datatorrent/stram/util/ConfigUtils.java | 19 +++++++++++++++++--
3 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/apex-core/blob/4f3ab00a/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java b/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
index 1c7c893..43ab743 100644
--- a/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
+++ b/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
@@ -105,6 +105,7 @@ import com.datatorrent.stram.security.StramDelegationTokenIdentifier;
import com.datatorrent.stram.security.StramDelegationTokenManager;
import com.datatorrent.stram.security.StramUserLogin;
import com.datatorrent.stram.security.StramWSFilterInitializer;
+import com.datatorrent.stram.util.ConfigUtils;
import com.datatorrent.stram.util.SecurityUtils;
import com.datatorrent.stram.webapp.AppInfo;
import com.datatorrent.stram.webapp.StramWebApp;
@@ -614,7 +615,11 @@ public class StreamingAppMasterService extends CompositeService
}
WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr));
LOG.info("Started web service at port: " + webApp.port());
- this.appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port();
+ appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port();
+
+ if (ConfigUtils.isSSLEnabled(config)) {
+ appMasterTrackingUrl = "https://" + appMasterTrackingUrl;
+ }
LOG.info("Setting tracking URL to: " + appMasterTrackingUrl);
} catch (Exception e) {
LOG.error("Webapps failed to start. Ignoring for now:", e);
http://git-wip-us.apache.org/repos/asf/apex-core/blob/4f3ab00a/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java b/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
index 1e38ef2..29de7aa 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
@@ -204,7 +204,14 @@ public class StramAgent extends FSAgent
if (info != null) {
//ws = wsClient.resource("http://" + info.appMasterTrackingUrl).path(WebServices.PATH).path(info.version).path("stram");
// the filter should convert to the right version
- ub = UriBuilder.fromUri("http://" + info.appMasterTrackingUrl).path(WebServices.PATH).path(WebServices.VERSION).path("stram");
+ String url;
+ if (!info.appMasterTrackingUrl.startsWith("http://")
+ && !info.appMasterTrackingUrl.startsWith("https://")) {
+ url = "http://" + info.appMasterTrackingUrl;
+ } else {
+ url = info.appMasterTrackingUrl;
+ }
+ ub = UriBuilder.fromUri(url).path(WebServices.PATH).path(WebServices.VERSION).path("stram");
WebServicesVersionConversion.Converter versionConverter = WebServicesVersionConversion.getConverter(info.version);
if (versionConverter != null) {
VersionConversionFilter versionConversionFilter = new VersionConversionFilter(versionConverter);
http://git-wip-us.apache.org/repos/asf/apex-core/blob/4f3ab00a/engine/src/main/java/com/datatorrent/stram/util/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/util/ConfigUtils.java b/engine/src/main/java/com/datatorrent/stram/util/ConfigUtils.java
index 0275535..9da0b0c 100644
--- a/engine/src/main/java/com/datatorrent/stram/util/ConfigUtils.java
+++ b/engine/src/main/java/com/datatorrent/stram/util/ConfigUtils.java
@@ -68,15 +68,30 @@ public class ConfigUtils
return principal;
}
- public static String getSchemePrefix(YarnConfiguration conf)
+ public static boolean isSSLEnabled(Configuration conf)
+ {
+ if (HttpConfig.Policy.HTTPS_ONLY == HttpConfig.Policy.fromString(
+ conf.get(YarnConfiguration.YARN_HTTP_POLICY_KEY, YarnConfiguration.YARN_HTTP_POLICY_DEFAULT))) {
+ return true;
+ }
+ return false;
+ }
+
+ public static String getSchemePrefix(Configuration conf)
{
- if (HttpConfig.Policy.HTTPS_ONLY == HttpConfig.Policy.fromString(conf.get(YarnConfiguration.YARN_HTTP_POLICY_KEY, YarnConfiguration.YARN_HTTP_POLICY_DEFAULT))) {
+ if (isSSLEnabled(conf)) {
return "https://";
} else {
return "http://";
}
}
+ @Deprecated
+ public static String getSchemePrefix(YarnConfiguration conf)
+ {
+ return getSchemePrefix((Configuration)conf);
+ }
+
public static String getYarnLogDir()
{
if (yarnLogDir != null) {
[2/2] apex-core git commit: Merge branch 'APEXCORE-488.ssl-issues' of
github.com:pradeepdalvi/apex-core into up-master
Posted by pr...@apache.org.
Merge branch 'APEXCORE-488.ssl-issues' of github.com:pradeepdalvi/apex-core into up-master
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/7ca1ed12
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/7ca1ed12
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/7ca1ed12
Branch: refs/heads/master
Commit: 7ca1ed12d022e7d99e2dde3dc305b4b39ae46c26
Parents: d32ea3c 4f3ab00
Author: Pramod Immaneni <pr...@datatorrent.com>
Authored: Mon Jul 18 22:48:13 2016 -0700
Committer: Pramod Immaneni <pr...@datatorrent.com>
Committed: Mon Jul 18 22:48:13 2016 -0700
----------------------------------------------------------------------
.../stram/StreamingAppMasterService.java | 7 ++++++-
.../com/datatorrent/stram/client/StramAgent.java | 9 ++++++++-
.../com/datatorrent/stram/util/ConfigUtils.java | 19 +++++++++++++++++--
3 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------