Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dc250d0
Skelton STS API endpoint implemented by Claude
len548 May 29, 2025
731a3e0
Move STS endpoint service to webadmin by Claude Code. s3g is not work…
len548 Jun 17, 2025
ff3a1df
Combined /secret and /sts endpoints into one servlet, but still failing.
len548 Jun 18, 2025
2952260
Renamed package name (s3sts -> sts)
len548 Jun 18, 2025
f44a2d3
Add skeleton STS API on 9878 S3 Gateway
len548 Jun 19, 2025
f61e8cb
Add authentication to only allow admins to call assume-role API
len548 Jun 23, 2025
bfd10a4
unit test, improve error handlings, and add TODOs
len548 Jul 13, 2025
1738429
removed unused lines and metrics
len548 Jul 13, 2025
edff7ce
Added a desgin doc
len548 Jul 16, 2025
6065b94
Corrected misinformation on the design doc
len548 Jul 16, 2025
b7038fa
Move a design doc to HDDS-13323 branch
len548 Jul 16, 2025
ad8260f
WIP: refactoring STS into webadmin port 19878 [skip ci]
len548 Jul 18, 2025
4475770
WIP: new third port in S3 Gateway for STS [skip ci]
len548 Jul 23, 2025
593fc4c
WIP: fixed to establish a third port [skip ci] with sts endpoint not …
len548 Jul 24, 2025
05a9b7a
Refactored webadmin port to house both s3secret and sts endpoints.
len548 Jul 30, 2025
19dcdb3
Address CI tests
len548 Aug 4, 2025
47f232a
removed unused sts config keys and fixed TestSTS
len548 Aug 7, 2025
ccc683f
Added 19878 port number to ozonesecure and modified web.xml
len548 Aug 17, 2025
f09633d
Fixed checkstyle
len548 Aug 17, 2025
bf98d1b
Address intergration test failure
len548 Aug 18, 2025
720876e
Merge branch 'master' of github.com:apache/ozone into HDDS-13345-sts-…
len548 Aug 18, 2025
7e64053
Fixed checkstyle
len548 Aug 19, 2025
75a5b2e
Add filter to disable STS API
len548 Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,14 @@
will be used for http authentication.
</description>
</property>
<property>
<name>ozone.s3g.sts.http.enabled</name>
<value>false</value>
<tag>OZONE, S3GATEWAY</tag>
<description>
The boolean which enables the Ozone S3Gateway STS endpoint.
</description>
</property>
<property>
<name>ozone.s3g.metrics.percentiles.intervals.seconds</name>
<value>60</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ services:
- ./krb5.conf:/etc/krb5.conf
ports:
- 9878:9878
- 19878:19878
env_file:
- ./docker-config
command: ["/opt/hadoop/bin/ozone","s3g", "-Dozone.om.transport.class=${OZONE_S3_OM_TRANSPORT:-org.apache.hadoop.ozone.om.protocolPB.GrpcOmTransportFactory}"]
Expand Down
2 changes: 2 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ OZONE-SITE.XML_hdds.datanode.kerberos.keytab.file=/etc/security/keytabs/dn.keyta

OZONE-SITE.XML_ozone.security.http.kerberos.enabled=true
OZONE-SITE.XML_ozone.s3g.secret.http.enabled=true
OZONE-SITE.XML_ozone.s3g.sts.http.enabled=true
OZONE-SITE.XML_ozone.http.filter.initializers=org.apache.hadoop.security.AuthenticationFilterInitializer

OZONE-SITE.XML_ozone.om.http.auth.type=kerberos
OZONE-SITE.XML_hdds.scm.http.auth.type=kerberos
OZONE-SITE.XML_hdds.datanode.http.auth.type=kerberos
OZONE-SITE.XML_ozone.s3g.http.auth.type=kerberos
OZONE-SITE.XML_ozone.s3g.secret.http.auth.type=kerberos
OZONE-SITE.XML_ozone.s3g.sts.http.auth.type=kerberos
OZONE-SITE.XML_ozone.httpfs.http.auth.type=kerberos
OZONE-SITE.XML_ozone.recon.http.auth.type=kerberos

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.recon.ReconServerConfigKeys;
import org.apache.hadoop.ozone.s3.S3GatewayConfigKeys;
import org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys;
import org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys;
import org.apache.hadoop.ozone.s3web.s3sts.S3STSConfigKeys;

