From f30ac254bbfe6b92d4b77024757cb5067b6e9b43 Mon Sep 17 00:00:00 2001 From: sychen Date: Thu, 4 May 2023 16:10:28 +0800 Subject: [PATCH 1/2] output ip --- .../yarn/server/webproxy/WebAppProxyServlet.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java index c0187ea08d367..4b7a2d5ef72e8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java @@ -396,6 +396,8 @@ private void methodAction(final HttpServletRequest req, boolean isRedirect = false; String pathInfo = req.getPathInfo(); final String remoteUser = req.getRemoteUser(); + final String remoteUserWithIPAddress = + remoteUser + "/" + req.getRemoteAddr(); String[] parts = null; @@ -411,7 +413,7 @@ private void methodAction(final HttpServletRequest req, } if ((parts == null) || (parts.length < 2)) { - LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo); + LOG.warn("{} gave an invalid proxy path {}", remoteUserWithIPAddress, pathInfo); notFound(resp, "Your path appears to be formatted incorrectly."); return; } @@ -423,7 +425,7 @@ private void methodAction(final HttpServletRequest req, if (id == null) { LOG.warn("{} attempting to access {} that is invalid", - remoteUser, appId); + remoteUserWithIPAddress, appId); notFound(resp, appId + " appears to be formatted incorrectly."); return; } @@ -467,7 +469,7 @@ private void methodAction(final HttpServletRequest req, if (applicationReport == null) { LOG.warn("{} attempting to access {} that was not found", - remoteUser, id); + remoteUserWithIPAddress, id); URI toFetch = ProxyUriUtils @@ -500,7 +502,7 @@ private void methodAction(final HttpServletRequest req, if (checkUser && !runningUser.equals(remoteUser)) { LOG.info("Asking {} if they want to connect to the " + "app master GUI of {} owned by {}", - remoteUser, appId, runningUser); + remoteUserWithIPAddress, appId, runningUser); warnUserPage(resp, ProxyUriUtils.getPathAndQuery(id, rest, req.getQueryString(), true), runningUser, id); @@ -513,7 +515,7 @@ private void methodAction(final HttpServletRequest req, LOG.info("{} is accessing unchecked {}" + " which is the app master GUI of {} owned by {}", - remoteUser, toFetch, appId, runningUser); + remoteUserWithIPAddress, toFetch, appId, runningUser); switch (applicationReport.getYarnApplicationState()) { case KILLED: From 6ad0e2883489f1d8063e5e2f8f574ebc8454943a Mon Sep 17 00:00:00 2001 From: sychen Date: Thu, 4 May 2023 17:39:36 +0800 Subject: [PATCH 2/2] trigger test