To allow a RAM user to call Blockchain as a Service (BaaS) APIs, create an authorization policy that grants the required permissions. In the policy, specify the authorized resource using its Alibaba Cloud Resource Name (ARN).
This topic describes the Resource Access Management (RAM) authentication rules for Blockchain as a Service (BaaS). You can use these rules to authenticate team members, grant resource access across different accounts, and authorize access across cloud services. For more information about RAM, see the RAM documentation and RAM API reference.
Authorizable Hyperledger Fabric resource types
When you grant permissions to a RAM user, describe Hyperledger Fabric resources as follows:
| Resource type | Resource description method in an authorization policy |
| Consortium | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| Organization | acs:baas:$regionId:$accountId:organization/$organizationId |
| Channel | acs:baas:*:$accountId:channel/$channelId |
| Chaincode | acs:baas:*:$accountId:chaincode/$chaincodeId |
In these formats, $regionId is the region where the resource is located. $accountId is the ID of the Alibaba Cloud account that owns the resource. $consortiumId/$organizationId/$channelId/$chaincodeId is the ID of the resource in BaaS.
Authorizable Hyperledger Fabric APIs
The following table lists the Hyperledger Fabric blockchain APIs that are authorized by default. RAM users and Security Token Service (STS) token holders have permissions for these APIs by default:
| API |
| CheckFabricConsortiumDomain |
| CheckFabricOrganizationDomain |
| DescribeTasks |
| DescribeRootDomain |
| DescribeFabricConsortiumConfig |
| DescribeFabricConsortiumSpecs |
| DescribeFabricOrganizationSpecs |
| DescribeFabricInviter |
| DescribeFabricChaincodeUploadPolicy |
| AcceptFabricInvitation |
The following table lists the authorizable APIs in Hyperledger Fabric and their corresponding ARN formats:
| API | Resource description |
| CreateFabricOrganization | acs:baas:$regionId:$accountId:organization/* |
| DescribeFabricOrganization | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricOrganizationDeletable | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricOrganizations | acs:baas:*:$accountId:organization/* |
| DescribeFabricCandidateOrganizations | acs:baas:*:$accountId:organization/* |
| CreateFabricChannel | acs:baas:*:$accountId:channel/* acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DescribeFabricOrganizationChannels | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricConsortiumChannels | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| CreateFabricChannelMember | acs:baas:*:$accountId:channel/$channelId |
| DescribeFabricChannelMembers | acs:baas:*:$accountId:channel/$channelId |
| JoinFabricChannel | acs:baas:*:$accountId:channel/$channelId |
| CreateFabricConsortium | acs:baas:$regionId:$accountId:consortium/* |
| CreateFabricConsortiumMember | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| ConfirmFabricConsortiumMember | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DescribeFabricOrganizationMembers | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricOrganizationPeers | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricConsortiums | acs:baas:*:$accountId:consortium/* |
| DescribeFabricConsortiumAdminStatus | acs:baas:*:$accountId:consortium/* |
| DescribeFabricConsortiumMembers | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DescribeFabricConsortiumMemberApproval | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DescribeFabricConsortiumOrderers | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DescribeFabricConsortiumDeletable | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| CreateFabricChaincode | acs:baas:*:$accountId:chaincode/* acs:baas:*:$accountId:channel/$channelId acs:baas:$regionId:$accountId:consortium/$consortiumId acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricOrganizationChaincodes | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricConsortiumChaincodes | acs:baas:$regionId:$accountId:consortium/$consortiumId |
| DeleteFabricChaincode | acs:baas:*:$accountId:chaincode/$chaincodeId |
| InstallFabricChaincode | acs:baas:*:$accountId:chaincode/$chaincodeId acs:baas:$regionId:$accountId:organization/$organizationId |
| InstantiateFabricChaincode | acs:baas:*:$accountId:chaincode/$chaincodeId acs:baas:$regionId:$accountId:organization/$organizationId |
| UpgradeFabricChaincode | acs:baas:*:$accountId:chaincode/$chaincodeId acs:baas:$regionId:$accountId:organization/$organizationId |
| SynchronizeFabricChaincode | acs:baas:*:$accountId:chaincode/$chaincodeId acs:baas:$regionId:$accountId:organization/$organizationId |
| CreateFabricOrganizationUser | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricOrganizationUsers | acs:baas:$regionId:$accountId:organization/$organizationId |
| ResetFabricOrganizationUserPassword | acs:baas:$regionId:$accountId:organization/$organizationId |
| DownloadFabricOrganizationSDK | acs:baas:$regionId:$accountId:organization/$organizationId |
| DescribeFabricInvitationCode | acs:baas:$regionId:$accountId:consortium/$consortiumId |
Examples of Hyperledger Fabric RAM rules
Example 1: Grant read-only permissions for BaaS. These permissions allow users to view the blockchain status and download the SDK using the console or APIs.
{
"Statement": [{
"Action": ["baas:Describe*","baas:DownloadFabricOrganizationSDK"],
"Effect": "Allow",
"Resource": "acs:baas:*:*:*"
}],
"Version": "1"
}{
"Statement": [{
"Action": "baas:*Chaincode",
"Effect": "Allow",
"Resource": ["acs:baas:*:*:chaincode/*","acs:baas:*:*:organization/*", "acs:baas:*:*:consortium/*","acs:baas:*:*:channel/*"]
}],
"Version": "1"
}Example 3: Grant fine-grained permissions to a chaincode developer. This authorization typically requires all read permissions and chaincode management permissions for a specific organization. In accordance with the least privilege principle, the user is restricted to creating chaincodes only for specified consortiums, organizations, and channels. The user can also install or instantiate chaincodes only on specific organizations. Replace $consortiumId/$organizationId/$channelId with the ID of the resource in BaaS.
{
"Statement": [{
"Action": ["baas:Describe*","baas:DownloadFabricOrganizationSDK"],
"Effect": "Allow",
"Resource": "acs:baas:*:*:*"
},
{
"Action": "baas:*Chaincode",
"Effect": "Allow",
"Resource": ["acs:baas:*:*:chaincode/*","acs:baas:*:*:organization/$organizationId","acs:baas:*:*:consortium/$consortiumId","acs:baas:*:*:channel/$channelId"]
}],
"Version": "1"
}