IBM Cloud Docs
Establishing service-to-service authorizations for File Storage for VPC

Establishing service-to-service authorizations for File Storage for VPC

You can use the Cloud Identity and Access Management (IAM) to create or remove an authorization that grants one service access to another service. For File Storage for VPC, you need to create service-to-service authorization for configuring customer-managed encryption and setting up cross-region replication.

Overview

In an authorization, the source service is the service that is granted access to the target service. The roles that you select define the level of access for the source service. The target service is the service that you are granting permission to be accessed by the source service based on the roles that you assign. Generally, a source service can be in the same account where the authorization is created or in another account. The target service is always in the account where the authorization is created.

To be able to create an encrypted file share with customer-managed CRKs, you need to establish service-to-service authorization between the File service and the Key Management Service of your choice. The instructions to create the service-to-service authorization are provided in this topic. For more information about using another account's CRK, see Cross-account encryption for File Storage resources.

For cross-region replication, you need to establish service-to-service authorizations and specify user roles for the various File service instances in different VPCs. This authorization enables the File service in one VPC to interact with the File service of another VPC. Both VPCs must belong to the same account. Cross-account replication is not supported. For more information, see Replication overview.

For more information about authorizations, see Using authorizations to grant access between services.

Creating service-to-service authorization for customer-managed encryption in the UI

You can access the Manage authorizations by clicking Manage > Access (IAM) > Authorizations.

  1. On the Manage authorizations page, click Create.
  2. On the Grant a service authorization page, select the source account.
  3. For the source service, select VPC Infrastructure Services from the list.
  4. Select the scope. Choose Resources based on selected attributes.
  5. Click Resource type. From the list, select File Storage for VPC.
  6. For the target service, select Hyper Protect Crypto Services or KeyProtect from the list.
  7. Check the box to enable authorization to be delegated by source and dependent services.
  8. Then, under Service access, select the role Reader.
  9. Click Authorize.

Creating service-to-service authorization for cross-region replication in the UI

  1. On the Manage authorizations page, click Create.
  2. On the Grant a service authorization page, select the source account.
  3. For the source service, select VPC Infrastructure Services from the list.
  4. Select the scope. Choose Resources based on selected attributes.
  5. Click Resource type. From the list, select File Storage for VPC.
  6. For the target service, select VPC Infrastructure Services from the list.
  7. Select the scope. Choose Resources based on selected attributes.
  8. Click Resource type. From the list, select File Storage for VPC.
  9. Then, under Platform access, select the role Editor.
  10. Click Authorize.

Creating service-to-service authorization for customer-managed encryption from the CLI

Run the ibmcloud iam authorization-policy-create command to create authorization policies for the File service to interact with one or both Key Management Services (Key Protect or Hyper Protect Crypto Services). The source service is is with the --source-resource-type share and the target service is either kms or hs-crypto. The role that you need to assign is Reader. The following example creates an authorization policy between the File service and Key Protect.

$ ibmcloud iam authorization-policy-create is kms Reader --source-resource-type share
Creating authorization policy under account a1234567 as test.user@ibm.com...
OK

To list the service authorizatons that are already in place for the account, run the ibmcloud iam authorization-policies command. The following example shows that the file service could be encrypted with a CRK that is stored in Key Protect or Hyper Protect Crypto Services.

$ ibmcloud iam authorization-policies
Getting authorization policies under account a1234567 as test.user@ibm.com...
OK
                           
ID:                        8a2ef8a5-2e4c-46ea-b2e7-d4b0d0a0e1a5
Source service name:       is
Source service instance:   All instances
Source resource type:      share
Target service name:       hs-crypto
Target service instance:   All instances
Roles:                     Reader
                           
ID:                        d2df60ea-5575-4bd1-9cd6-f35c52576577
Source service name:       is
Source service instance:   All instances
Source resource type:      share
Target service name:       kms
Target service instance:   All instances
Roles:                     Authorization Delegator, Reader

For more information about all of the parameters that are available for this command, see ibmcloud iam authorization-policy-create.

Creating service-to-service authorization for cross-region replication from the CLI

