S3 bucket replication conflicting with rule that enforces tls 1.2 on a bucket

0

I've set up replication as per the instructions at this link ( with a batch process to copy existing objects )

https://aws.amazon.com/getting-started/hands-on/replicate-existing-objects-with-amazon-s3-batch-replication/?ref=docs_gateway/amazons3/s3-batch-replication-batch.html

But have found that the following tls1.2 enforcement rule stops the batch configuration role that I have set up from having access to the s3:PutInventoryConfiguration permission which causes the process to fail. Can anyone explain why this might be? I'd like to retain the tls1.2 rule for the time being so we can root out any non compliant access.

  {
        "Sid": "EnforceTLSv12orHigher",
        "Effect": "Deny",
        "Principal": {
            "AWS": "*"
        },
        "Action": "s3:*",
        "Resource": [
            "arn:aws:s3:::<bucketname>/*"
            "arn:aws:s3:::<bucketname>"
        ],
        "Condition": {
            "Bool": {
                "aws:SecureTransport": "true"
            },
            "NumericLessThan": {
                "s3:TlsVersion": "1.2"
            }
        }
    }
2 Answers
1

Hi,

There are two corrections required in your bucket policy:

  1. 1.2 should not be enclosed in double quotes.
  2. There would be a comma in resource section

Your bucket policy should look like as below:

{
        "Sid": "EnforceTLSv12orHigher",
        "Effect": "Deny",
        "Principal": {
            "AWS": "*"
        },
        "Action": "s3:*",
        "Resource": [
            "arn:aws:s3:::<bucketname>/*",
            "arn:aws:s3:::<bucketname>"
        ],
        "Condition": {
            "Bool": {
                "aws:SecureTransport": "true"
            },
            "NumericLessThan": {
                "s3:TlsVersion": 1.2
            }
        }
    }

Just FYI, this policy would allow http connection and deny https connection where TLS version is lesser than 1.2. I believe you understand that.

Hope you find this information helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
EXPERT
answered 9 months ago
profile picture
EXPERT
reviewed 9 months ago
  • Do you have any additional questions, happy to help.

  • Thanks - I have tried making the changes in the console for the bucket in question, but on saving the changes the double quotes get re-instated automatically (unfortunately the missing comma was an error in translation when I replaced the original <bucketname> when creating my post. Additionally, with this part of my policy in place, the batch process for replicating existing objects fails with the following error ( but succeeds when I remove the EnforceTLSv12orHigher rule )

    "Error occurred when preparing manifest: Access denied when accessing arn:aws:s3:::<bucketname>. s3:PutInventoryConfiguration required for the role."

  • Let me test this.

  • I verified this through Curl and was able to test this policy with success, where I downloaded file successfully using tls1.2 but failed when used tls1.0. I'm trying to find some documentation to confirm which TLS version is being used under the hood. I know this that AWS CLI uses latest version of tls by default, which is why I haven't tried PutInventoryConfiguration through CLI but I'll try that as well here.

-1

Hello,

The only error I see in your Bucketpolicy is a missing semicolon between the two resources.

"arn:aws:s3:::<bucketname>/*",
"arn:aws:s3:::<bucketname>"

Also your bucketpolicy is currently allowing http. because it only denies https traffic lower than tls 1.2

Check the errormessage:

Easiest: Check if cloudtrail logged the api call for s3:PutInventoryConfiguration by default (management events). If not you prob. have to create a cloudtrail trail and enable DataEvent Logging. Not sure if it is a managementevent or cloudtrail event.

Moderate: You can try to customize the role used for creating the inventory to allow you to assume it and then try the process manually to get the errormessage either via cli oder console.

Sincerely Heiko

profile picture
HeikoMR
answered 9 months ago
  • Thank you - as I mentioned above with the TLS rule in place the batch process for replicating existing objects fails with the following error "Error occurred when preparing manifest: Access denied when accessing arn:aws:s3:::<bucketname>. s3:PutInventoryConfiguration required for the role."

    The batch process has an associated role which explicitly allows the PutInventoryConfiguration action on the source bucket. Every thing works fine until I re-instate the rule to restrict tls >= 1.2 for https.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions