<?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 Romario Bennett on Medium]]></title>
        <description><![CDATA[Stories by Romario Bennett on Medium]]></description>
        <link>https://medium.com/@romario_bennett?source=rss-fc2ed00e9a50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H5p1OzUOxxarGrXgoltKZg.png</url>
            <title>Stories by Romario Bennett on Medium</title>
            <link>https://medium.com/@romario_bennett?source=rss-fc2ed00e9a50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:38:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@romario_bennett/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[Building My Own Vulnerability Scanner]]></title>
            <link>https://medium.com/@romario_bennett/i-got-tired-of-running-15-different-nmap-commands-so-i-built-my-own-vulnerability-scanner-ca3c21052e53?source=rss-fc2ed00e9a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca3c21052e53</guid>
            <category><![CDATA[nmap]]></category>
            <category><![CDATA[vulnerability-scanning]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <dc:creator><![CDATA[Romario Bennett]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 17:40:41 GMT</pubDate>
            <atom:updated>2026-06-05T16:58:49.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Qaq8lE94sWjqAqq2JA2puQ.png" /></figure><p><em>How I automated internal network vulnerability scanning when the commercial tools were out of budget</em></p><p>There’s a particular kind of frustration that comes from doing the same manual task for the fourth time in a week.</p><p>For me, it was vulnerability scanning. Every time I needed to assess a subnet , whether it was a routine check, a vulnerability scan every now and then or following up on something suspicious, I’d open my notes, copy a series of nmap commands, run them one by one, wait, collect the XML outputs, manually correlate the results, and then try to make sense of it all in a spreadsheet. Every. Single. Time.</p><p>The commercial alternatives were either locked behind enterprise licensing I couldn’t justify for internal use, required a full Linux VM stack with dedicated hardware, or were so heavyweight they needed their own team to operate. OpenVAS is excellent but it’s not something you spin up on a Tuesday afternoon. Nessus is great until you see the price tag for a license that actually covers your subnet range.</p><p>So I did what any self-respecting security engineer does when tooling doesn’t exist in the budget: I built it myself.</p><p>This article is not a full code walkthrough and I won’t be publishing the application in its entirety here. What I want to do is explain the design decisions, the technical concepts behind each component, and why I chose to do things the way I did. If you work in security or network engineering, you’ll recognise most of these moving parts.</p><h3>The Problem With Manual Nmap Scanning</h3><p>Before I get into the build, it’s worth explaining why a bunch of nmap commands isn’t a sustainable approach for internal assessments.</p><p>The biggest issue is that nmap commands don’t compose. When you run a ping sweep and then a port scan, you’re running two separate processes that don’t know about each other. There’s no automatic handoff, you manually take the output of one and feed it into the next. On a /24 with 35 live hosts that’s manageable. On 10 subnets with a few hundred hosts, it becomes a full-time job.</p><p>The second issue is consistency. Different engineers on the same team will run slightly different flags depending on what they remember or what their notes say. One person adds --script vuln, another forgets -sV. The results aren&#39;t comparable and the coverage isn&#39;t uniform.</p><p>The third issue is that nmap on its own doesn’t give you a report. You get XML or text output per scan. Taking that output and turning it into something you can show a security manager or use to track remediation over time requires another round of manual work.</p><h3>The Architecture: A Five-Phase Pipeline</h3><p>The core idea behind the tool is that scanning should be sequential and each phase should inform the next. This is how a good manual pentest works because you don’t run a vulnerability scan against hosts you haven’t confirmed exist. You don’t run SSL checks against hosts that don’t have port 443 open.</p><pre>Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5<br>Discover   Port       Targeted   Vuln       HTML<br>live hosts  map        checks     detection  report</pre><p>Each phase saves its output to disk before the next one starts. This means if anything fails or gets interrupted at Phase 3, you can resume from there without re-running a two-hour port scan.</p><h3>Phase 1: Host Discovery</h3><p>The first thing the scanner does is figure out what’s actually alive. This sounds simple but there’s a reason to be deliberate about it.</p><p>A naive approach is to just run your port scan across the entire /24. Nmap will figure out what’s alive during the scan. The problem is that this is slower, less accurate, and it means your port scanner is wasting time on dead IP addresses. On a network with 254 possible addresses per subnet and only 35 live hosts, that’s a lot of wasted effort.</p><p>Instead, Phase 1 runs a dedicated discovery sweep using multiple probe types:</p><pre>-PE    # ICMP echo request (standard ping)<br>-PP    # ICMP timestamp request (often bypasses simple firewalls)<br>-PS21,22,80,443,445,3389,8080,8443   # TCP SYN to common ports</pre><p>The reason for multiple probe types is that some hosts block ICMP but respond to TCP. A printer might not respond to ping but will respond to a SYN on port 80. A Windows machine with host-based firewall might block ICMP entirely but respond on 3389. Using all three probe types gives you a much more complete picture of what’s actually reachable.</p><p>The result is a clean list of live IPs that every subsequent phase uses as its target list.</p><h3>Phase 2: The Three-Pass Port Scan</h3><p>This is the part I spent the most time optimizing, because it’s where the old approach fell apart.</p><p>The obvious approach is nmap -p 1-65535 against every live host which works but it&#39;s brutally slow. In testing, a 35-host subnet with a full port range took 78 minutes at T3. That&#39;s before you&#39;ve run a single vulnerability check.</p><p>The solution was a three-pass strategy.</p><p><strong>Pass A : Top-1000 TCP sweep on all hosts</strong></p><p>The first pass runs nmap’s top-1000 port list against every live host in batches of 10. This is fast , typically 3–5 minutes per subnet and tells you which hosts have anything interesting open.</p><pre>args = [<br>    &quot;-sS&quot;, f&quot;-{timing}&quot;,<br>    &quot;--top-ports&quot;, &quot;1000&quot;,<br>    &quot;--max-retries&quot;, &quot;2&quot;,<br>    &quot;--host-timeout&quot;, &quot;60s&quot;,<br>    &quot;--open&quot;,<br>    &quot;-iL&quot;, str(hosts_file),<br>    &quot;-oX&quot;, xml_out + &quot;.xml&quot;,<br>]</pre><p>The --open flag is worth calling out specifically. By default nmap reports open, closed, and filtered ports. For a vulnerability assessment, closed ports are noise. Adding --open cuts the output down to only what matters and significantly reduces XML parse time downstream.</p><p>--max-retries 2 instead of the default 10 is the single biggest speed improvement. On a LAN where packet loss is minimal, retrying a port 10 times wastes time you don&#39;t get back.</p><p><strong>Pass B : Full port scan on “interesting” hosts only</strong></p><p>Pass A identifies which hosts have ports from a predefined “interesting” set open , things like 22, 80, 443, 445, 3389, 5900, 8080, 5985. Only those hosts get the full 1–65535 TCP scan.</p><p>This is the important insight: most hosts on an internal network are workstations or printers. They’ll have a handful of standard ports open and nothing unusual. Running a full port scan on them is wasted time. The servers and infrastructure devices ,the ones with non-standard ports that might be running unexpected services are the ones that warrant a full sweep.</p><p>In practice on a typical corporate subnet, Pass B runs against maybe 40–50% of live hosts. That cuts the full-range scan time roughly in half.</p><p><strong>Pass C : Targeted UDP</strong></p><p>UDP scanning is slow because there’s no handshake. Every closed port waits for a timeout. The original tool tried to scan 200 UDP ports against every host, which accounted for a significant chunk of overall scan time.</p><p>The fix was to limit UDP to 14 ports that actually matter for internal network security: DNS (53), DHCP (67/68), NTP (123), NetBIOS (137/138), SNMP (161), IKE (500), and a handful of others. These are the UDP services that regularly show up as findings in internal assessments. The other 186 ports that were being scanned were adding noise with very little signal.</p><p><strong>Service version detection : after the sweep, not during</strong></p><p>The original approach ran -sV during the port scan. This means nmap is doing service probing on every port it tries, including ports that turn out to be closed.</p><p>The optimized approach separates the concerns. First you find what’s open, then you run service detection only against the ports that are actually open. On a host with 8 open ports out of 65,535 tried, this is dramatically more efficient.</p><h3>Phase 3: Targeted Protocol Checks</h3><p>Once you have a port map, you can run targeted checks against specific services. The key design principle here is that every targeted check only runs against hosts that actually have the relevant port open.</p><p>SSL/TLS checks don’t run against hosts without SSL ports. SMB checks don’t run against hosts without port 445. This sounds obvious, but it’s something a naive automation would get wrong resulting in a flood of nmap “host seems down” messages and wasted scan time.</p><p>The checks in this phase cover:</p><p><strong>SSL/TLS deep analysis: </strong>This goes well beyond just confirming a certificate exists. The scanner checks expiry date and calculates days remaining (expired = Critical, less than 30 days = High, less than 90 days = Medium), signature algorithm (SHA1 and MD5 are High severity findings), RSA key length (under 2048-bit is Medium, under 1024-bit is High), and known protocol vulnerabilities including Heartbleed, POODLE, and CCS Injection.</p><p>Certificate management is consistently undervalued in internal security assessments. Expired internal certificates break services, but weakly-signed or short-keyed certificates represent actual cryptographic exposure. I’ve found SHA1-signed certificates on internal services that were simply never updated after the 2017 deprecation.</p><p><strong>SMB enumeration</strong> : This runs the full suite of SMB vulnerability scripts including MS17–010 (EternalBlue). EternalBlue is from 2017 but it still shows up in internal assessments on unpatched machines and isolated segments. The scanner also checks SMB signing status (disabled SMB signing enables relay attacks) and enumerates shares and users where possible.</p><p><strong>ADCS enumeration</strong> : This was the addition I was most interested in building. Active Directory Certificate Services is one of the most consistently misconfigured components in Windows environments, and it’s been getting significant attention in the security community since the ESC vulnerabilities were documented.</p><p>The scanner checks for exposed CA Web Enrollment pages (/certsrv), which is the ESC8 candidate , if NTLM authentication is presented over HTTP on a certificate enrollment endpoint, an attacker with network access can relay those credentials to obtain a certificate for any user including domain admins. It also checks for NDES/SCEP endpoints (ESC6-type attacks) and flags port 9389 (AD Web Services) which exposes the Active Directory PowerShell module interface remotely.</p><pre>_ESC8_PATTERN = re.compile(<br>    r&quot;WWW-Authenticate.*NTLM|NTLM.*authentication|401.*NTLM&quot;,<br>    re.IGNORECASE<br>)</pre><p>This regex runs against HTTP response headers. If you see WWW-Authenticate: NTLM coming back from port 80 or 443 on a CA server, you have a potential ESC8 condition worth investigating further.</p><p><strong>Default credentials</strong> : The scanner runs nmap’s http-default-accounts script against HTTP ports and additionally fingerprints devices by their HTTP title and server header. The fingerprinting covers 24 device types, such as printer vendors, IPMI/iDRAC/iLO management interfaces, Cisco and Fortinet gear, NAS devices, and common web applications like Tomcat, Jenkins, and Zabbix.</p><p>When a device is fingerprinted, the report includes the known default credentials for that device type as a reference. If nmap’s http-default-accounts script actually confirms a valid login, that&#39;s escalated to Critical. Fingerprint-only is High ,it means the device is there and has a login page, the credentials still need manual verification.</p><h3>Phase 4: Vulnerability Detection</h3><p>Phase 4 has two components that run separately.</p><p><strong>Nmap vuln scripts</strong> run --script vuln,exploit against the union of all open ports across all live hosts. The port spec is built dynamically from the Phase 2 results so nmap is only probing ports that are known to be open. This avoids the situation where the vul scan is trying to run web application scripts against a port that turned out to be a database.</p><p>The nmap vuln category covers a meaningful number of CVEs for older protocols and services. It’s not comprehensive but it’s reliable and adds no additional tooling dependency.</p><p><strong>Nuclei</strong> is the optional but significantly more powerful component. Where nmap’s vuln scripts are a relatively static library, Nuclei’s template database is community-maintained and updated continuously covering 2023, 2024, and 2025 CVEs that nmap simply doesn’t know about.</p><p>The integration required solving a non-obvious problem: Nuclei doesn’t scan raw IP addresses. It scans URLs and service endpoints. Before passing anything to Nuclei, the scanner builds a proper URL list from the Phase 2 port results:</p><pre>if port in HTTPS_PORTS:<br>    url = f&quot;https://{ip}:{port}&quot;<br>elif port in HTTP_PORTS:<br>    url = f&quot;http://{ip}:{port}&quot;<br>elif include_network and port in NETWORK_PORTS:<br>    url = f&quot;{ip}:{port}&quot;   # for Redis, MongoDB, etc.</pre><p>The HTTPS_PORTS and HTTP_PORTS sets handle the common cases. For ports not in either set, the service name from nmap&#39;s version detection is used to guess the protocol. This means Nuclei gets https://10.1.5.23:8443 instead of 10.1.5.23 which is what it needs to actually run web application templates correctly.</p><p>The -etags intrusive flag is always applied. This excludes templates that could cause service disruption or account lockouts. On a production network, you do not want to run templates that attempt to trigger actual exploits or hammer login endpoints. The non-intrusive templates still cover an enormous range of findings.</p><h3>Phase 5: The Report</h3><p>The entire output is a single self-contained HTML file. No server, no database, no dependencies just open it in a browser.</p><p>The report structure mirrors how I actually think about findings during an assessment:</p><ul><li>Summary bar at the top showing finding counts by severity across the whole scan</li><li>Per-host cards that show IP, hostname, OS, and severity badges at a glance</li><li>Each host expands to four tabs: Ports, Targeted Checks, Vulnerabilities, and Pentest</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhpBiS2I6iA7__bg67r3qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rGbjjCoBuK8wRMVcHYOlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndBoU1R-hwVMNC52SVUSdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-JTBMBLON4r3gbY02a0ng.png" /></figure><p>The Pentest tab is where the TLS, ADCS, and default credential findings live, separate from the generic vuln scripts because they require different remediation conversations. An expired certificate is a quick ticket to the PKI team. An ESC8 finding is a conversation with Active Directory administration and potentially a broader discussion about certificate template permissions.</p><p>Nuclei findings in the Vulnerabilities tab include CVE numbers as clickable links to the NVD, CVSS scores, and where Nuclei provides them, reproduce commands. That last part matters, being able to hand someone a curl command that demonstrates a finding is the difference between a finding getting fixed this sprint and getting deprioritized for six months.</p><h3>What Running It Actually Looks Like</h3><p>On a /24 with 35 live hosts at T3 timing, the rough timeline is:</p><ul><li>Phase 1 (discovery): ~30 seconds</li><li>Phase 2 (port scan, three passes): 20–35 minutes</li><li>Phase 3 (targeted checks): 15–25 minutes</li><li>Phase 4 (vuln detection): 5–15 minutes</li><li>Phase 5 (report): a few seconds</li></ul><p>That’s roughly an hour per subnet. For 10 subnets, this runs overnight. The --resume flag means if anything interrupts the scan, you pick up from Phase 3 without re-running the port scan.</p><p>The one thing you cannot get around is that Windows requires Administrator privileges for SYN scans and OS detection and both use raw sockets. Without admin, the scanner detects this and automatically falls back to TCP Connect scans, which work but are noisier and less stealthy. For an internal authorised assessment on your own network, running as admin is fine. For anything else, you’d want to think about the footprint.</p><h3>What I’d Do Differently</h3><p>A few things I’d change with hindsight.</p><p>The report uses Python’s str.replace() for template substitution rather than .format(). The reason is that the HTML template contains CSS variables like var(--bg) which use curly brace syntax. Python&#39;s .format() tries to interpret every {...} as a variable placeholder and throws a KeyError when it hits a CSS block. I learned this the hard way when the first report generation attempt threw:</p><pre>KeyError: &#39;\n  --bg&#39;</pre><p>It’s a clean solution once you understand the problem, but it’s the kind of thing that takes a while to debug when you first hit it.</p><p>The other thing I’d revisit is parallelism. Currently subnets are scanned sequentially and hosts within a subnet are batched. A proper async implementation using Python’s asyncio or concurrent.futures at the subnet level would cut total scan time significantly on larger networks. It&#39;s on the list.</p><h3>Closing Thoughts</h3><p>The goal was never to build a better Nessus. It was to build something I , could maintain and extend myself, and that actually fit into how I work: a single command, a single report, no licensing negotiations.</p><p>The libraries doing the heavy lifting are all well-chosen for the job: PyYAML keeps configuration separated from code, the XML parsing is handled by Python’s standard library xml.etree.ElementTree, and the nmap NSE script ecosystem handles the actual vulnerability logic so the scanner doesn&#39;t need to re-implement checks from scratch.</p><p>If you’re a security engineer doing internal assessments and you’re still copying and pasting nmap commands into a terminal, I’d encourage you to think about what a proper pipeline for your specific environment would look like. The specific code matters less than the mental model so figure out the sequence, make each step inform the next, and save the intermediate results so you can iterate without starting over.</p><p>The tooling doesn’t have to be expensive. It just has to work.</p><p><em>If you found this useful, I also wrote about automating network config backups with Python and Netmiko and building a self-hosted WireGuard VPN on Azure: both following the same principle of building lightweight tools you actually understand.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca3c21052e53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Network Config Backups with Python and Netmiko]]></title>
            <link>https://medium.com/@romario_bennett/automating-network-config-backups-with-python-and-netmiko-c0d08bc7d01d?source=rss-fc2ed00e9a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0d08bc7d01d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[netmiko]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[cisco]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Romario Bennett]]></dc:creator>
            <pubDate>Thu, 19 Mar 2026 20:22:13 GMT</pubDate>
            <atom:updated>2026-03-20T14:04:53.184Z</atom:updated>
            <content:encoded><![CDATA[<p>A deep dive into building a production-grade backup tool for Cisco IOS devices with a concurrent execution, change detection, and structured logging</p><h3>Why I attempted this</h3><p>In most network environments, and the ones I’ve worked in the configuration backups are either manual, forgotten, or handled by expensive NMS platforms. I wanted something lightweight, scriptable, and fully under my control like something I could schedule and actually understand. So I built a Python tool that SSHes into Cisco switches and captures key show commands, timestamps and organizes the outputs, and detects configuration changes between runs. I wont be going through how to install and configure python, there&#39;s ample resources for anyone to figure that on their own.</p><p>This article walks through the key design decisions and the libraries that make it work. I won’t be publishing the full source code here, you can have a look at it through my <a href="https://github.com/RomarioBennett/Automating-Network-Config-Backups-with-Python-and-Netmiko/tree/main">GitHub</a>, but I’ll give you everything you need to understand the approach and build your own.</p><p><strong>The Tool Stack</strong><br>The tool is built entirely in Python and relies on a small set of well-chosen libraries:</p><pre><br>• Netmiko, for SSH connectivity and command execution on network devices<br>• PyYAML, for externalised device inventory and credentials (for privacy)<br>• concurrent.futures, for parallel SSH sessions across multiple devices<br>• difflib, for comparing current configs against previous backups<br>• logging, fo structured and timestamped output to both console and file<br>• argpars, for CLI interface for flexible runtime configuration</pre><h4>Netmiko</h4><p>Netmiko is the workhorse. It’s a Python library built on top of Paramiko (which handles the raw SSH), specifically designed for network device interaction. The key reason to use Netmiko over plain Paramiko is that it understands the quirks of different vendor CLIs like handling login banners, enable mode prompts, and pagination.</p><p><strong>Connecting to a Device</strong></p><p>Each device is defined as a dictionary that Netmiko’s ConnectHandler accepts:</p><pre>device = {<br>    &#39;device_type&#39;: &#39;cisco_ios&#39;,<br>    &#39;ip&#39;: &#39;10.1.1.1&#39;,<br>    &#39;username&#39;: credentials[&#39;username&#39;],<br>    &#39;password&#39;: credentials[&#39;password&#39;],<br>    &#39;secret&#39;: credentials.get(&#39;enable_secret&#39;, &#39;&#39;),<br>    &#39;timeout&#39;: 60,<br>    &#39;fast_cli&#39;: False,<br>}<br> <br>with ConnectHandler(**device) as conn:<br>    conn.enable()</pre><p>Using it as a context manager (the with statement) is important because it guarantees the SSH session is cleanly closed even if an exception occurs mid-run. With concurrent sessions, dangling connections can add up quickly.</p><p><em>fast_cli: False</em> is worth calling out. Netmiko’s fast_cli mode is designed to speed up command execution by reducing delays, but on some Cisco IOS stacked switches it can cause partial reads. Keeping it disabled is the safer default for a backup tool where completeness matters more than speed.</p><p><strong>The Pagination Problem</strong></p><p>One of the most common failure modes when using SSH to capture ‘sh run’ on a large switch is output truncation. This happens for two reasons:</p><ul><li>The device is still paginating output (‘ More ‘) even after ‘terminal length 0’ is sent</li><li>The SSH read times out before the full config has been transmitted</li></ul><p>The fix involves two commands sent before any data collection begins:</p><pre>conn.send_command(&#39;terminal length 0&#39;, expect_string=r&#39;#&#39;)<br>conn.send_command(&#39;terminal width 0&#39;, expect_string=r&#39;#&#39;)</pre><p>‘terminal length 0’ disables pagination entirely. ‘terminal width 0’ prevents line wrapping, which matters because wrapped lines can break prompt detection and Netmiko looks for the ‘#’ prompt to know output has ended, and if it appears mid-line within a wrapped config line, the read stops too early.</p><blockquote><strong>Key insight: </strong>For very long outputs like ‘sh run’, I use send_command_timing() instead of send_command(). Rather than matching a prompt, it reads until the device goes quiet. Combined with a higher delay_factor, this is far more reliable for large configs.</blockquote><h3><strong>YAML Inventory: Separating Config from Code</strong></h3><p>Hardcoding ip addresses and credentials directly in a script is a pattern that makes code fragile and a security risk in version control. The tool reads all of this from an external YAML inventory file:</p><pre>credentials:<br>  username: admin<br>  password: your_password<br>  enable_secret: enable_pw<br>  device_type: cisco_ios<br> <br>commands:<br>  - sh run<br>  - sh ip int brief<br>  - sh version<br> <br>devices:<br>  - ip: 10.1.1.1<br>  - ip: 10.1.1.2</pre><p>This separation means the script itself can live in version control (or be shared) without any sensitive data attached. The inventory file stays local or in a secrets manager. It also means adding or removing devices from the backup scope requires no code changes at all just edit the YAML.</p><h3>Concurrent Execution with ThreadPoolExecutor</h3><p>Connecting to devices sequentially is fine for a handful of switches, but it doesn’t scale. SSH handshake and command execution on a single device can take 5–15 seconds. On a 30-device network, that’s probabbly several minutes of wasted time, yikes.</p><p>So Python’s concurrent.futures.ThreadPoolExecutor makes parallelising this pretty straightforward:</p><pre>with ThreadPoolExecutor(max_workers=5) as executor:<br>    futures = {<br>        executor.submit(backup_device, device[&#39;ip&#39;]): device[&#39;ip&#39;]<br>        for device in devices<br>    }<br>    for future in as_completed(futures):<br>        result = future.result()</pre><p>Each device gets its own thread, up to the <em>max_workers</em> limit. The <em>as_completed()</em> call lets results be processed as they finish rather than waiting for all threads to complete. The <em>max_workers</em> cap is important since opening 50 simultaneous SSH sessions to a management network is the kind of thing that gets noticed.</p><h3>Config Change Detection with difflib</h3><p>Saving configs is useful andnowing when they change is far more useful. After each backup run, the tool compares the new output against the most recent previous backup using Python’s built-in difflib library:</p><pre>diff = difflib.unified_diff(<br>    previous_lines,<br>    current_lines,<br>    fromfile=&#39;previous&#39;,<br>    tofile=&#39;current&#39;,<br>)</pre><p>If a diff is found, it’s saved as a <em>.diff</em> file alongside the backup. This creates a lightweight audit trail, you can look back through the diff files to see exactly what changed on a device and when, without needing a full NMS or SIEM.</p><p>In practice this catches things like: ACL modifications, interface description changes, added or removed VLAN configs, and spanning-tree parameter changes, all the small drifts that happen in production environments and are kinda easy to miss</p><h3>Structured Logging</h3><p>Python’s logging module is used instead of print() statements for a straightforward reason…. logs need to go to two places simultaneously, the console for real-time feedback and a timestamped file for auditing runs.</p><pre>logging.basicConfig(<br>    level=logging.INFO,<br>    handlers=[<br>        logging.StreamHandler(sys.stdout),<br>        logging.FileHandler(log_path, encoding=&#39;utf-8&#39;),<br>    ]<br>)</pre><p>The encoding=’utf-8&#39; on the FileHandler is a practical detail since I’m runnign this on windows, itdefaults to CP1252, which can’t encode certain characters and will throw a UnicodeEncodeError at runtime. Specifying UTF-8 explicitly makes the tool portable across platforms.</p><p>Every log entry is timestamped and labelled with the device hostname, so in a concurrent run where messages from multiple devices are interleaved, it’s immediately clear which device each line refers to.</p><h3>Output File Structure</h3><p>Each backup that run creates a timestamped file per command per device, organized into per-device folders</p><pre>switch_backups/<br>  Switch1/<br>    2026-03-19_09-00-00_shrun.txt<br>    2026-03-19_09-00-00_shipintbrief.txt<br>    2026-03-19_09-00-00_shrun.diff<br>  Router2<br>    2026-03-19_09-00-00_shrun.txt<br>    ...</pre><p>The hostname is extracted from the device’s CLI prompt after connecting This means the folder name always reflects the actual configured hostname on the device, which is useful when inventory and actual configs drift out of sync.</p><h3>Scheduling Automated Runs</h3><p>The tool is designed to be scheduled. On Windows, Task Scheduler can invoke it nightly. On Linux, a cron job works clean combined with the diff-based change detection, this gives you a daily record of every configuration change across your network estate without any third-party tooling.</p><h3>Closing Thoughts</h3><p>The goal wasn’t to replicate a $50k NMS. It was to build something simple that I fully understood and could maintain, and just helped on a daily basis The libraries doing the heavy lifting here are all well-documented and production-proven. Netmiko handles the gnarly SSH edge cases so you don’t have to. PyYAML and argparse keep the tool clean and configurable. difflib is underappreciated for this kind of network auditing use case. And concurrent.futures makes parallelism accessible without the complexity of async.</p><p>If you’re working in networking and not yet writing automation, tools like this are a natural starting point. The device interaction patterns here apply to any vendor Netmiko supports the likes of Arista, Juniper, HP, Aruba with minimal changes.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0d08bc7d01d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a self-hosted VPN with WireGuard on an Azure VPS]]></title>
            <link>https://medium.com/@romario_bennett/building-a-private-vpn-with-wireguard-on-an-azure-vps-75a5864bb624?source=rss-fc2ed00e9a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/75a5864bb624</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-networking]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vpn]]></category>
            <dc:creator><![CDATA[Romario Bennett]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 22:12:32 GMT</pubDate>
            <atom:updated>2026-03-14T07:02:32.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4qUAqO4C0MLV4SjtT6wF8w.png" /></figure><p>I wanted to take on another hands-on cloud project, something that combined networking, a bit of Linux administration, and cloud infrastructure in a practical, real-world scenario. I decided to build my own self-hosted VPN using <strong>WireGuard</strong> and an Azure Virtual Machine as the VPS.</p><p><strong>What is WireGuard and Why Does it Matter?</strong></p><p>WireGuard is a modern, open-source VPN protocol built directly into the Linux kernel. Compared to older solutions like OpenVPN, it offers dramatically simpler configuration, a much smaller codebase (roughly 4,000 lines versus OpenVPN’s hundreds of thousands), and significantly better performance. It uses state-of-the-art cryptography(ChaCha20 for symmetric encryption and Curve25519 for key exchange) meaning it’s not only fast but designed to be difficult to misconfigure.</p><p>Running WireGuard on a VPS you control means your traffic exits through <em>your</em> server in <em>your</em> chosen region, with no logs being kept by a third-party. For developers, privacy-conscious users, or anyone who wants to understand VPNs at a deeper level, self-hosting is an incredibly rewarding exercise.</p><p>The high-level architecture is kinda straightforward:</p><pre>[Mobile/Client Device]<br>        |<br>WireGuard Tunnel (UDP 51820)<br>        |<br>[Azure VM - WireGuard Server]<br>        |<br>     Internet</pre><p>All traffic from the client is encrypted and tunneled to the Azure VM, which then forwards it to the internet on the client’s behalf.</p><h3>Part 1: Provisioning the Azure VM</h3><h3>Creating the Virtual Machine</h3><p>Head to your Azure Portal and navigate to <strong>Create a Resource&gt; Virtual Machines &gt; Create &gt; Virtual Machine</strong>. This brings up the VM creation wizard.</p><p><strong>Basics Tab Project Details</strong></p><p>Fill in the Subscription and Resource Group first. Here I’m using VPS_RG as the resource group to keep all related resources organized together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*9YX3CvAfMy600fq8rNXJTg.png" /></figure><p>The key settings at this stage:</p><pre>The key settings at this stage:<br><br><strong>Subscription</strong>: Azure subscription 1<br><strong>Resource Group</strong>: VPS_RG<br><strong>Virtual Machine Name</strong>: tomatosauce<br><strong>Region:</strong> UK South (choose a region that makes sense for your use case - closer generally means lower latency)<br><strong>Availability Options:</strong> No infrastructure redundancy required (fine for a personal VPN)<br><strong>Security Type:</strong> Standard<br><strong>Image:</strong> Ubuntu Server 24.04 LTS - x64 Gen2<br><strong>VM Architecture:</strong> x64</pre><p>Scrolling further down, choose the VM size and configure SSH access. The Standard_B1ls (1 vCPU, 0.5 GiB memory) runs at around $4.31/month and is perfectly adequate for a personal our purposes, the protocol is extraordinarily lightweight and won’t stress even the most minimal compute instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*pBr2DVvYWo6exCG-epv6bQ.png" /></figure><p>Azure will generate an RSA key pair and prompt you to download the private key (<strong><em>.pem</em></strong> file) when you confirm creation. <strong>Keep this file safe</strong> as it&#39;s your only way to SSH into the machine.</p><p>For Inbound Port Rules, select <strong>Allow selected ports</strong> and choose <strong>SSH (22)</strong>. Note the warning Azure shows noting that this allows all IP addresses to access your VM via SSH. That’s acceptable for getting started, but for anything beyond personal testing you’d want to restrict this to your specific IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*mzmbyKe32yQiXqAfYUMk-g.png" /></figure><p>For the Disks Tab, The defaults work well here. The one thing worth confirming is that <strong>Delete with VM</strong> is checked,this ensures the disk is cleaned up if you later delete the VM, avoiding orphaned storage charges.</p><pre><strong>OS disk size:</strong> Image default (30 GiB)<br><strong>OS disk type:</strong> Premium SSD (locally-redundant storage)<br><strong>Delete with VM:</strong> Checked</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*OVplWjG7ti9oEY1cruXlZQ.png" /></figure><p>Under <strong>Networking</strong> you select the <strong>Virtual Network</strong> and the <strong>Subnet</strong> you wish to assign to the virtual machine</p><pre><strong>Virtual Network:</strong> VPS_VN<br><strong>Subnet:</strong> default (10.1.1.0/29)<br><strong>Public IP:</strong> (new) tomatosauce-ip<br><strong>NIC network security group:</strong> Basic<br><strong>Public inbound ports:</strong> Allow selected ports-SSH (22)<br><strong>Delete public IP and NIC when VM is deleted</strong>: Checked (recommended to avoid orphaned resources and unexpected charges)</pre><p>Leave load balancing set to none.<strong> </strong>Click <strong>Review + create</strong>, confirm the settings, and hit <strong>Create</strong>. Azure will immediately prompt you to download the SSH key pair its important you do this now before proceeding.</p><p>After a minute or two, your VM will be up. Navigate to the VM overview page and note the <strong>Primary NIC public IP</strong> , you&#39;ll need this throughout the rest of the setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hz1iIyzQ0MgphUwcrp1F4w.png" /></figure><h3>Part 2: Azure Networking Configuration</h3><p>Before touching the server, two things need to be configured at the Azure network layer: enabling IP forwarding on the network interface, and opening the WireGuard port in the Network Security Group.</p><h3>Enabling IP Forwarding</h3><p>WireGuard acts as a router, forwarding packets between your client device and the internet. For this to work, the Azure network interface must have IP forwarding enabled at the platform level.</p><p>Go to your VM &gt; <strong>Networking &gt; Network Settings &gt; Network Interface/ IP Configurations</strong>. Enable the <strong>Enable IP forwarding</strong> toggle and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*wZhivpjJ0yxLlLyz-q6qsw.png" /><figcaption>This tells Azure’s software-defined network to allow the NIC to forward packets not originally addressed to it which is a requirement for routing VPN traffic on behalf of connected clients.</figcaption></figure><h3>Configuring Network Security Group Rules</h3><p>By default, Azure’s NSG blocks all inbound traffic not explicitly permitted. We need to open UDP port 51820 , the port WireGuard listens on.</p><p>Navigate to your VM’s <strong>Network Security Group</strong> (accessible via the Networking blade or the resource group). Add a new inbound security rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQ-U1XwVE-9EdlJqExYyCg.png" /><figcaption>Everything not explicitly permitted is denied, a clean, minimal attack surface.</figcaption></figure><pre><strong>Priority:</strong> 310<br><strong>Name:</strong> WG-Listening-Port<br><strong>Port:</strong> 51820<br><strong>Protocol:</strong> Any (WireGuard uses UDP; &quot;Any&quot; covers this)<br><strong>Source:</strong> Any<br><strong>Destination:</strong> Any<br><strong>Action:</strong> Allow</pre><h3>Part 3: WireGuard Server Setup</h3><h4>SSH Into the VM</h4><p>With your .pem file downloaded, connect to the VM from your terminal of choice.</p><pre>ssh -i tomatosauce_key.pem tomatosauce@20.90.97.111</pre><h4>Installing WireGuard</h4><p>Update the package list and install WireGuard:</p><pre>sudo aptupdate &amp;&amp; sudo apt upgrade -y<br>sudo apt install wireguard -y</pre><p>WireGuard is included in Ubuntu 24.04’s kernel, so this installs the userspace tools and utilities. Verify the installation:</p><pre>wg --version</pre><h4>Generating Server Keys</h4><p>WireGuard uses a public/private keypair for each peer. First just create a directory where you can store the WireGuard key pair, for example:</p><pre>mkdir $HOME/.wireguard<br>cd $HOME/.wireguard<br>umask 077</pre><p>Here umask 077sets a secure default file permission (typically -rw------- for files, drwx------ for directories) that restricts all read, write, and execute permissions to the file owner only.</p><p>In the directory you created, generate a WireGuard cryptographic key pair.</p><p>You can specify any preferred names for the files to contain the server’s private and public keys.</p><pre>wg genkey | tee privatekey | wg pubkey &gt; publickey</pre><p>Obtain the server’s private and public keys and store them in a temporary storage.</p><pre>cat $HOME/.wireguard/privatekey<br>cat $HOME/.wireguard/publickey<br></pre><h4>Enabling IP Forwarding at the OS Level</h4><p>Even though we enabled IP forwarding in Azure’s network layer, we also need to enable it at the Linux kernel level.</p><pre>sudo sysctl -w net.ipv4.ip_forward=1</pre><p>To make this persistent across reboots, edit /etc/sysctl.conf</p><pre>sudo nano /etc/sysctl.conf</pre><p>Uncomment or add this line:</p><pre>net.ipv4.ip_forward=1</pre><p>Save and apply:</p><pre>sudo sysctl -p</pre><h4>Configuring the WireGuard Interface</h4><p>Create the WireGuard server configuration file: sudo nano /etc/wireguard/wg0.conf and paste the in the following, substituting your actual key values:</p><pre>[Interface]<br>Address = 172.16.2.1/24<br>ListenPort = 51820<br>PrivateKey = &lt;SERVER_PRIVATE_KEY&gt;<br><br># NAT: forward client traffic through the VM&#39;s public interface (eth0)<br>PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<br>PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE<br><br>[Peer]<br># Mobile client<br>PublicKey = &lt;CLIENT_PUBLIC_KEY&gt;<br>AllowedIPs = 172.16.2.1/32</pre><p>A few things worth understanding here:</p><ul><li>Address = 172.16.2.1/24 defines the VPN subnet. The server takes .1, and clients will be assigned addresses like .2, .3, etc.</li><li>ListenPort = 51820 must match the NSG rule we created in Azure.</li><li>The PostUp and PostDown rules configure iptables NAT so traffic arriving from the VPN subnet is masqueraded behind the VM&#39;s public IP AND this is what allows clients to actually reach the internet through the tunnel.</li><li>Replace eth0 with your actual public network interface name if different. Check with ip link show.</li><li>The [Peer] block registers your mobile client by its public key. AllowedIPs = 172.16.2.2/32 means only packets originating from that specific VPN IP are accepted from this peer.</li></ul><h4>Starting WireGuard</h4><p>Bring up the WireGuard interface: sudo wg-quick up wg0 the connfirm it started correctly: sudo wg show and you should see the interface name, listening port, and the registered peer.</p><p>Enable WireGuard to start automatically on boot:sudo systemctl enable wg-quick@wg0</p><h3>Part 4: Configuring the Mobile Client</h3><p>For the client I used the <strong>WireGuard app</strong> on mobile, available on both iOS and Android. It supports adding tunnels via QR code scan, which makes setup fast and avoids any manual key entry on a phone.</p><h4>Creating the Client Configuration</h4><p>Generate the private and public keys on the application and enter the relavant configurations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*w8KreG_09LmS6cWT5EpIQg.jpeg" /></figure><pre>[Interface]<br>PrivateKey = &lt;CLIENT_PRIVATE_KEY&gt;<br>Address = 172.16.2.2/32<br>DNS = 1.1.1.1<br><br>[Peer]<br>PublicKey = &lt;SERVER_PUBLIC_KEY&gt;<br>Endpoint = x.x.x.x:51820<br>AllowedIPs = 0.0.0.0/0<br>PersistentKeepalive = 25</pre><p>Breaking this down:</p><ul><li>Address = 10.0.0.2/32 : the VPN IP address assigned to this client.</li><li>DNS = 1.1.1.1 : routes DNS queries through Cloudflare when the tunnel is active, preventing DNS leaks to your ISP.</li><li>Endpoint: the Azure VM&#39;s public IP and WireGuard listening port.</li><li>AllowedIPs = 0.0.0.0/0: routes <strong>all</strong> traffic through the VPN tunnel (full-tunnel mode).</li><li>PersistentKeepalive = 25: sends a keepalive packet every 25 seconds to maintain the tunnel through mobile carrier NAT. This is especially important on phones that frequently switch between Wi-Fi and cellular.</li></ul><h3>Part 5: Verifying the Connection</h3><h3>Server-Side Verification</h3><p>Once the mobile client connects, confirm the tunnel is active on the server: sudo wg show</p><p>You should see output similar to:</p><pre>interface: wg0<br>  public key: &lt;server_public_key&gt;<br>  private key: (hidden)<br>  listening port: 51820<br><br>peer: &lt;client_public_key&gt;<br>  endpoint: &lt;client_ip&gt;:&lt;ephemeral_port&gt;<br>  allowed ips: 172.16.2.2/32<br>  latest handshake: 5 seconds ago<br>  transfer: 92 B received, 180 B sent</pre><p>The latest handshake timestamp and non-zero transfer values confirm the tunnel is established and traffic is flowing. If no handshake appears, double-check three things: the NSG rule in Azure (port 51820 open), the ListenPort in wg0.conf, and the Endpoint value in the client config.</p><h4>Client-Side Verification</h4><p>With the tunnel active in the WireGuard mobile app, open a browser and visit <strong>whatismyip.com</strong> or <strong>ifconfig.me</strong>. Your displayed public IP should now show as the Azure VM&#39;s IP confirming all traffic is exiting through your VPN server.</p><p>You can also ping the server’s VPN address to confirm connectivity within the VPN subnet: ping ping 172.16.2.1. A successful ping confirms end-to-end VPN connectivity.</p><h3>Key Considerations</h3><p><strong>Cost:</strong> The Standard_B1ls VM in UK South runs at roughly $4.31/month. Azure also charges a small amount for the public IP while it’s associated with a running resource, and there are outbound bandwidth costs depending on how much traffic you route through the VPN. For personal use, the monthly total will be minimal.</p><p><strong>Security hardening:</strong> The sshinbound rule currently allows access from any IP, Azure flags this with a warning during VM creation. If this is anything beyond a personal project i recommend you to restrict the ssh source to your home IP in the NSG. For tighter security still, remove ssh access and use Azure Bastion for all management access.</p><p><strong>Key management:</strong> Treat private keys like passwords. Never commit them to a repository or share them over unencrypted channels. The /etc/wireguard/ directory should remain readable only by root.</p><p><strong>DNS leak protection:</strong> The DNS = 1.1.1.1 line in the client config is easy to overlook but important. Without it, DNS queries may bypass the tunnel entirely and leak to your ISP even while the VPN is active.</p><p><strong>Adding more clients:</strong> Generate a new keypair, add a new [Peer] block to wg0.conf with a unique AllowedIPs address (e.g. 172.16.2.3/32), and reload: sudo wg-quick down wg0 &amp;&amp; sudo wg-quick up wg0. Each client gets its own keypair and VPN IP, they never share credentials.</p><h3>Conclusion</h3><p>Setting this up from scratch gave me a much deeper appreciation for how VPNs actually work at the protocol and networking level. WireGuard is genuinely elegant and the configuration is minimal, the performance is excellent, and once it’s running it stays out of your way. Pairing it with Azure made the networking side very visual and manageable, particularly being able to see the NSG rules, IP forwarding configuration, and VM state all laid out clearly in the portal.</p><p>If you’re looking to build more practical cloud and Linux skills, this is one of the best single-afternoon projects you can take on. It touches VM provisioning, networking fundamentals, Linux system administration, cryptography, and firewall configuration all in one sitting.</p><p>For further reading, the official WireGuard documentation is excellent, and Oracle’s guide on <a href="https://docs.oracle.com/en/operating-systems/oracle-linux/vpn/vpn-ConfiguringaVPNbyUsingWireGuard.html">configuring a VPN using WireGuard</a> provides useful additional context around the underlying concepts that apply regardless of cloud provider.</p><p><em>If you made it all the way to the end , thanks for reading. Leave a comment if you have any questions or run into any issues.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75a5864bb624" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Cloud Resume Challenge using Oracle Cloud Infrastructure]]></title>
            <link>https://medium.com/@romario_bennett/cloud-resume-challenge-on-oracle-cloud-infrastructure-oci-d6e65697cb40?source=rss-fc2ed00e9a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6e65697cb40</guid>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Romario Bennett]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 01:42:23 GMT</pubDate>
            <atom:updated>2025-11-13T15:42:17.649Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="https://cloudresumechallenge.dev/"><strong>Cloud Resume Challenge</strong></a> is a hands-on project designed to bridge the gap between theoretical cloud knowledge and real-world expertise. It tasks individuals with building a full-stack, serverless resume website from the ground up while adding features like a visitor counter and incorporating critical cloud and DevOps principles like Infrastructure as Code, serverless computing, and CI/CD pipelines. More than just a project, it’s a practical proving ground for anyone looking to validate their skills and advance their career in the cloud industry. <a href="https://forrestbrazeal.com/">Forrest Brazeal</a> originally designed it for AWS and Azure, but I recently completed the challenge using Oracle Cloud Infrastructure (OCI) after obtaining a few OCI certifications so I could practically apply the knowledge.</p><p>While many guides I’ve come across mostly target AWS or Azure, I decided to attempt it using Oracle so here I’ll show how to do it entirely in OCI. We’ll host a static html/css resume in <strong>OCI Object Storage</strong>, front it with an <strong>API Gateway</strong> (for https and custom domain), use <strong>OCI Functions</strong> (serverless) to update a visitor count, and store that count in <strong>Oracle NoSQL Database</strong>. We will be leveraging OCI’s free tier so this can be done at no cost. The approach is cloud-native and serverless, fitting a DevOps/Cloud Engineer workflow. So the main areas are as follows:</p><ul><li><strong>OCI Object Storage</strong> : hosts all static files (HTML, CSS, JS, images, etc.).</li><li><strong>API Gateway</strong> : provide an HTTPS endpoint (and custom DNS) for the site.</li><li><strong>OCI Functions: </strong>run code to increment/read the visitor counter.</li><li><strong>Oracle NoSQL DB: </strong>store the visit count (key-value table).</li></ul><p>The figure below shows a typical OCI pattern (from Oracle’s docs) where Object Storage triggers a Function to update NoSQL. In our case, we trigger the Function via API Gateway instead of Object Storage events, but the service interplay is similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hi94Pog-xrtkLBxt.png" /><figcaption><em>Example OCI serverless architecture (Object Storage + Functions + NoSQL). In our implementation, the visitor counter uses a similar pattern: an API Gateway request invokes a Function, which updates a NoSQL table.</em></figcaption></figure><h4><strong>1. Static Resume Site on OCI Object Storage</strong></h4><p>First, build the static resume page in using html and css. When it’s ready (e.g. index.html, with any images, css, js), host it in OCI. OCI’s Object Storage<strong> </strong>can serve static content, and we’ll use an API Gateway in front of it for nicer URLs and HTTPS.</p><p>In the OCI Console or CLI, make a new bucket for the site. Navigate to <em>Storage &gt; Object Storage and Archive storage &gt; Buckets &gt; Create Bucket </em>and name it whatever you’d like and keep the default settings for now<em> </em>and upload your index.html , css, js, etc. files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*iyITtKqRFBsljgzZX2AQqA.png" /></figure><pre>oci os bucket create --name web-bucket \<br>  --compartment-id &lt;my_compartment_ocid&gt; \<br>  --public-access-type ObjectRead</pre><p>Ensure that the bucket visibility is set to <em>public</em>. This creates a bucket with public read permissions (allowing GET on objects) <a href="https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/managingbuckets_topic-To_create_a_bucket.htm#:~:text=you%20must%20explicitly%20set%20%60,ObjectRead">docs.oracle.com</a>. (If you prefer, you can keep the bucket private and use a <em>Pre-Authenticated Request</em> (PAR) URL instead, as described in Oracle’s docs <a href="https://medium.com/oracledevs/how-to-serve-website-static-files-from-the-oci-object-storage-bd79ca0805c7#:~:text=Make%20the%20bucket%20publicly%20visible,and%20you%20might%20avoid%20it">medium.com</a><a href="https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html#:~:text=Task%203%3A%20Create%20Pre">docs.oracle.com</a>.) After creating the bucket, upload your built resume files.</p><p>Next, we want to make the content accessible. By default buckets are private. We need a way for the website (and API) to fetch these files. The simplest approach is to go to the bucket and create a Pre-Authenticated Request on the bucket that allows object reads. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0QgsWwjATXDz1VgNBjWlg.png" /></figure><pre>oci os preauth-request create --namespace &lt;your_namespace&gt; \<br>  --bucket-name my-resume-bucket \<br>  --name public-par \<br>  --access-type AnyObjectRead \<br>  --time-expires &quot;2025-12-31T23:59:59+00:00&quot;</pre><p>This generates a URL (not shown here) that lets anyone read objects in the bucket. We’ll use this URL as the origin in API Gateway. (Alternatively, you could mark the bucket public via oci os bucket update --bucket-name my-resume-bucket --public-access-type ObjectRead, but using a PAR is straightforward and auditable.)</p><p>Next, we configure OCI API Gateway as a front-end. Navigate to Developer Services &gt; Gateway &gt; Create Gateway, create a new gateway (choose your VCN/compartment, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*axB8KQb_vxp2ZW4IG8fwIg.png" /></figure><pre>oci apigateway gateway create --display-name resume-gateway \<br>  --compartment-id &lt;compartment_ocid&gt; \<br>  --subnet-id &lt;public_subnet_ocid&gt; \<br>  --is-private false</pre><p>Once the gateway is created open it and then navigate to <em>Deployments</em> and create a deployment (choose “from scratch”). Set the base path to “/”. No authentication is needed (static site is public). Next, add a route with path /{req*} (this matches all requests) and method GET. We will use <em>multiple backends</em> so that we can route different file types, the following <a href="https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html#task-6-add-routes">resource</a> can be used as a guide for this section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_IU34qN9Ggg3VirF748sg.png" /></figure><p>API Gateway lets us publish HTTP endpoints that route to backends (e.g. our Object Storage). Ensure that you have created a a Virtual Cloud Network (VCN) with a regional public subnet (Internet Gateway attached) and allow inbound TCP/443 in the subnet’s security list. This is required because API Gateway uses HTTPS on port 443. Then create an API Gateway instance (type <em>Public</em>) in that subnet</p><h4><strong>2. Adding a Visitor Counter (NoSQL + Functions + API)</strong></h4><p>The next challenge step is to record and display how many visitors have accessed the site. We’ll implement a simple counter with these pieces: an OCI <strong>NoSQL</strong> table to store the count, an OCI <strong>Function</strong> that increments/returns the count, and a new route on the API Gateway to invoke that function. Finally, we’ll add JavaScript to the static page to call the API and display the count. The overall flow is: Browser <em>&gt; (HTTP GET) &gt; API Gateway &gt; OCI Function (increment count)&gt; Oracle NoSQL DB &gt; (return count) &gt; Browser.</em></p><h4>NoSQL</h4><p>First, set up the database. Oracle NoSQL is a serverless, managed key-value/JSON store. We just need one table and maybe one row for our count. <em>Navigate to Databases &gt; Oracle NoSQL Database &gt; Tables</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lI881Px8IdbU5AgMYITxpQ.png" /></figure><p>NoSQL tables require setting read/write units. For a low-traffic site, minimal values suffice. You can use the GUI for this entire process.</p><p>If you choose to use Cloud Shell you can create a file (e.g. limits.json) with something like:</p><pre>{<br>  &quot;maxReadUnits&quot;: 10,<br>  &quot;maxWriteUnits&quot;: 5,<br>  &quot;maxStorageInGBs&quot;: 1<br>}</pre><p>Then use the OCI CLI to create a table called <em>visitors</em>. For example:</p><pre>oci nosql table create \<br>  --name visitors \<br>  --ddl-statement &quot;CREATE TABLE visitors (id integer, visits integer, PRIMARY KEY (id))&quot; \<br>  --table-limits file://limits.json</pre><p>This uses the CLI as shown in Oracle’s docs <a href="https://medium.com/@fmeloc/oci-nosql-tables-9c90c4648f2c#:~:text=Then%20we%20can%20use%20it,in%20the%20command%20below">medium.com</a>. It creates a table with two columns: <em>id</em> and <em>visits</em> , where <em>id</em> is the shard key (we’ll use a fixed id, e.g. 1). Optionally you can insert a row to initialize the counter. You could do this via the CLI:</p><pre>oci nosql query execute --statement &quot;INSERT INTO visitors (id, visits) VALUES (1, 0)&quot;</pre><p>This makes sure there is a record with <em>visits=0</em> . (Or your function can handle inserting on first run, up to you really). Now the <em>visitors</em> table is ready. Oracle NoSQL will auto-scale and is on the free-tier as long as you keep limits low</p><h4>Oracle Function</h4><p>Next, we write a small serverless function that will run each time someone hits the counter API. This function should read the current count from the NoSQL table, increment it (atomically or in code), update the table, and return the new count in a JSON response.</p><p>For example, you might write the function in Python or JavaScript. Personally I’m a lot more familiar with Python so that’s what i used to complete this section.</p><pre>import io, sys, json, logging<br>import oci<br>from borneo import NoSQLHandle, NoSQLHandleConfig, Regions <br>from borneo.iam import SignatureProvider<br>from borneo import GetRequest, PutRequest<br>from fdk import response <br><br>#borneo is the Python SDK for Oracle NoSQL Database<br>#OCI Functions uses Fn Project Function Development Kits<br>#(FDKs) to support popular languages - Java, Node.js, Python, Go, Ruby, and C#.<br><br>def handler(ctx, data=None):<br>    &quot;&quot;&quot;<br>    Oracle Cloud Function handler to increment a counter in an OCI NoSQL table.<br>    Triggered via HTTP invocation or another OCI service.<br>    &quot;&quot;&quot;<br><br>    try:<br>        # Create a resource principal-based SignatureProvider<br>        # This allows the function to authenticate securely to OCI services <br>        # using its assigned dynamic group policies (no credentials hardcoded).<br>        provider = SignatureProvider.create_with_resource_principal()<br><br>        # Define the OCI region where your NoSQL database resides<br>        region = Regions.US_ASHBURN_1  <br><br>        # Configure the NoSQL handle (connection to NoSQL DB)<br>        # - Authorization provider: resource principal<br>        # - Default compartment: your tenancy OCID or compartment OCID<br>        # - No custom logger (set_logger(None))<br>        config = (<br>            NoSQLHandleConfig(region)<br>            .set_authorization_provider(provider)<br>            .set_default_compartment(&quot;compartment.tennancy id&quot;)<br>            .set_logger(None)<br>        )<br><br>        #Create the NoSQL handle object used for all DB operations<br>        handle = NoSQLHandle(config)<br><br>        #Define table and key (this assumes a simple key-value table)<br>        table_name = &quot;visitors&quot;<br>        key = {&quot;id&quot;: 1}<br><br>        # Retrieve the current counter value from the table<br>        result = handle.get(<br>            GetRequest()<br>            .set_table_name(table_name)<br>            .set_key(key)<br>        )<br><br>        # Extract current &#39;views&#39; count, or default to 0 if the record doesn&#39;t exist<br>        current_count = result.get_value().get(&quot;views&quot;, 0) if result.get_value() else 0<br><br>        #Increment the count<br>        new_count = current_count + 1<br><br>        # Prepare the updated item to put back into the table<br>        item = {&quot;id&quot;: 1, &quot;visits&quot;: new_count}<br><br>        # Write (upsert) the updated count into the NoSQL table<br>        handle.put(<br>            PutRequest()<br>            .set_table_name(table_name)<br>            .set_value(item)<br>        )<br><br>        # Return a JSON response with the new count<br>        return response.Response(<br>            ctx,<br>            response_data=json.dumps({&quot;count&quot;: new_count}),<br>            headers={&quot;Content-Type&quot;: &quot;application/json&quot;}<br>        )<br><br>    except Exception as e:<br>        #Log detailed error info for debugging and return a 500 response<br>        logging.error(f&quot;Error in counter function: {e}&quot;, exc_info=True)<br>        return response.Response(<br>            ctx,<br>            response_data=json.dumps({&quot;error&quot;: str(e)}),<br>            headers={&quot;Content-Type&quot;: &quot;application/json&quot;},<br>            status_code=500<br>        )</pre><p><em>Note:(The exact code depends on the language/SDK. The key idea is: connect to NoSQL, do a SELECT and UPDATE, and output the count.)</em></p><p>To deploy this as an OCI Function:</p><ol><li>Create a Functions application - In OCI Console under <em>Developer Services &gt; Functions</em>, create an application (e.g. named <em>ResumeCounterApp</em>). This groups your functions.</li><li>OCI Functions uses the Fn Project. On your development machine or Cloud Shell, first configure an Fn context for OCI. For example:</li></ol><p>Create and select an OCI context, supplying your profile, region, and compartment, this configures the Fn CLI to use your OCI account and to push function images to your OCI Registry</p><pre><br>fn use context &lt;region&gt;<br>fn update context oracle.profile &lt;your-oci-profile&gt;<br>fn update context oracle.compartment-id &lt;your-compartment-OCID&gt;<br>fn update context api-url https://functions.&lt;region&gt;.oci.oraclecloud.com<br>fn update context registry &lt;region-key&gt;.ocir.io/&lt;your-tenancy-namespace&gt;/&lt;repo-prefix&gt;<br>docker login -u &#39;&lt;tenancy-namespace&gt;/&lt;your-username&gt;&#39; &lt;region-key&gt;.ocir.io<br></pre><p><em>Note: The password for the docker login is an API key that you have to create in OCI.</em></p><p>Next, we have to initialize the function, inside your project directory, run:</p><pre>fn init --runtime python counterFunc</pre><p>This creates a new folder <em>counterFunc/ </em>with a Python boilerplate:<strong> func.py</strong>, <strong>func.yaml</strong>, and <strong>requirements.txt </strong>Edit func.py to implement your logic (from above). The func.yaml can define function-specific environment variables under a config.</p><p>From the function folder, run:</p><pre>fn -v deploy --app ResumeCounterApp</pre><p>This command builds the Docker image, pushes it to OCI Registry, and creates the function in the application. Upon success you’ll see a message like <em>Successfully published function “counterFunc”.</em> You can test it locally (using <em>fn invoke</em>) or invoke it via OCI logging to ensure it increments the count.</p><h4>Creating the API Gateway Endpoint</h4><p>Now expose the function via OCI API Gateway. In the OCI Console, go to <strong>Developer Services &gt; API Gateway</strong>, and go to the gateway we created earlier, open its <strong><em>Deployments </em></strong>section and open the existing deployment we created earlier . Edit it.</p><p>Within the deployment wizard, add a <strong>Route</strong> for your function. For example:</p><ul><li><strong>Path:</strong> /count (or any path you like)</li><li><strong>HTTP Method:</strong> POST GET(since we’re updating the count)</li><li><strong>Backend Type:</strong> Oracle Functions</li><li><strong>Function Application:</strong> <em>ResumeCounterApp</em>(the name of your application)</li><li><strong>Function:</strong> <em>counterFunc</em> (the name of your function)</li></ul><p>This tells the gateway that a POST to /count should invoke your counterFunc. Once you add the route, wait for the deployment to become <em>Active</em>. The console will display an <em>Invoke</em> URL (e.g. https://gateway-id-gateway.&lt;region&gt;.oci.customer-oci.com/). Combine this with your path (e.g. https://.../count) to get the full endpoint. For example, after activating the deployment, you might see:</p><pre>https://xxxxxx-gateway.us-ashburn-1.oci.oraclecloud.com/count</pre><p>Copy this URL. You can also test it with curl or Postman to ensure it returns JSON with the count. The Oracle docs note that you must give the gateway permission to invoke Functions (usually via a dynamic group and IAM policy), but if you set it up in the same compartment and VCN, the wizard often handles it. As a reference, configuring the route is described here <a href="https://ionut-vladu-adrian.medium.com/expose-oci-functions-with-different-http-methods-on-api-gateway-mytechretreat-10472dbe063b?source=post_internal_links---------4----------------------------#:~:text=In%20the%20API%20Gateway%2C%20create,you%20want%20to%20deploy%20it">ionut-vladu-adrian.medium.com</a><a href="https://ionut-vladu-adrian.medium.com/expose-oci-functions-with-different-http-methods-on-api-gateway-mytechretreat-10472dbe063b?source=post_internal_links---------4----------------------------#:~:text=Then%2C%20create%20a%20new%20route%3A">ionut-vladu-adrian.medium.com</a> and after deployment you see the active endpoint URL</p><h4>Connecting the Frontend (JavaScript)</h4><p>Finally, update your static resume page so it calls this API. In your HTML/JS code, add a script that sends a request to the gateway endpoint and displays the returned count. For example, using <em>fetch</em>:</p><pre>async function updateVisitorCount() {<br>  try {<br>    // Replace this URL with your actual API Gateway endpoint<br>    const response = await fetch(&#39;https://&lt;your-gateway-url&gt;/count&#39;, <br>       // or &#39;GET&#39; depending on how your function increments<br>    );<br><br>    if (!response.ok) {<br>      throw new Error(`HTTP error! Status: ${response.status}`);<br>    }<br><br>    const data = await response.json();<br>    document.getElementById(&#39;visitor-count&#39;).innerText = data.count;<br>  } catch (err) {<br>    console.error(&#39;Visitor count update failed:&#39;, err);<br>  }<br>}<br><br>// Run it automatically when the page loads<br>window.addEventListener(&#39;load&#39;, updateVisitorCount);</pre><p>In this snippet, replace &lt;your-gateway-url&gt; with the API Gateway invoke URL from above, and ensure you have an element like &lt;span id=&quot;visitor-count&quot;&gt;...&lt;/span&gt; in your HTML where the number should appear. On page load, this code POSTs to /count, the function runs and returns the new count, which is then displayed. (As one Cloud Resume Challenge example notes, “the Javascript part involved making an API call to my API gateway with fetch to get and display the visitors count” <a href="https://dev.to/therealbolaji/cloud-resume-challenge-4kfb#:~:text=1,using%20a%20dummy%20api%20endpoint">dev.to</a>.</p><p>Make sure your API Gateway deployment has CORS enabled if your static site’s domain differs. After deploying your site to Object Storage, the page should now show the visitor count and increment it on each load.</p><p>In a separate article I will cover the IaC portion of this challenge utilizing Terraform.</p><h4>Conclusion</h4><p>I’ll be honest, completing the challenge, especially on OCI had its tedious moments, but that was also the best part mostly because it forces you to figure things out on my own through trial, error, and deep research. It was the right amount of frustrating and fun, and ultimately, an incredibly rewarding experience that tested my technical and problem-solving skills.</p><p>Also, If you want you can have a look at my <a href="https://romariobennettresume.site/">site</a>.</p><p>For those looking to take on this challenge themselves or explore OCI further, I highly recommend reviewing Oracle’s official documentation:<br> <a href="https://docs.oracle.com/en-us/iaas/Content/home.htm">Oracle Cloud Infrastructure Documentation</a></p><p><em>Good Luck! and if you made it all the way to the end, thanks for reading. Leave a comment if you have any questions.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6e65697cb40" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>