Skip to content

Commit

Permalink
Yetus checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuj Modi committed Apr 3, 2024
1 parent a79cae1 commit 554fc39
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void initialize(final Configuration configuration,
* @param fileSystem the name of the fileSystem.
* @param path the file or directory path.
* @param operation the operation to be performed on the path.
* @return
* @throws IOException
* @return Fixed SAS Token
* @throws IOException never
*/
@Override
public String getSASToken(final String account,
Expand Down
54 changes: 34 additions & 20 deletions hadoop-tools/hadoop-azure/src/site/markdown/abfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
limitations under the License. See accompanying LICENSE file.
-->

# Hadoop Azure Support: ABFS Azure Data Lake Storage Gen2
# Hadoop Azure Support: ABFS - Azure Data Lake Storage Gen2

<!-- MACRO{toc|fromDepth=1|toDepth=3} -->

Expand Down Expand Up @@ -356,13 +356,13 @@ the password, "key", retrieved from the XML/JCECKs configuration files.

```xml
<property>
<name>fs.azure.account.auth.type.abfswales1.dfs.core.windows.net</name>
<name>fs.azure.account.auth.type.ACCOUNT_NAME.dfs.core.windows.net</name>
<value>SharedKey</value>
<description>
</description>
</property>
<property>
<name>fs.azure.account.key.abfswales1.dfs.core.windows.net</name>
<name>fs.azure.account.key.ACCOUNT_NAME.dfs.core.windows.net</name>
<value>ACCOUNT_KEY</value>
<description>
The secret password. Never share these.
Expand Down Expand Up @@ -610,27 +610,29 @@ In case delegation token is enabled, and the config `fs.azure.delegation.token

### Shared Access Signature (SAS) Token Provider

A shared access signature (SAS) provides secure delegated access to resources in your storage account.
With a SAS, you have granular control over how a client can access your data.
To know more about how SAS Authentication works refer to [Grant limited access to Azure Storage resources using shared access signatures (SAS)](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)
A shared access signature (SAS) provides secure delegated access to resources in
your storage account. With a SAS, you have granular control over how a client can access your data.
To know more about how SAS Authentication works refer to
[Grant limited access to Azure Storage resources using shared access signatures (SAS)](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)

There are three types of SAS supported by Azure Storage:
- [User Delegation SAS](https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas): Recommended for use with ABFS Driver with HNS Enabled ADLS Gen2 accounts. It is Identify based SAS that works at blob/directory level)
- [Service SAS](https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas): Global and works at container level.
- [Account SAS](https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas): Global and works at account level.

#### Known Issues With SAS
- SAS Based Authentication works only with HNS Enabled ADLS Gen2 Accounts which is a recommended account type to be used with ABFS.
- SAS Based Authentication works only with HNS Enabled ADLS Gen2 Accounts which
is a recommended account type to be used with ABFS.
- Certain root level operations are known to fail with SAS Based Authentication.

#### Using User Delegation SAS with ABFS

- **Description**: ABFS allows you to implement your custom SAS Token Provider that uses your identity
to create a user delegation key which then can be used to create SAS instead of storage account key.
The declared class must implement `org.apache.hadoop.fs.azurebfs.extensions.SASTokenProvider`.
- **Description**: ABFS allows you to implement your custom SAS Token Provider

Check failure on line 630 in hadoop-tools/hadoop-azure/src/site/markdown/abfs.md

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-tools/hadoop-azure/src/site/markdown/abfs.md#L630

blanks: end of line
that uses your identity to create a user delegation key which then can be used to
create SAS instead of storage account key. The declared class must implement
`org.apache.hadoop.fs.azurebfs.extensions.SASTokenProvider`.

- **Configuration**: To use this method with ABFS Driver, specify the following properties in your `core-site.xml` file:

1. Authentication Type:
```xml
<property>
Expand All @@ -646,10 +648,17 @@ The declared class must implement `org.apache.hadoop.fs.azurebfs.extensions.SAST
<value>CUSTOM_SAS_TOKEN_PROVIDER_CLASS</value>
</property>
```

Check failure on line 651 in hadoop-tools/hadoop-azure/src/site/markdown/abfs.md

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-tools/hadoop-azure/src/site/markdown/abfs.md#L651

blanks: end of line
Replace `CUSTOM_SAS_TOKEN_PROVIDER_CLASS` with fully qualified class name of
your custom token provider implementation. Depending upon the implementation you
might need to specify additional configurations that are required by your custom
implementation.

Replace `CUSTOM_SAS_TOKEN_PROVIDER_CLASS` with fully qualified class name of your custom token provider implementation. Depending upon the implementation you might need to specify additional configurations that are required by your custom implementation.<br>
- **Example**: ABFS Hadoop Driver provides a [MockDelegationSASTokenProvider](https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/extensions/MockDelegationSASTokenProvider.java)
implementation that can be used as an example on how to implement your own custom
SASTokenProvider. This requires the Application credentials to be specifed using
the following configurations apart from above two:

- **Example**: ABFS Hadoop Driver provides a [MockDelegationSASTokenProvider](https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/extensions/MockDelegationSASTokenProvider.java) implementation that can be used as an example on how to implement your own custom SASTokenProvider. This requires the Application credentials to be specifed using the following configurations apart from above two:
1. App Service Principle Tenant Id:
```xml
<property>
Expand Down Expand Up @@ -679,12 +688,14 @@ The declared class must implement `org.apache.hadoop.fs.azurebfs.extensions.SAST
</property>
```

- **Security**: More secure than Shared Key and allows granting limited access to data without exposing the access key. Recommended to be used only with HNS Enabled, ADLS Gen 2 storage accounts.
- **Security**: More secure than Shared Key and allows granting limited access
to data without exposing the access key. Recommended to be used only with HNS Enabled,
ADLS Gen 2 storage accounts.

#### Using Account/Service SAS with ABFS

- **Description**: ABFS allows user to use Account/Service SAS for authenticating requests.
User can specify them as fixed SAS Token to be used across all the requests.
- **Description**: ABFS allows user to use Account/Service SAS for authenticating
requests. User can specify them as fixed SAS Token to be used across all the requests.

- **Configuration**: To use this method with ABFS Driver, specify the following properties in your `core-site.xml` file:

Expand All @@ -703,12 +714,15 @@ User can specify them as fixed SAS Token to be used across all the requests.
<value>FIXED_SAS_TOKEN</value>
</property>
```

Check failure on line 717 in hadoop-tools/hadoop-azure/src/site/markdown/abfs.md

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-tools/hadoop-azure/src/site/markdown/abfs.md#L717

blanks: end of line
Replace `FIXED_SAS_TOKEN` with fixed Account/Service SAS. You can also
generate SAS from Azure portal. Account -> Security + Networking -> Shared Access Signature

Replace `FIXED_SAS_TOKEN` with fixed Account/Service SAS. You can also generate SAS from Azure portal. Account -> Security + Networking -> Shared Access Signature

- **Security**: Account/Service SAS requires account keys to be used which makes them less secure. There is no scope of having delegated access to different users.
- **Security**: Account/Service SAS requires account keys to be used which makes
them less secure. There is no scope of having delegated access to different users.

*Note:* When `fs.azure.sas.token.provider.type` and `fs.azure.fixed.sas.token` are both configured, precedence will be given to the custom token provider implementation.
*Note:* When `fs.azure.sas.token.provider.type` and `fs.azure.fixed.sas.token`
are both configured, precedence will be given to the custom token provider implementation.

## <a name="technical"></a> Technical notes

Expand Down

0 comments on commit 554fc39

Please sign in to comment.