/**
* Tests if configuration constants documented in ozone-defaults.xml.
Expand All @@ -45,6 +46,7 @@ public void initializeMemberVariables() {
ReconConfigKeys.class, ReconServerConfigKeys.class,
S3GatewayConfigKeys.class,
S3SecretConfigKeys.class,
S3STSConfigKeys.class,
SCMHTTPServerConfig.class,
SCMHTTPServerConfig.ConfigStrings.class,
ScmConfig.ConfigStrings.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import static org.apache.hadoop.ozone.s3.S3GatewayConfigKeys.OZONE_S3G_WEBADMIN_HTTP_BIND_PORT_DEFAULT;
import static org.apache.hadoop.ozone.s3.S3GatewayConfigKeys.OZONE_S3G_WEBADMIN_HTTP_ENABLED_KEY;
import static org.apache.hadoop.ozone.s3.S3GatewayConfigKeys.OZONE_S3G_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL;
import static org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_AUTH_TYPE_DEFAULT;
import static org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_AUTH_TYPE_KEY;
import static org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY;
import static org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY_DEFAULT;
import static org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_AUTH_TYPE_DEFAULT;
import static org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_AUTH_TYPE_KEY;
import static org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY;
import static org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY_DEFAULT;
import static org.apache.hadoop.security.authentication.server.AuthenticationFilter.AUTH_TYPE;

import com.google.common.base.Strings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public static String createSignatureBase(
}
strToSign.append(signatureInfo.getDateTime()).append(NEWLINE);
strToSign.append(credentialScope).append(NEWLINE);

String canonicalRequest = buildCanonicalRequest(
scheme,
method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web;

import org.glassfish.jersey.server.ResourceConfig;

Expand All @@ -24,6 +24,6 @@
*/
public class Application extends ResourceConfig {
public Application() {
packages("org.apache.hadoop.ozone.s3secret");
packages(true, "org.apache.hadoop.ozone.s3web");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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.
*/

/**
* This package contains the top level generic classes of s3 web gateway.
*/
package org.apache.hadoop.ozone.s3web;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import java.io.IOException;
import java.security.Principal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

/**
* This class contains constants for configuration keys used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import static org.apache.hadoop.ozone.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY;
import static org.apache.hadoop.ozone.s3web.s3secret.S3SecretConfigKeys.OZONE_S3G_SECRET_HTTP_ENABLED_KEY;

import java.io.IOException;
import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
/**
* This package contains the top level generic classes of s3 secret gateway.
*/
package org.apache.hadoop.ozone.s3secret;
package org.apache.hadoop.ozone.s3web.s3secret;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/

package org.apache.hadoop.ozone.s3web.s3sts;

/**
* This class contains constants for configuration keys used
* in S3 STS endpoint.
*/
public final class S3STSConfigKeys {
public static final String OZONE_S3G_STS_HTTP_ENABLED_KEY =
"ozone.s3g.sts.http.enabled";

/**
* Never constructed.
*/
private S3STSConfigKeys() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.
*/

package org.apache.hadoop.ozone.s3web.s3sts;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.ws.rs.NameBinding;

/**
* Annotation to disable S3 STS Endpoint.
*/
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface S3STSEnabled {
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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.
*/

package org.apache.hadoop.ozone.s3web.s3sts;

import static org.apache.hadoop.ozone.s3web.s3sts.S3STSConfigKeys.OZONE_S3G_STS_HTTP_ENABLED_KEY;

import java.io.IOException;
import javax.inject.Inject;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;

/**
* Filter that disables all endpoints annotated with {@link S3STSEnabled}.
* Condition is based on the value of the configuration key
* ozone.s3g.s3sts.http.enabled.
*/
@S3STSEnabled
@Provider
public class S3STSEnabledEndpointRequestFilter implements ContainerRequestFilter {
@Inject
private OzoneConfiguration ozoneConfiguration;

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
boolean isSTSEnabled = ozoneConfiguration.getBoolean(
OZONE_S3G_STS_HTTP_ENABLED_KEY, false);
if (!isSTSEnabled) {
String errorMessage = "S3 STS endpoint is disabled.";
String errorCode = "AccessDenied";
String xmlError = "<ErrorResponse xmlns=\"https://sts.amazonaws.com/doc/2011-06-15/\">" +
"<Error>" +
"<Type>Sender</Type>" +
"<Code>" + errorCode + "</Code>" +
"<Message>" + errorMessage + "</Message>" +
"</Error>" +
"<RequestId>" + requestContext.getHeaderString("x-amz-request-id") + "</RequestId>" +
"</ErrorResponse>";

requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST)
.entity(xmlError)
.type(MediaType.APPLICATION_XML_TYPE)
.build());
}
}
}
Loading