<?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 Zeynep Basboga on Medium]]></title>
        <description><![CDATA[Stories by Zeynep Basboga on Medium]]></description>
        <link>https://medium.com/@ks.zynep?source=rss-a9435fe8fa7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dmfMa6eTSbGDki7o</url>
            <title>Stories by Zeynep Basboga on Medium</title>
            <link>https://medium.com/@ks.zynep?source=rss-a9435fe8fa7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:57:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ks.zynep/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[️‍♀️ Logzey: Detecting Suspicious Login Attempts with AWS and Docker]]></title>
            <link>https://medium.com/@ks.zynep/%EF%B8%8F-%EF%B8%8F-logzey-detecting-suspicious-login-attempts-with-aws-and-docker-a058cf9e188c?source=rss-a9435fe8fa7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a058cf9e188c</guid>
            <dc:creator><![CDATA[Zeynep Basboga]]></dc:creator>
            <pubDate>Tue, 29 Jul 2025 09:42:07 GMT</pubDate>
            <atom:updated>2025-07-29T09:42:07.678Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>Imagine you’re managing a server and want to know if someone is trying to guess passwords to break in — repeatedly, quickly, and quietly. What if you had a simple tool that could spot this behavior and even tell you where it’s coming from?</p><p>That’s where <strong>Logzey</strong> comes in.</p><p>Logzey is a lightweight Python-based tool that:</p><ul><li>Detects suspicious login attempts</li><li>Sends email alerts for brute-force-like behavior</li><li>Can be deployed as a <strong>serverless Lambda function</strong></li><li>Is <strong>Docker-compatible</strong> for local testing</li><li>Optionally adds <strong>GeoIP</strong> location information to suspicious IPs🌍</li></ul><p>This post walks you through the entire journey — from simple Python logic to a deployable AWS infrastructure with Terraform.</p><h3>2. Problem Definition</h3><p>Brute-force login attacks are common. Attackers try different passwords in quick succession to gain access to systems. The core problem is this:</p><blockquote>“If an IP address makes 5 failed login attempts within 1 minute, we should treat it as suspicious.”</blockquote><p>It’s a basic but powerful rule. While enterprise-grade security systems already do this, I wanted to build my own version — something I could understand, test, and deploy myself.</p><p>The logs we work with look like this in JSON:</p><pre>json<br><br>[<br>  {<br>    &quot;ip&quot;: &quot;192.168.1.101&quot;,<br>    &quot;status&quot;: &quot;failed&quot;,<br>    &quot;timestamp&quot;: &quot;2025-06-12T13:50:00&quot;<br>  },<br>  ...<br>]</pre><h3>3. The Python Logic</h3><p>The core of the system is a Python script that:</p><ol><li>Reads a list of logs in JSON format.</li><li>Filters out the ones with &quot;status&quot;: &quot;failed&quot;.</li><li>Groups logs by IP address.</li><li>Checks if an IP has more than 5 failed attempts in 1 minute.</li><li>Optionally adds GeoIP location data.</li><li>Returns a list of suspicious IPs.</li></ol><p>A simplified version of the analysis logic looks like this:</p><pre>python<br><br>def analyze_logs(logs):<br>    failed_logins = {}<br>    for entry in logs:<br>        if entry.get(&quot;status&quot;) == &quot;failed&quot;:<br>            ip = entry.get(&quot;ip&quot;)<br>            timestamp = datetime.fromisoformat(entry.get(&quot;timestamp&quot;))<br>            failed_logins.setdefault(ip, []).append(timestamp)<br><br>suspicious_ips = []<br>    for ip, times in failed_logins.items():<br>        times.sort()<br>        for i in range(len(times)):<br>            window = times[i:i + 5]<br>            if len(window) == 5 and (window[-1] - window[0]) &lt;= timedelta(minutes=1):<br>                suspicious_ips.append(ip)<br>                break<br>    return suspicious_ips</pre><p>Then, I wrote a handler.py file to expose this as an AWS Lambda function, and a local_runner.py to test it outside AWS using Docker. I added an optional <strong>GeoIP lookup</strong> so we can tell where the suspicious traffic is coming from — using a free external API.</p><h3>4. Packaging the App with Docker</h3><p>To make sure I could run the project locally without needing AWS all the time, I used <strong>Docker</strong> to containerize it.</p><p>My Dockerfile looked like this:</p><pre>Dockerfile<br><br>FROM python:3.12-slim<br>WORKDIR /app<br>COPY app/requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br>COPY app/ .<br>CMD [&quot;python&quot;, &quot;local_runner.py&quot;]</pre><p>And I used this command to test locally:</p><pre>bash<br><br>docker run --rm -v &quot;$(pwd)/test_data:/app&quot; logzey-local</pre><p>This allowed me to simulate log files, run the detection, and debug comfortably.</p><h3>5. Deploying with Terraform on AWS</h3><p>Once I was happy with the logic, I moved on to deploying it on AWS using Terraform. Here’s what I created:</p><ul><li><strong>AWS Lambda</strong> to run the Python function.</li><li><strong>API Gateway</strong> to expose it via HTTP POST.</li><li><strong>SNS (Simple Notification Service)</strong> to send email alerts.</li><li><strong>IAM roles and policies</strong> to connect them securely.</li></ul><p><strong>Trigger:</strong> When you POST logs to /logs, the Lambda runs, analyzes them, and — if needed — sends an email.</p><p><strong>Terraform setup includes:</strong></p><ul><li>main.tf: All AWS resources</li><li>variables.tf: Email and config options</li><li>outputs.tf: Shows API endpoint</li></ul><p><strong>Sample request:</strong></p><pre>bash<br><br>curl -X POST &quot;https://your-api-id.execute-api.us-east-1.amazonaws.com/logs&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  --data-binary @wrapped_logs.json</pre><p>You’ll receive an alert if suspicious IPs are found!</p><h3>6. Real-World Testing: Working with auth.log</h3><p>On Linux systems, failed SSH logins appear in /var/log/auth.log. I wrote a Python script that:</p><ol><li>Reads the raw auth.log file</li><li>Extracts failed login attempts</li><li>Converts them to the correct JSON format</li></ol><p>This is helpful for testing with <strong>real data</strong> instead of just simulations.</p><h3>7. What I Learned</h3><p>This project taught me so much:</p><p>✅ How to write AWS Lambda-compatible Python<br> ✅ How to containerize a project for testing<br> ✅ How to structure infrastructure-as-code with Terraform<br> ✅ How to parse and transform real log files<br> ✅ How to enrich data with GeoIP<br> ✅ How to integrate alerts via SNS</p><p>And — more importantly — how to keep things simple and explainable.</p><h3>8. What’s Next?</h3><p>Here are some improvements I’m thinking about:</p><ul><li>Use <strong>S3 buckets</strong> to upload and store logs</li><li>Save detection results in <strong>DynamoDB</strong></li><li>Add a <strong>Slack bot</strong> for alerting</li><li>Build a small <strong>web dashboard</strong></li><li>Visualize attack heatmaps by region 🌍</li></ul><p>If you have ideas, I’d love to hear them!</p><h3>🎁 Bonus: Try It Yourself!</h3><p>You can try Logzey right now:</p><h3>🔧 For local testing (Docker):</h3><pre>bash<br><br>docker run --rm -v &quot;$(pwd)/test_data:/app&quot; logzey-local</pre><h3>☁️ For AWS (Terraform):</h3><pre>bash<br><br>terraform init<br>terraform apply</pre><p>Then use curl to send logs and get alerts.</p><h3>💬 Final Words</h3><p>Thanks for reading this far!<br> Logzey started as a learning exercise and grew into a real, deployable tool. :)</p><p>If you’re someone who’s curious about security, DevOps, or AWS, I hope this project gives you a fun way to get hands-on.</p><p>Let me know what you think — I’d love your feedback and ideas!</p><p>Cheers,<br> <strong>Zeynep</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a058cf9e188c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Next.js + Cloudflare + Missing robots.txt = 400K Visits in 2 Weeks!]]></title>
            <link>https://medium.com/@ks.zynep/next-js-cloudflare-missing-robots-txt-400k-visits-in-2-weeks-54415d857345?source=rss-a9435fe8fa7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/54415d857345</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Zeynep Basboga]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 19:39:42 GMT</pubDate>
            <atom:updated>2025-07-22T19:39:42.203Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days ago, my brother reached out to me in a bit of confusion. He had built a site using <strong>Next.js</strong> — <a href="https://erdkse.com/"><strong>erdkse.com</strong></a> — and was seeing <strong>400,000+ visits in just two weeks</strong> via Cloudflare.</p><p>That’s a huge number for a small, new site.</p><p>Naturally, he assumed the site was under some kind of attack and asked me to take a look.</p><p>When I checked the logs, I noticed the site was receiving <strong>dozens of requests per second</strong>, yet Google Analytics showed almost <strong>no real visitors</strong>.</p><p>My first thought?</p><blockquote><strong><em>“Is this a botnet? Are we being DDoSed?”</em></strong></blockquote><p>But as I dug deeper, the real cause was quite unexpected…</p><h3><strong>🔍 Suspicious Traffic Patterns</strong></h3><p>Looking at the Cloudflare logs, I noticed:</p><ul><li>Repeated <strong>GET</strong> requests from the same several IPs,</li><li>The <strong>User-Agent strings</strong> mimicking modern browsers, like:</li></ul><blockquote>http</blockquote><blockquote>Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.7151.103 Mobile Safari/537.36</blockquote><p>Or even pretending to be Google:</p><blockquote>http</blockquote><blockquote>User-Agent: Mozilla/5.0 (…) (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</blockquote><p>I ran reverse DNS lookups and confirmed:</p><p>✅ These IPs really <strong>were owned by Google</strong>.</p><p>But still — <strong>80% of total traffic coming from Googlebot</strong>?</p><p>And worse: it was crawling paths like:</p><ul><li>/projects</li><li>/projects/details/*</li><li>And other dynamic routes it <strong>wasn’t supposed to care about</strong></li></ul><p>That made no sense.</p><p>Then I had a lightbulb moment 💡:</p><blockquote><strong><em>“What if Googlebot is just… lost?”</em></strong></blockquote><h3><strong>🧩 The Real Problem: Missing Crawl Instructions</strong></h3><p>I manually visited the following URLs:</p><ul><li><a href="https://erdkse.com/robots.txt">https://erdkse.com/robots.txt</a></li><li><a href="https://erdkse.com/sitemap.xml">https://erdkse.com/sitemap.xml</a></li></ul><p>And I got this lovely response:</p><blockquote>json</blockquote><blockquote>{</blockquote><blockquote>“message”: “Server failed to respond”,</blockquote><blockquote>“details”: {}</blockquote><blockquote>}</blockquote><p>Yep.</p><ul><li>robots.txt → Missing</li><li>sitemap.xml → Missing</li></ul><p>That meant:</p><ul><li>Google had <strong>no idea what to crawl or avoid</strong></li><li>No site structure to prioritize its crawling behavior</li></ul><p>So what did Googlebot do?</p><blockquote><strong>It went rogue</strong><em> — scanning everything it could find in the wild.</em></blockquote><p>And that’s how we ended up with <strong>400K+ visits in two weeks</strong>, mostly from confused (but well-intentioned) crawlers.</p><h3><strong>🛠️ How We Solved It</strong></h3><p>As a security engineer, I analyzed the traffic and identified the root cause.</p><p>But credit where credit is due:<br> <strong>My brother implemented the actual solution</strong> 👇</p><p>Check out the full implementation here:<br> 🔗 <a href="https://erdkse.com/blog/unexpected-traffic-increase-cloudflare"><strong>https://erdkse.com/blog/unexpected-traffic-increase-cloudflare</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*3UxXppviPQ1jhV-LyfhAmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*ioZSt8WRrd6chSpVhuTASg.png" /></figure><h3><strong>🛡️ Key Lessons (From a Security Perspective)</strong></h3><ol><li><strong>Not all traffic spikes are attacks</strong></li></ol><p>Sometimes it’s just a confused crawler. Or worse — <strong>your own misconfiguration</strong>.</p><blockquote><em>Don’t panic. Analyze first. React smart.</em></blockquote><p><strong>2. robots.txt and sitemap.xml are not just SEO</strong></p><p>They’re also:</p><ul><li>Traffic controllers</li><li>Bandwidth savers</li><li>Even mini firewalls for bots</li></ul><blockquote>Missing them = chaos.</blockquote><p><strong>3. Trust, but verify: not all “Googlebots” are real</strong></p><p>✅ Use reverse + forward DNS lookups<br>✅ Leverage Cloudflare’s cf.client.bot field<br>✅ Be suspicious of weird Chrome versions in User-Agents</p><p><strong>4. Dev + Security = The Perfect Duo</strong></p><p>I saw the pattern. My brother fixed the code.<br> Teamwork = 🚀</p><h3><strong>🎯 Final Thoughts</strong></h3><p>If your site suddenly sees a surge in traffic, don’t automatically assume it’s an attack.</p><p>Sometimes, it’s just <strong>Google trying to help</strong> — without knowing how.</p><p>And in <strong>Next.js projects</strong>, don’t underestimate the importance of:</p><ul><li>✅ A proper robots.txt</li><li>✅ A clear sitemap.xml</li></ul><blockquote><em>These small files can </em><strong><em>save you from massive bot overload</em></strong><em>.</em></blockquote><p><strong>👀 TL;DR</strong></p><p>Getting strange traffic?<br>Before you block everything …</p><p>✅ Check your <em>robots.txt.</em><br>✅ Serve a clean <em>sitemap.xml.</em><br>✅ And always verify your bots.</p><blockquote>These small files can <strong>save you from massive bot overload</strong>, especially if you have deep dynamic sections like /projects.</blockquote><h3>💬 Enjoyed this post?</h3><p>Follow me for more <strong>real-world security insights</strong> — from a dev-friendly perspective.</p><p>Have you ever thought your site was under attack but it turned out to be something else?<br><em> </em><strong><em>I’d love to hear your story in the comments below.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ypb_CHIViNQfznJmvMmyjg.png" /></figure><p>#WebDevelopment #Nextjs #CyberSecurity #Cloudflare #SEO</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54415d857345" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>