Creé una política de depósito para tratar de detener los enlaces directos a mis archivos S3 de personas que obtienen la URL directa. Solo quiero que mi sitio web pueda acceder a esos archivos. Sin embargo, cuando dirijo un enlace incluso con la siguiente política, todavía permite el acceso al archivo. Todos los archivos están configurados como públicos.
{ "Id": "Policy1491040992219", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt14910401236760", "Action": [ "s3:GetObject" ], "Effect": "Allow", "Resource": "arn:aws:s3:::bucketname/*", "Condition": { "StringLike": { "aws:Referer": "https://mywebsite.com/*" } }, "Principal": "*" }, { "Sid": "Stmt14910403436760", "Action": [ "s3:GetObject" ], "Effect": "Allow", "Resource": "arn:aws:s3:::bucketname/*", "Condition": { "StringLike": { "aws:Referer": "http://localhost:8888/*" } }, "Principal": "*" } ] }
¿Necesito cambiar alguna configuración en la configuración real del depósito S3 para detener todo acceso?
¡Gracias!
Le falta la instrucción Deny . Pruebe esta política:
{ "Version": "2008-10-17", "Id": "Policy1491040992219", "Statement": [ { "Sid": "Stmt14910401236760", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::bucketname/*", "Condition": { "StringLike": { "aws:Referer": [ "https://mywebsite.com/*", "http://localhost:8888/*" ] } } }, { "Sid": "Stmt14910401236761", "Effect": "Deny", "Principal": { "AWS": "*" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::bucketname/*", "Condition": { "StringNotLike": { "aws:Referer": [ "https://mywebsite.com/*", "http://localhost:8888/*" ] } } } ] }