※このブログは2019年12月時点の情報に基づいて作成されているため、現在の状況と異なる可能性がございます。
この記事はOracle Cloud Infrastructure(その2) Advent Calendar 2019 - Adventar の12/20の記事です。
先月入社しましたid:s.ikeokaです。
山口といえば山賊が有名ですよね!!私も子供の頃からよく食べてました。
今回はOracle Cloudポリシー設定についてまとめてみました。設定はコンソールから>Identity>Policiesで行います。

【目次】
1.ポリシーの基本
2.ポリシーの構文
3.一覧
4.まとめ
1.ポリシーの基本
リソースの制御を管理するために、会社には少なくとも1つのポリシーがあります。
各ポリシーは、次の基本構文に従う1つ以上のポリシーステートメントで構成されます。
Allow group <group_name> to <verb> <resource-type> in compartment <compartment_name> Allow group <group_name> to <verb> <resource-type> in tenancy Allow <subject> to <verb> <resource-type> in <location> where <conditions>
ポリシーの優先順位
・暗黙のDeny<明示的なAllow
・構文はAllowから始まる
2.ポリシーの構文
ポリシー・ステートメントの全体的な構文は次のとおりです。
Allow <subject> to <verb> <resource-type> in <location> where <conditions>
文の空白や改行は無効です。
ポリシーとステートメントの数の制限については、「サービス制限」を参照してください。
■subject
1つ以上のコンマ区切りのグループを名前またはOCIDで指定します。
または、any-userを指定して、テナンシ内のすべてのユーザーをカバーします。
Syntax: goup <group_name> | group id <group_ocid> | dynamic-group <dynamic-group_name> | dynamic-group id<dynamic-group_ocid> | any-user
次に例を示します。
・1つのグループを名前で指定する
Allow group A-Admins to manage all-resources in compartment Project-A
・複数のグループを名前で指定する
Allow group A-Admins, B-Admins to manage all-resources in compartment Projects-A-and-B
・OCIDによって単一のグループを指定するには(OCIDは簡潔にするために短縮されています。)
Allow group id ocid1.group.oc1..aaaaaaaaqjihfhvxmum...awuc7i5xwe6s7qmnsbc6a to manage all-resources in compartment Project-A
・OCIDによって複数のグループを指定するには(OCIDは簡潔にするために短縮されています。)
Allow group id ocid1.group.oc1..aaaaaaaaqjihfhvxmumrl...wuc7i5xwe6s7qmnsbc6a, id ocid1.group.oc1..aaaaaaaavhea5mellwzb...66yfxvl462tdgx2oecyq to manage all-resources in compartment Projects-A-and-B
■Verb(動詞)
単一のVerbを指定します。Verbsのリストについては、「Verbs」を参照。
Allow group A-Admins to manage all-resources in compartment Project-A
■Resource-Type
次のいずれかの単一のリソースタイプを指定します。
・An individual resource-type (e.g., vcns, subnets, instances, volumes, etc.)
・A family resource-type (e.g., virtual-network-family, instance-family, volume-family, etc.)
・all-resources: Covers all resources in the compartment (or tenancy.)
使用可能なリソース・タイプのリストについては「Resource-Type」を参照。
・単一のリソースタイプを指定するには
Allow group HelpDesk to manage users in tenancy
・複数のリソースタイプを指定するには、個別のステートメントを使用します。
Allow group A-Users to manage instance-family in compartment Project-A Allow group A-Users to manage volume-family in compartment Project-A
・コンパートメント(またはテナンシー)のすべてのリソースを指定する
Allow group A-Admins to manage all-resources in compartment Project-A
3.一覧
| Subject | |
|---|---|
| group | group_name or OCID |
| user | user-name |
| Verbs | ||
|---|---|---|
| Verb | Types of Access Covered | Target User |
| inspect | リソースの一部である可能性のある機密情報やユーザー指定のメタデータにアクセスすることなく、リソースをリストする機能を提供します。 | Third-party auditors |
| read | inspectとユーザー指定のメタデータと実際のリソース自体を取得する機能が含まれています。 | Internal auditors |
| use | readと既存のリソースを処理する機能(リソース・タイプによってアクションが異なる)が含まれます。 | Day-to-day end users of resources |
| manage | リソースのすべてのアクセス許可が含まれます。 | Administrators |
| Resource-Type | ||
|---|---|---|
| Familly Type | service | Individual Type |
| all-resources | all-resources | すべてのOracle Cloud Infrastructureリソース・タイプ |
| cluster-family | Container Engine for Kubernetes | clusters |
| cluster-node-pools | ||
| cluster-work-requests | ||
| autonomous-database-family | Autonomous Database | autonomous-databases |
| autonomous-backups | ||
| autonomous-container-databases | ||
| autonomous-exadata-infrastructures | ||
| database-family | Bare Metal, Virtual Machine,Exadata DB Systems | db-systems |
| db-nodes | ||
| db-homes | ||
| databases | ||
| backups | ||
| Exadata Cloud at Customer | exadata-infrastructures | |
| vmcluster-networks | ||
| vmclusters | ||
| backups-destinations | ||
| db-nodes | ||
| db-homes | ||
| databases | ||
| backups | ||
| dns | DNS | dns-zones |
| dns-records | ||
| dns-steering-policies | ||
| dns-steering-policy-attachments | ||
| file-family | File Storage | file-systems |
| mount-targets | ||
| export-sets | ||
| object-family | Object Storage, Archive Storage,Data Transfer | objectstorage-namespaces |
| buckets | ||
| objects | ||
| instance-family | Compute | app-catalog-listing |
| console-histories | ||
| instances | ||
| instance-console-connection | ||
| instance-images | ||
| volume-attachments | ||
| virtual-network-family | Networking | vcns |
| subnets | ||
| route-tables | ||
| network-security-groups | ||
| security-lists | ||
| dhcp-options | ||
| private-ips | ||
| public-ips | ||
| ipv6s | ||
| internet-gateways | ||
| nat-gateways | ||
| service-gateways | ||
| local-peering-gateways | ||
| remote-peering-connections | ||
| drgs | ||
| drg-attachments | ||
| cpes | ||
| ipsec-connections | ||
| cross-connects | ||
| cross-connect-groups | ||
| virtual-circuits | ||
| vnics | ||
| vnic-attachments | ||
| volume-family | Block Volume | volumes |
| volume-attachments | ||
| volume-backups | ||
| boot-volume-backups | ||
| backup-policies | ||
| backup-policy-assignments | ||
| volume-groups | ||
| volume-group-backups | ||
| Conditions | |
|---|---|
| resource | variable |
| All Requests | request.user.id |
| request.user.mfaTotpVerified | |
| request.groups.id | |
| target.compartment.id | |
| target.compartment.name | |
| request.operation | |
| request.permission | |
| request.region | |
| request.ad | |
| clusters | target.cluster.id |
| cluster-node-pools | target.nodepool.id |
| dns-zones | target.dns-zone.id |
| target.dns-zone.name | |
| dns-records | target.dns-zone.id |
| target.dns-zone.name | |
| target.dns-zone.scope | |
| target.dns-record.type | |
| target.dns-domain.name | |
| dns-steering-policies | target.dns-steering-policy.id |
| target.dns-steering-policy.display-name | |
| instance-family,virtual-network-family,volume-family | target.boot-volume.kms-key.id |
| buckets, objects | target.bucket.name |
| request.vcn.id | |
| request.ipv4.ipaddress | |
4.感想
・AWS IAMポリシーの作成はWebコンソールから感覚的に作成できるが、構文で作成するしかないので癖がある。
・割当られたポリシーはGroups、Usersからはどのポリシーが当たってるかWebコンソールから見れない。
・将来的にリソース名が変わることもあるのでポリシーのバージョン管理が必要。
・参考