Run the ibmcloud iam authorization-policy-create command to authorize the regional file services to work together.

ibmcloud iam authorization-policy-create is is Editor --source-resource-type share --target-resource-type share

See the following example.

$ ibmcloud iam authorization-policy-create is is Editor --source-resource-type share --target-resource-type share 
Creating authorization policy under account a1234567 as test.user@ibm.com...
OK
Authorization policy f311f255-d20e-49d0-aa94-316feaba981e was created.
                           
ID:                        f311f255-d20e-49d0-aa94-316feaba981e
Source service name:       is
Source service instance:   All instances
Source resource type:      share
Target service name:       is
Target service instance:   All instances
Target resource type:      share
Roles:                     Editor

For more information about all of the parameters that are available for this command, see ibmcloud iam authorization-policy-create.

Creating service-to-service authorization for customer-managed encryption with the API

Make a request to the IAM Policy Management API to create the service-to-service authorization for the source share's file service to interact with a Key Management Service instance (Key Protect or Hyper Protect Crypto Services).

  • The following example shows how you can authorize the File service is.share (source) to interact with the Key Protect service kms (target) with the Reader role.

    curl -X POST 'https://iam.cloud.ibm.com/v1/policies' -H 
    'Authorization: Bearer $TOKEN' -H 
    'Content-Type: application/json' -d 
    '{
      "type": "access",
      "description": "Reader role for the file service to interact with the KeyProtect service.",
      "subjects": [{"attributes": [{"name": "serviceName","value": "is"},{"name": "resourceType","value": "share"}]}],
      "roles":[{"role_id": "crn:v1:bluemix:public:iam::::role:Reader"}],
      "resources":[{"attributes": [{"name": "serviceName","value": "kms"}]}]
      }'
    
  • To create an authorization policy for Hyper Protect Crypto Services, replace kms with hs-crypto in the previous example.

Creating service-to-service authorization for cross-region replication with the API

Make a request to the IAM Policy Management API to create the service-to-service authorization for the source share's regional file service to interact with the replica share's regional file service.

  • Authorize is.share (source) to interact with is.share (target) with the Editor role.

    curl -X POST 'https://iam.cloud.ibm.com/v1/policies' -H 
    'Authorization: Bearer $TOKEN' -H 
    'Content-Type: application/json' -d 
    '{
      "type": "access",
      "description": "Editor role for the source share's regional file service to interact with replica share's regional file service.",
      "subjects": [{"attributes": [{"name": "serviceName","value": "is"},{"name": "resourceType","value": "share"}]}],
      "roles":[{"role_id": "crn:v1:bluemix:public:iam::::role:Editor"}],
      "resources":[{"attributes": [{"name": "serviceName","value": "is"},{"name": "resourceType","value": "share"}]}]
      }'
    

For more information, see the api spec for IAM Policy Management.

Creating service-to-service authorization for customer-managed encryption with Terraform

Create an authorization policy between the file service and the key management services by using the ibm_iam_authorization_policy resource argument in your main.tf file.

The following example creates an authorization policy between the file service and Key Protect when applied.

resource "ibm_iam_authorization_policy" "mypolicy4keyprotect" {
  source_service_name  = "is"
  source_resource_type = "share"
  target_service_name  = "kms"
  roles                = ["Reader"]
}

The following example creates an authorization policy between the file service and Hyper Protect Crypto Services when applied.

resource "ibm_iam_authorization_policy" "mypolicy4HPCS" {
  source_service_name  = "is"
  source_resource_type = "share"
  target_service_name  = "hs-crypto"
  roles                = ["Reader"]
}

For more information about the arguments and attributes, see the Terraform documentation for authorization resources.

Creating service-to-service authorization for cross-region replication with Terraform

Create an authorization policy between the file services in the different regions by using the ibm_iam_authorization_policy resource argument in your main.tf file.

resource "ibm_iam_authorization_policy" "mypolicy" {
  source_service_name  = "is"
  source_resource_type = "share"
  target_service_name  = "is"
  target_resource_type = "share"
  roles                = ["Editor"]
}

For more information about the arguments and attributes, see the Terraform documentation for authorization resources.

Next Steps