<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Itay Cohai on Medium]]></title>
        <description><![CDATA[Stories by Itay Cohai on Medium]]></description>
        <link>https://medium.com/@captaininfra?source=rss-7cbd9de26dba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*67lEOGAv8a0VGsZG.</url>
            <title>Stories by Itay Cohai on Medium</title>
            <link>https://medium.com/@captaininfra?source=rss-7cbd9de26dba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:39:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@captaininfra/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[S3 Access Logs — Keep an eye on your data]]></title>
            <link>https://captaininfra.medium.com/s3-access-logs-keep-an-eye-on-your-data-e0e501af1065?source=rss-7cbd9de26dba------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0e501af1065</guid>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloudtrail]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[logs]]></category>
            <dc:creator><![CDATA[Itay Cohai]]></dc:creator>
            <pubDate>Mon, 01 Mar 2021 15:25:21 GMT</pubDate>
            <atom:updated>2021-03-02T05:33:57.668Z</atom:updated>
            <content:encoded><![CDATA[<h3>S3 Access Logs — Keep an eye on your data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLA4HRG3R4g4gUtcOEiHqQ.png" /><figcaption>Photo by <a href="https://unsplash.com/@usefulcollective?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Mildly Useful</a> on <a href="https://unsplash.com/s/photos/log?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Security logs are usually the last thing that comes to mind for some cloud engineers/SRE/DevOps when starting to deploy workloads in the cloud.</p><p>Usually, this comes up in a conversation with the security/cyber/compliance department and it goes something like this: <br>Security Person: <em>“We want security/audit logs from the cloud”</em><br>Cloud Engineer: <em>”Which logs?” </em><br>Security Person: “<em>Which ones do you have?”</em><br>Cloud Engineer: “<em>Lots of different log types”</em><br>Security Person: <em>“We’ll take them </em><strong><em>all</em></strong><em>”</em></p><p>Jokes aside — If we’re talking about AWS, the first log type everybody cares about is <a href="https://aws.amazon.com/cloudtrail/">CloudTrail</a> — the second one, and the subject of this post is S3 Access Logs.</p><p>Why do we care about those? — well, S3 buckets usually hold the sensitive business data we want to keep safe. <br>S3 is the service that appeals most to bad actors —and Nobody wants to learn about their data leakage on the New York Times after someone posted it on Github.</p><p><strong>Just get the logs — what’s the problem?</strong></p><p>Well, there are two very different ways to get information about who accessed your S3 bucket data:<br>1. <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html">S3 Access Logs</a><br>2. <a href="https://aws.amazon.com/about-aws/whats-new/2016/11/aws-cloudtrail-supports-s3-data-events/">CloudTrail S3 Data Events</a></p><p>This table shows a high level comparison of both options:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd9c8b68b0b2481ef6d89a9000b18baf/href">https://medium.com/media/fd9c8b68b0b2481ef6d89a9000b18baf/href</a></iframe><p>If you want to dig deeper into this comparison — continue reading the detailed comparison below.</p><p><strong>Cost<br></strong>S3 Access Logs are free, they are grandfathered-in from simpler days vs. CloudTrail S3 Data events which cost 10 cents/100K events.</p><p>It’s not a lot — who cares, right? <strong>WRONG</strong>. <br>Most of us will ship CloudTrail logs to a SIEM, save them there forever, just in case of a security incident. Most of these SIEMs are based on vendor products who charges based on log ingestion by the GB. <br>Or as Corey Quinn says:</p><h3>JavaScript is not available.</h3><p>In the 19th and 20th centuries, monarchies gave way to democracies around the world. This posed a problem for @splunk, as the world rapidly ran out of princesses to kidnap for ransom in order to pay for its services. #reinventnaturewalk pic.twitter.com/8Lmg4UrCb5</p><p>I’m not specifically talking about Splunk (I’m a huge fan of the product) — but they are a fine example.<br>These log events are usually around 2K in size(JSON format), larger in size than the S3 Access Logs events (Apache Log text format), so a chatty application using a bucket or a viral tweet directing your users to your s3 backed website can cost you lots of money if you’re not careful. <br>(Being careful means splitting the CloudTrail Data events trail from the CloudTrail Management events trail and reducing the retention).</p><p><strong>Central Logging Considerations</strong></p><p>Most large, security aware organizations, follow <a href="https://aws.amazon.com/blogs/mt/best-practices-for-organizational-units-with-aws-organizations/">AWS’s Organization structure best practices</a> — on way or another — and have one account in their Org meant for storing the logs from all the other accounts.</p><p>Which brings us to another point for CloudTrail S3 Data events as you can point CloudTrail to put logs originating from any account in your Org to a bucket in the Log Archive account (it can even be in a different region).</p><p>S3 Access Logs, on the other hand, can only be aimed at a local bucket in the same account and region of the bucket the log statements relate to.</p><p><strong>Dependable Logging and Logging Delays</strong></p><p>CloudTrail (including Data events) logging is 100% dependable — messages will not disappear on you and you can count on them showing up in about 15 minutes.</p><p>S3 Access Logs on the other are “Best effort” — not a thing you want to tell your security team when there’s a breach and you can’t find the logs because they take hours showing up or they may never will.</p><p><strong>Config Granularity</strong></p><p>Another important point for CloudTrail here, S3 Data events can be set up once, in an <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-trail-organization.html">Organization Level Trail </a>and this config will cover all new and existing S3 buckets in your AWS Organization (Cool, right?)</p><p>S3 Access Logs, however, can only be configured one at a time in each and every bucket you want to keep an eye on. <br>It’s not a deal breaker if you’re using Infrastructure As Code, but it’s definitely more work.</p><p><strong>Encryption upon delivery</strong></p><p>This one isn’t a huge, IMO, but it’s just an annoyance —<a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html"> CloudTrail supports using a KMS Customer Managed Key (CMK)</a> to encrypt these log files at rest.</p><p>The S3 Access Logs delivery mechanism doesn’t have built in support for encryption, the logs can be encrypted at rest post delivery using the <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingServerSideEncryption.html">S3 SSE mechanism</a>.</p><p><strong>In conclusion</strong></p><p>Keeping an audit trail of access to your S3 buckets is a must nowadays, there is more than one way to achieve it — I personally recommend enabling a new separate org-wide CloudTrail Trail with S3 Data events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0e501af1065" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enforce TLS 1.2 only access to your S3 Bucket]]></title>
            <link>https://captaininfra.medium.com/enforce-tls-1-2-only-access-to-your-s3-bucket-9433d6a912f0?source=rss-7cbd9de26dba------2</link>
            <guid isPermaLink="false">https://medium.com/p/9433d6a912f0</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Itay Cohai]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 19:00:32 GMT</pubDate>
            <atom:updated>2021-02-24T14:25:16.820Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, At AWS reInvent in December 2020, AWS released a feature enabling AWS customers to control the level of in-transit encryption on their S3 buckets. <br>Here is the link to the announcement — <a href="https://aws.amazon.com/about-aws/whats-new/2020/12/new-iam-condition-keys-amazon-s3-limit-requests-buckets-owned-specific-aws-accounts-specific-tls-versions/">https://aws.amazon.com/about-aws/whats-new/2020/12/new-iam-condition-keys-amazon-s3-limit-requests-buckets-owned-specific-aws-accounts-specific-tls-versions/</a> .</p><h3>JavaScript is not available.</h3><p>S3 / IAM Update - New IAM condition keys to limit requests to:1⃣ Buckets owned by specific #AWS accounts (s3:ResourceAccount) 2⃣ Specific TLS versions used by client (s3:TLSVersion)What&#39;s New: https://t.co/SEN8g9cYgn RTFM: https://t.co/po64glN7kU pic.twitter.com/KnYhoxwYoJ</p><p>This feature, along with many other recently released S3 security features, is a game changer in the customers ability to secure their S3 buckets (which we know, get “hacked”/”left open” way too often).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*vLq_lX17GmyU4vAFUv4n1A.png" /></figure><p><strong>Isn’t HTTP/s enough? <br></strong>AWS already had a solution here — a way To verify that access is done to an S3 bucket over HTTP/s (<a href="https://aws.amazon.com/premiumsupport/knowledge-center/s3-bucket-policy-for-config-rule/">aws:secureTransport</a>), but unfortunately there was no way to verify that it was done over a specific version of TLS.<br>This means that access over the deprecated TLS 1.1 or even TLS 1.0 to this bucket would have be allowed, which is bad.</p><p>Example of using aws:secureTransport — not good enough:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1596bc0f2dcfd388e889983ede191d03/href">https://medium.com/media/1596bc0f2dcfd388e889983ede191d03/href</a></iframe><p><strong>TLS 1.2 — I RTFM-ed — Still can’t get it to work</strong></p><p>Unfortunately, even though I scoured the internet, I could find no example (not even one!) on how one would use this feature. <br>The release doc and other minimal docs I <strong>could</strong> find mention the new IAM condition key s3:TlsVersion which could be used to query the version of TLS being used.</p><p>However, the only reference to the potential values this IAM key could have is “string” :-/</p><p>I played with it a bit trying several options like “s3:TlsVersion”: “TLS-1–2” or “s3:TlsVersion”: “TLS-1.2” and “s3:TlsVersion”: “Protocol-TLSv1.2” — but could not get it to work.</p><p>I even went the extra mile and enabled CloudTrail logging with <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">S3 Data Events</a> in my personal account — but obviously — it didn’t show up there, not even in the AdditionaEventData section which shows security related information like the SignatureVersion and the CipherSuite (and yes, I know i can derive the TLS version based on the cipher suite).</p><p>In the end I just tried “1.2” and it magically worked (obviously, I tried other values like 1.1 to make sure it’s working).</p><p>Example of using s3:TlsVersion — woohoo:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/457e5e9f7f98c81ffad38b04bbb5256a/href">https://medium.com/media/457e5e9f7f98c81ffad38b04bbb5256a/href</a></iframe><p><strong>In summary</strong></p><p>Now that there is some usage documentation of this IAM key in the wild — I hope this would be helpful for others.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9433d6a912f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>