Amazon AppStream 2.0 跨服務預防混淆代理人 - Amazon AppStream 2.0

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Amazon AppStream 2.0 跨服務預防混淆代理人

混淆代理人問題屬於安全性議題,其中沒有執行動作許可的實體強制權限更高的實體執行該動作。在 AWS 中,跨服務模擬可能會導致帳戶資源發生混淆代理人問題。在某個服務 (呼叫服務) 呼叫另一個服務 (被呼叫服務) 時,會發生跨服務模擬。呼叫服務可以操縱被呼叫服務來使用其許可,以呼叫服務本身未具備執行許可的方式,對客戶的資源執行動作。為了預防這種情況,AWS 提供的工具可協助您保護所有服務的資料,而這些服務主體可存取您帳戶中的資源。

如需限制存取這些資源時的許可,我們建議在資源政策中使用 aws:SourceArnaws:SourceAccount 全域條件內容鍵。下列準則詳細說明使用這些索引鍵來保護資源時的建議和需求:

  • 如果您只想要允許一個資源與跨服務存取相關聯,則使用 aws:SourceArn

  • 如果您想要允許所指定帳戶中的任何資源與跨服務使用相關聯,則使用 aws:SourceAccount

  • 如果 aws:SourceArn 鍵未包含帳戶 ID,您必須使用這兩個全域條件內容鍵 (aws:SourceArnaws:SourceAccount) 來限制許可。

  • 如果同時使用全域條件內容鍵,且 aws:SourceArn 值包含帳戶 ID,則在相同政策陳述式中使用 aws:SourceAccount 鍵時,必須使用相同的帳戶 ID。

防範混淆代理人問題的最有效方法是精確使用您允許的資源 Amazon Resource Name (ARN) 資源。如果不知道資源的完整 ARN,請使用 aws:SourceArn 全域條件內容鍵搭配萬用字元 (例如 *) 來表示 ARN 的未知部分。若要指定多個資源,您也可以在 ARN 中使用萬用字元。例如,您可以將 ARN 格式化為 arn:aws:servicename::region-name::your AWS 帳戶 ID:*

範例:AppStream 2.0 服務角色跨服務預防混淆代理人

AppStream 2.0 會擔任使用各種資源 ARN 的服務角色,這會產生複雜的條件陳述式。我們建議您使用萬用字元資源類型,以防止任何非預期的 AppStream 2.0 資源失敗。

範例 aws:SourceAccount 條件式:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 帳戶 ID" } } } ] }
範例 aws:SourceArn 條件式:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name}:{your AWS 帳戶 ID}:*" } } } ] }

範例:AppStream 2.0 機群電腦角色跨服務預防混淆代理人

範例 aws:SourceAccount 條件式:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 帳戶 ID" } } } ] }
範例 aws:SourceArn 條件式:
注意

如果您想要針對多個機群使用一個 IAM 角色,建議您使用 aws:SourceArn 全域內容條件索引鍵搭配萬用字元 (*) 來比對多個 AppStream 2.0 機群資源。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name}:{your AWS 帳戶 ID}:fleet/{your fleet name}" } } } ] }

範例:AppStream 2.0 彈性機群工作階段指令碼 Amazon S3 儲存貯體政策跨服務預防混淆代理人

範例 aws:SourceAccount 條件式:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "s3:GetObject", "Resource": "your session script S3 path", "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 帳戶 ID" } } } ] }
範例 aws:SourceArn 條件式:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "s3:GetObject", "Resource": "your session script S3 path", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name}:{your AWS 帳戶 ID}:fleet/{your fleet name}" } } } ] }

範例:AppStream 2.0 應用程式 Amazon S3 儲存貯體政策跨服務預防混淆代理人

當您將資料存放在 Amazon S3 儲存貯體中時,儲存貯體可能會遭遇混淆代理人問題。這可能會使彈性機群、應用程式區塊、安裝指令碼、應用程式圖示及工作階段指令碼等資料容易受到惡意人士攻擊。

為了預防混淆代理人問題,您可以在 Amazon S3 儲存貯體政策中針對 ELASTIC-FLEET-EXAMPLE-BUCKET 指定 aws:SourceAccount 條件或 aws:SourceArn 條件。

以下資源政策說明如何透過下列任一種方式預防混淆代理人問題:

  • 使用您的 AWS 帳戶 ID 的 aws:SourceAccount

  • 全域條件內容鍵 aws:SourceArn

AppStream 2.0 目前不支援應用程式圖示的預防混淆代理人。服務僅支援 VHD 檔案和安裝指令碼。如果您嘗試為應用程式圖示新增其他條件,圖示將不會對使用者顯示。

在下列範例中,儲存貯體政策只允許擁有者帳戶中的 AppStream 2.0 彈性機群資源存取 ELASTIC_FLEET_EXAMPLE_BUCKET

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/scripts/*" ], "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 帳戶 ID" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/app-icons/*" } ] }

您也可以使用 aws:SourceArn 條件來限制特定資源的資源存取權。

注意

如果不知道資源的完整 ARN,或者您想要指定多個資源,請使用 aws:SourceArn 全域條件內容鍵搭配萬用字元 (*) 來表示 ARN 的未知部分。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/scripts/*" ], "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws-partition}:appstream:{your region name}:{your AWS account ID}:app-block/*" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/app-icons/*" } ] }

您也可以使用 aws:SourceArnaws:SourceAccount 條件來限制特定資源和帳戶的資源存取權。

注意

如果不知道資源的完整 ARN,或者您想要指定多個資源,請使用 aws:SourceArn 全域條件內容鍵搭配萬用字元 (*) 來表示 ARN 的未知部分。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/scripts/*" ], "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name}:{your AWS account ID}:app-block/*" }, "StringEquals": { "aws:SourceAccount": "your AWS account ID" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET/app-icons/*" } ] }