How do I set the S3 bucket policy so that it can only be accessed by the specified IP

admin 2024年8月14日14:37:51评论11 views字数 783阅读2分36秒阅读模式

0x00 TL;DR

This document records how to set up the S3 bucket policy so that it can only be accessed by the specified IP.Set the bucket policy to deny the operation except for the specified IP.

0x01 Policy

123456789101112131415161718192021
{  "Version": "2012-10-17",  "Id": "S3PolicyId1",  "Statement": [    {      "Sid": "IPAllow",      "Effect": "Deny",      "Principal": "*",      "Action": "s3:*",      "Resource": [        "arn:aws-cn:s3:::testtonghua/*",        "arn:aws-cn:s3:::testtonghua"      ],      "Condition": {        "NotIpAddress": {          "aws:SourceIp": "54.222.177.177/32"        }      }    }  ]}

If you use this policy, you can access the S3 bucket only if the IP is 54.222.177.177.

Note: Please confirm that the specified IP is a static IP,If you use dynamic IP, there is a risk that the S3 bucket will not be accessible when the IP is changed.if unfortunately, you need to contact the AWS Support revocation policy.

0x02 Reference

- source:tonghuaroot.com

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年8月14日14:37:51
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   How do I set the S3 bucket policy so that it can only be accessed by the specified IPhttps://cn-sec.com/archives/3067262.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息