Sfoglia il codice sorgente

AMBARI-25390: Disable indexing in /resources endpoint and sub-directory (#3495)

Zhiguo Wu 3 anni fa
parent
commit
0189283b4e

+ 0 - 5
ambari-server/src/main/assemblies/server.xml

@@ -407,11 +407,6 @@
       <source>src/main/resources/APACHE-AMBARI-MIB.txt</source>
       <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
     </file>
-    <file>
-      <fileMode>755</fileMode>
-      <source>src/main/resources/index.html</source>
-      <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
-    </file>
     <file>
       <fileMode>755</fileMode>
       <source>src/main/resources/kerberos.json</source>

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java

@@ -511,6 +511,7 @@ public class AmbariServer {
       File resourcesDirectory = new File(configs.getResourceDirPath());
       ServletHolder resources = new ServletHolder(DefaultServlet.class);
       resources.setInitParameter("resourceBase", resourcesDirectory.getParent());
+      resources.setInitParameter("dirAllowed", "false");
       root.addServlet(resources, "/resources/*");
       resources.setInitOrder(5);
 

+ 0 - 17
ambari-server/src/main/resources/index.html

@@ -1,17 +0,0 @@
-<!--
-* 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.
--->