<?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 Firas Abdelgadir on Medium]]></title>
        <description><![CDATA[Stories by Firas Abdelgadir on Medium]]></description>
        <link>https://medium.com/@FirasA7?source=rss-094ba2b2f740------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tGN_yvuLsgKd-Ef-EPuDTQ.jpeg</url>
            <title>Stories by Firas Abdelgadir on Medium</title>
            <link>https://medium.com/@FirasA7?source=rss-094ba2b2f740------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:18:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@FirasA7/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[Post-Quantum Cryptography: Implementing Crypto-Agility Against the Harvest Now, Decrypt Later…]]></title>
            <link>https://medium.com/@FirasA7/post-quantum-cryptography-implementing-crypto-agility-against-the-harvest-now-decrypt-later-9e4bbd1b183e?source=rss-094ba2b2f740------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e4bbd1b183e</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Firas Abdelgadir]]></dc:creator>
            <pubDate>Sun, 09 Aug 2026 20:04:54 GMT</pubDate>
            <atom:updated>2026-08-10T22:49:18.138Z</atom:updated>
            <content:encoded><![CDATA[<h3>Post-Quantum Cryptography: Implementing Crypto-Agility Against the Harvest Now, Decrypt Later Strategy</h3><h3>Introduction</h3><p>On June 22, 2026, President Trump signed Executive Order 14412, Securing the Nation Against Advanced Cryptographic Attacks. The order directs federal agencies to transition their most sensitive systems to post-quantum encryption by December 31, 2030, with a follow-on deadline of December 31, 2031, for post-quantum digital signatures. Federal contractors are expected to meet applicable FIPS-based post-quantum standards on the same timeline.</p><p>That’s not a soft “someday” mandate. It’s two hard dates, four and five years out that are attached to systems that governments, contractors, and critical infrastructure operators are running today.</p><p>Although cryptographically relevant quantum computers do not yet exist, organizations are already facing a different problem.</p><p>Adversaries don’t need to decrypt sensitive information today. Instead, they can collect encrypted traffic now, store it for years, and decrypt it once sufficiently capable quantum computers become available.</p><p>This strategy is commonly known as Harvest Now, Decrypt Later (HNDL).</p><p>For government agencies, defense contractors, healthcare providers, and financial institutions, the consequences are significant. Information encrypted today may remain valuable long after it has been transmitted, sometimes for decades.</p><p>While discussions surrounding post-quantum cryptography often focus on new algorithms such as ML-KEM and ML-DSA, migrating an enterprise environment involves much more than replacing one cryptographic algorithm with another. The true challenge lies in building systems capable of adapting as cryptographic standards continue to evolve.</p><p>This concept is known as crypto-agility.</p><h3>Table of contents:</h3><ul><li>Understanding Harvest Now, Decrypt Later</li><li>Why Replacing RSA Is Not Enough</li><li>Crypto-Agility</li><li>Enterprise Solutions</li><li>Building a Simple Quantum-Safe TLS Lab</li><li>The two tools doing the cryptographic work</li><li>Practical Lab:</li></ul><ol><li>Phase 1 — Installing the base toolchain</li><li>Phase 2 — Building liboqs and oqs-provider</li><li>Phase 3 — Configuring OpenSSL to load oqs-provider</li><li>Phase 4 — Creating the Flask application</li><li>Phase 5 — Compiling and installing NGINX</li><li>Phase 6 — End-to-end verification and handshake inspection</li><li>Phase 7 — Capturing the handshakes in Wireshark</li><li>Phase 8 — Measurements and timing</li></ol><ul><li>Lessons Learned</li><li>Conclusion</li><li>References</li></ul><h3>Understanding Harvest Now, Decrypt Later</h3><p>Traditional cyberattacks attempt to compromise encrypted communications in real time.<br>Harvest Now, Decrypt Later changes that strategy entirely.</p><p>Instead of breaking encryption immediately, attackers intercept encrypted communications and archive the data indefinitely. Once large-scale quantum computers become available, previously collected information protected by vulnerable public-key algorithms may become readable.</p><p>Particularly susceptible information includes:</p><ul><li>Classified government communications</li><li>Intellectual property</li><li>Medical records</li><li>Financial transactions</li><li>Critical infrastructure documentation</li><li>Long-term PKI certificates</li></ul><p>Organizations responsible for protecting sensitive information with long confidentiality lifetimes must begin preparing well before practical quantum computers become available. EO14412’s 2030/2031 deadlines are a direct acknowledgment of that math: if it takes years to migrate an enterprise’s cryptographic footprint, the clock has to start well before the threat is imminent, not after.</p><h3>Why Replacing RSA Is Not Enough</h3><p>Many discussions simplify PQC migration into a single step:<br>Replace RSA. Replace ECC. Deploy ML-KEM.</p><p>Unfortunately, it’s not that simple. Enterprise environments are significantly more complex. Modern organizations rely on cryptography throughout their infrastructure for:</p><ul><li>TLS</li><li>VPNs</li><li>SSH</li><li>PKI</li><li>Certificate Authorities</li><li>Identity Providers</li><li>APIs</li><li>Microservices</li><li>Cloud workloads</li><li>Email encryption</li><li>Code signing</li></ul><p>Replacing algorithms across these systems individually is neither practical nor sustainable. Cryptographic standards will continue evolving and the algorithms considered state-of-the-art in 2026 will eventually be replaced, the same way RSA and ECC are being replaced now. Organizations therefore require architectures capable of replacing algorithms without redesigning applications every time standards change.</p><p>This is the foundation of crypto-agility.</p><h3>Crypto-Agility</h3><p>Crypto-agility refers to the ability of systems to adopt new cryptographic algorithms with minimal disruption.</p><p>Instead of embedding cryptographic algorithms directly into application logic, cryptographic operations should be abstracted through configurable layers capable of supporting future algorithms.</p><p>This enables organizations to transition from RSA to ML-KEM today, with the potential to entirely different algorithms tomorrow without rebuilding production applications.<br>Crypto-agility transforms cryptography from a static implementation into a flexible engineering capability.</p><p>There’s a smaller-scale version of this idea playing out in the tooling itself. Early post-quantum TLS support arrived through third-party additions like the Open Quantum Safe project oqsprovider, bolted onto OpenSSL. As of OpenSSL 3.5, ML-KEM support has moved into the core library with no third-party provider required. The industry didn’t rewrite applications to get there; the cryptographic layer underneath quietly absorbed the capability. That’s how crypto-agility is supposed to work, one level down from the enterprise architecture diagrams.</p><h3>Enterprise Solutions</h3><p>Several vendors have begun developing enterprise migration platforms that simplify this transition.</p><p>One example is IBM’s Quantum Safe Remediator, which introduces an adaptive proxy capable of supporting quantum-safe communication without requiring organizations to redesign every application individually.</p><p>Rather than treating PQC as simply replacing cryptographic algorithms, these platforms emphasize:</p><ul><li>Crypto-agility</li><li>Gradual migration</li><li>Asset discovery</li><li>Hybrid cryptography</li><li>Operational continuity</li></ul><p>This represents a much more practical approach for large enterprises than a wholesale swap out of algorithms.</p><h3>Building a Simple Quantum-Safe TLS Lab</h3><p>To better understand how post-quantum cryptography can be introduced into an existing environment, I built a small proof-of-concept using the Open Quantum Safe project, NGINX and Flask, running on an Ubuntu 24.04 VM, with OpenSSL doing the actual cryptographic work underneath. The objective wasn’t a production deployment. It was to observe how<br>quantum-safe TLS could be layered onto an existing web stack, and to critically measure the practical cost of doing so rather than just claiming one exists.</p><p>The finished architecture:</p><p>Browser<br>↓<br>NGINX (TLS terminated via OpenSSL + oqs-provider)<br>↓<br>Flask Web Application (plaintext, internal)</p><p>NGINX terminates TLS using OpenSSL compiled with post-quantum key exchange support, then forwards the decrypted request to the Flask app over the loopback interface. The application itself never touches the cryptography directly — which is the point. Flask doesn’t<br>know or care whether the browser negotiated classical ECDHE or a post-quantum hybrid group; that decision is made entirely in the TLS layer beneath it. That separation is crypto-agility in miniature: swap the key exchange algorithm, and the application layer doesn’t change at all.</p><h3>The two tools doing the cryptographic work</h3><p>Before walking through the build, it’s worth explaining the two pieces of software that are actually doing the math: liboqs and oqs-provider.</p><p>liboqs (short for “Library for Open Quantum Safe”) is an open-source C library maintained by the Open Quantum Safe project. It implements the post-quantum algorithms themselves, with the most relevant one being ML-KEM. It’s the key-encapsulation mechanism NIST standardized for postquantum key exchange, along with ML-DSA for digital signatures. liboqs is deliberately narrow in scope as it knows how to generate a post-quantum keypair and perform the encapsulation/decapsulation math, but it has no concept of TLS, HTTP, or network connections.<br>It’s a cryptographic toolbox, not a networking component.</p><p>oqs-provider is what makes that toolbox usable in the real world. OpenSSL 3.x introduced a “provider” architecture which is a plugin interface that lets new cryptographic algorithms be added without modifying OpenSSL’s own source code. oqs-provider wraps liboqs’s algorithms and<br>exposes them through the interface OpenSSL expects, so that when a TLS handshake asks “which key exchange groups are available?”, OpenSSL can now answer with X25519MLKEM768 alongside the classical groups it already supported, because oqs-provider registered it as an option.</p><p>Neither tool is useful without the other. liboqs contains the math; oqs-provider is the adapter that lets OpenSSL, and by extension every piece of software built on top of it, including NGINX actually use that math. It’s also a small, concrete illustration of crypto-agility in action: OpenSSL’s provider system exists specifically so that new algorithms can be plugged in as modules rather than requiring changes to OpenSSL’s core code or to the applications sitting above it.</p><p>Laid out as a stack, the request path for a single post-quantum key exchange looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*zunFjcj6LyvqkxVU7niWPA.png" /></figure><p>This is the same client-to-math path described above, just made visual: NGINX (or curl, or a browser) only ever talks to OpenSSL. OpenSSL only ever talks to whichever provider registered the requested algorithm. oqs-provider is the only thing that talks to liboqs directly.<br>Each layer only needs to know about the one immediately below it — which is exactly why swapping liboqs for a different post-quantum library later or replacing ML-KEM with whatever NIST standardizes next, wouldn’t require touching NGINX, Flask, or anything above the OpenSSL line.</p><h3>Phase 1 — Installing the base toolchain</h3><p>Everything runs natively on an Ubuntu 24.04.2 LTS VM (VMware Workstation, 4GB RAM,40GB disk — the disk started at 20GB and had to be expanded to 40GB partway through). Base specs were confirmed with free -h , df -h , and lsb_release -a .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*JY-bvbu_wV9Xl_Ar1za5Sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*ZBqhqmCid3zFfjle7wSHag.png" /></figure><p>Then I ran <strong>sudo apt install -y build-essential git cmake ninja-build \ libssl-dev python3 python3-venv python3-pip wireshark curl</strong></p><p>Command breakdown:</p><p><strong>sudo apt install -y build-essential</strong> Installs GCC/G++ compilers and core build utilities (make, etc.) needed to compile C/C++ source code — required for building liboqs and oqs-provider from source in later phases</p><p><strong>git</strong> Version control tool used to clone the liboqs and oqs-provider repositories from GitHub in Phase 1</p><p><strong>cmake</strong> Build-configuration tool that liboqs uses to generate its actual build files before compiling</p><p><strong>ninja-build</strong> A fast build system, used alongside CMake to speed up compilation</p><p><strong>libssl-dev</strong> Development headers for OpenSSL — needed so other software (like oqs-provider) can compile against OpenSSL’s internals</p><p><strong>python3 python3-venv python3-pip</strong> Python interpreter, virtual environment tool, and package manager — needed for your Flask app in Phase 4</p><p><strong>wireshark</strong> Network protocol analyzer — this is what you’ll use in Phase 6/7 to capture and inspect the TLS handshakes</p><p><strong>curl</strong> Command-line tool for making HTTP/HTTPS requests — useful for quick tests against your server later</p><p>After that I ran <strong>sudo usermod -aG wireshark $USER</strong> to add the user account to the wireshark group, granting permission to capture network packets without needing root/sudo every time. Confirmed by running <strong>groups</strong> and seeing wireshark in the output list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*QmQG4EaNRXAWYgVJo7k76A.png" /></figure><h3>Phase 2 — Building liboqs and oqs-provider</h3><p>The first commands that I ran:<br><strong>cd ~</strong><br><strong>git clone — depth 1</strong> clones just the latest snapshot instead of full commit history, saving time and disk space. (two seperate dashes -)</p><p><strong>mkdir -p ~/liboqs/build &amp;&amp; cd ~/liboqs/build </strong>creates a dedicated build folder separate from the source, standard practice for CMake-based projects.</p><p><strong>cmake -GNinja -DBUILD_SHARED_LIBS=ON .. </strong>configures the build to use Ninja and to produce shared libraries ( .so files), which oqs-provider needs to link against later.</p><p><strong>ninja</strong> actually compiles liboqs. This is the step that takes real time, since it’s building every post-quantum algorithm implementation from source.<br>sudo ninja install — installs the compiled library and headers to /usr/local/lib and /usr/local/include so other software can find and link against it.</p><p><strong>sudo ninja install</strong> — installs the compiled library and headers to /usr/local/lib and /usr/local/include so other software can find and link against it.</p><p><strong>sudo ldconfig</strong> refreshes the system’s shared library cache so it recognizes the newlyinstalled library immediately, without a reboot.</p><p>It’s worth pausing here to note what this step actually represents, because it’s easy to read awall of compiler output and miss the significance underneath it.</p><p>Nothing in Phase 2 touches TLS, NGINX, or the Flask application. That’s intentional, and it’s the point. liboqs is the layer that contains the actual post-quantum mathematics and until it exists as a compiled, installed library on the system, nothing further up the stack can use MLKEMat all. Building it is the unglamorous first domino that everything else depends on.</p><p>This also maps directly onto the crypto-agility argument this article opened with. Notice that at no point in this phase did I write, or need to write, a single line of application code. The postquantum capability is being constructed as an independent, swappable layer, entirely separate from the web application it will eventually protect. When a stronger algorithm than ML-KEM inevitably emerges, this is the layer that gets replaced, and the application above it never has to know, and never has to change.</p><p>There’s a broader point here too, for anyone still treating post-quantum cryptography as a distant, theoretical concern. This is open-source software, compilable on an ordinary laptop, sitting one git clone and a handful of build commands away from working. The tooling to<br>begin a post-quantum migration already exists today, freely available, requiring no vendor contract or enterprise procurement cycle to start experimenting with. What some organizations are actually missing isn’t the technology, it’s the inventory, prioritization, and rollout<br>discipline to put that technology to use. That gap, not the cryptography itself, is the real work of migration.</p><p>After that I verified with<strong> ls /usr/local/lib | grep oqs</strong> that liboqs.so , liboqs.so.0.16.0 , and liboqs.so.9 are all present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*llnUSsDkBTAIRrz7hVChbw.png" /></figure><p>Then I ran the following the commands for oqsprovider:</p><p><strong>Cd ~</strong> Return to home directory before cloning the next repo</p><p><strong>git clone — depth 1 </strong><a href="https://github.com/open-quantum-safe/oqs-provider.git"><strong>https://github.com/open-quantum-safe/oqs-provider.git</strong></a> Downloads the oqs-provider source code — the OpenSSL plugin that exposes liboqs’s algorithms (like ML-KEM) to OpenSSL</p><p><strong>cd ~/oqs-provider</strong> Move into the cloned oqs-provider source folder</p><p><strong>mkdir build</strong> Create a dedicated build folder, same pattern as liboqs</p><p><strong>cd build</strong> Move into it</p><p><strong>cmake -GNinja -DCMAKE_PREFIX_PATH=/usr/local .. </strong>Configures the oqs-provider build, pointing it to /usr/local — where we just installed liboqs — so it can find and link against it</p><p><strong>ninja </strong>Compiles oqs-provider itself</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*jlo3Fi8FBf8xYa74JlVsgg.png" /></figure><h3>Phase 3 — Configuring OpenSSL to load oqs-provider</h3><p>With oqsprovider.so sitting on disk, OpenSSL still doesn’t know to load it as it’s controlled by openssl.cnf . First, I had to locate and back up the config through:<br><strong>openssl version -d</strong><br><strong>sudo cp /usr/lib/ssl/openssl.cnf /usr/lib/ssl/openssl.cnf.backup<br>cat /usr/lib/ssl/openssl.cnf</strong><br><strong>grep -n “providers” /usr/lib/ssl/openssl.cnf</strong></p><p>openssl version -d reports OpenSSL’s config directory ( /usr/lib/ssl on this Ubuntu build). The backup means anything that breaks can be reverted instantly. grep -n “providers” /usr/lib/ssl/openssl.cnf showed Ubuntu’s default config already has a [provider_sect] block set up ( providers = provider_sect , default = default_sect ) — the task was just addingoqsprovider as a second entry alongside the default one</p><p>Then I opened the config file with <strong>sudo nano /usr/lib/ssl/openssl.cnf </strong>and added a new oqsprovider entry inside [provider_sect], and a new [oqsprovider_sect] block defining it as active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*CyrnuQ4mLngctXuohMYUmA.png" /></figure><p><strong>oqsprovider = oqsprovider_sect</strong>. This line lives inside<strong> [provider_sect]</strong>, which is OpenSSL’s master list of providers to load on startup. It tells OpenSSL: “there’s a provider named oqsprovider, and its configuration details are defined in a section called oqsprovider_sect.”</p><p><strong>[oqsprovider_sect] / activate = 1</strong>, this is the actual configuration block that line points to. activate = 1 is the instruction that makes OpenSSL load the provider automatically every time it starts, rather than requiring you to manually load it with a command-line flag every single time you use OpenSSL. Without activate = 1, the provider would be known to OpenSSL but not actually running.</p><p>I had to uncomment the activate = 1 for the default_sect as Ubuntu mentions “If you add a section explicitly activating any other provider(s), you most probably need to explicitly activate the default provider, otherwise it becomes unavailable.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*_cWC7kCCUn9WZF09Nlo5oQ.png" /></figure><p>The next step is to verify that ML-KEM is actually available as a usable group.</p><p><strong>openssl list -kem-algorithms</strong> Lists all key encapsulation mechanisms OpenSSL now knows about, including whatever oqsprovider added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*ozJSUDa0ERsm3YMfj42klg.png" /></figure><p>Some of the results I got from the long list that populated from the command. <br><strong>mlkem768 @ oqsprovider</strong> ← pure ML-KEM-768 (non-hybrid, research-only)<br><strong>X25519MLKEM768 @ oqsprovider</strong> ← the hybrid group you’ll actually use in TLS<br><strong>SecP256r1MLKEM768 @ oqsprovider</strong> ← another hybrid variant<br><strong>mlkem512, mlkem1024 @ oqsprovider</strong> ← other security levels</p><h3>Phase 4 — Creating the Flask application</h3><p>With the cryptographic layer built, configured, and verified, this phase shifts focus entirely to the application itself, which is a small Flask web app that will sit behind NGINX. There’s nothing really sophisticated about it, it’s a single route returning a simple confirmation message. That simplicity is the point. This app has no awareness of TLS, no awareness of ML-KEM, no awareness of any of the work done in the previous three phases.</p><p>That separation is the clearest demonstration of this article’s central argument. In a later phase, NGINX will terminate TLS connections using the post-quantum-capable OpenSSL configured earlier, then forward plain HTTP requests to this Flask app. The app will never see a certificate or a key exchange, it will simply receive requests and respond to them, exactly as it would in a codebase with no post-quantum cryptography anywhere in sight. Migrating this system to quantum-safe TLS required zero changes to application code. That gap between “significant cryptographic upgrade” and “zero application changes” is what crypto-agility is supposed to deliver in practice, and this phase is where that promise gets tested against a real, if minimal, application.</p><p>Commands:<br><strong>mkdir ~/quantum-safe-app &amp;&amp; cd ~/quantum-safe-app</strong> Creates a dedicated project folder for the Flask app, separate from the crypto build directories</p><p><strong>python3 -m venv venv</strong> Creates an isolated Python virtual environment, so Flask and its dependencies don’t mix with system-wide Python packages</p><p><strong>source venv/bin/activate</strong> Activates the virtual environment — your terminal prompt will change to show (venv) at the start, confirming you’re inside it</p><p><strong>pip install flask gunicorn</strong> Installs Flask (the web framework) and Gunicorn (a production-grade server to run it, instead of Flask’s built-in dev server)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*rypcnSz4VcVeTiGF1iyaNQ.png" /><figcaption>Installation is clean</figcaption></figure><p>The next step is writing and testing the Flask app.<br>I first opened a new file called app.py in the nano editor, where I’ll write the Flask application code (shout out Claude).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*UOT6ZE6Ca4qV9I-hDEO9YQ.png" /></figure><p>The Flask import brings in the framework, and<strong> app = Flask(__name__)</strong> creates the application instance everything else attaches to. The <a href="http://twitter.com/app"><strong>@app</strong></a><strong>.route(“/”)</strong> decorator registers a handler for the site’s root URL: whenever a request comes in for / , the <strong>home()</strong> function beneath it runs and returns a plain-text response, which is all a visitor to the page will see. The final block, i<strong>f __name__ == “__main__”: app.run(…)</strong> , is a standard Python convention meaning “only start the server if this file is being run directly, not imported elsewhere” and<strong> app.run(host=”127.0.0.1&quot;, port=5000)</strong> starts Flask’s built-in development server, listening<br>exclusively on the local machine at port 5000, rather than being exposed to the network directly. That’s deliberate because in the finished architecture, NGINX will be the component actually facing the browser and the internet and not Flask. Flask only needs to be reachable from NGINX on the same machine.</p><p><strong>python3 app.py</strong> Runs the Flask app directly using its built-in dev server, so we can quickly confirm it works before wiring it up to Gunicorn/NGINX</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*DKrGOB10vHhwVrZvoY5Www.png" /></figure><p>Confirmed working curl returned “Quantum-safe server said wassup”, and the left terminal shows two 200 GET responses logged. Flask app is functioning correctly.</p><p>Next I ran Flask via Gunicorn instead:<br><strong>gunicorn -w 2 -b 127.0.0.1:5000 app:app</strong> Starts the app using Gunicorn instead of Flask’s dev server — -w 2 runs 2 worker processes, -b 127.0.0.1:5000 binds to the same local address/port, and app:app tells Gunicorn to find the app Flask instance inside app.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*Lr9o7ov1knEWcbC-8qpqGg.png" /></figure><p>Confirmed working — Gunicorn started cleanly <strong>(“Starting gunicorn 26.0.0,” “Listening at: </strong><a href="http://127.0.0.1:5000/"><strong>http://127.0.0.1:5000</strong></a><strong>,&quot; two workers booted)</strong>, and the curl on the right returned the same “Quantum-safe server said wassup” response, now served by Gunicorn instead of Flask’s dev server.</p><h3>Phase 5 — Compiling and installing NGINX</h3><p>NGINX was compiled from source rather than installed from Ubuntu’s package, specifically to get explicit control over which TLS groups it offers during a handshake. It links dynamically against the system’s OpenSSL which is the same one oqs-provider was loaded into.Once it’s built, it automatically inherits ML-KEM support with no special wiring.</p><p>I ran:<br><strong> cd ~ &amp;&amp; wget </strong><a href="http://nginx.org/download/nginx-1.30.4.tar.g"><strong>http://nginx.org/download/nginx-1.30.4.tar.</strong></a>gz to download the NGINX’s source code<br><strong>tar xzf nginx-1.27.0.tar.gz &amp;&amp; cd nginx-1.30.0</strong> to extract the archive and move it into the source folder</p><p>The original plan called for NGINX 1.27.0, based on what was current when this project was first scoped, but by the time I reached this phase, stable had moved to 1.30.4. A small reminder that even a few weeks matters in this space.</p><p>I also chose the stable branch over mainline on purpose. Mainline gets new features first but is less battle-tested, stable is what NGINX recommends for production and what a real organization would actually deploy. 1.30.4 also includes a fix for a heap-based buffer overflow disclosed earlier this year which is a good reminder that building from source means you own the version-management responsibility a package manager would otherwise handle for you.</p><p>To configure the Nginx build I ran:</p><p><strong>./configure — with-http_ssl_module</strong> enables the SSL/TLS module, which isn’t included by default, so NGINX can handle HTTPS at all. This also auto-detects and links against the system’s OpenSSL, the one with oqs-provider active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*mPhHYsjyIiqIAPYiC7TnSg.png" /></figure><p>NGINX’s HTTP rewrite module needs the PCRE library (used for regex support in config rules) which is not installed in my system. I installed it through<strong> sudo apt install -y libpcre3-dev libpcre2-dev</strong> and reran the configure command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*kM7duFMZ29MY4PrFwM1o2A.png" /><figcaption>Good to go, confirmed NGINX is linked against the system’s OpenSSL</figcaption></figure><p>After confirmation, I ran:</p><p><strong>make -j2</strong> Compiles NGINX using both CPU cores (-j2)<br><strong> sudo make install</strong> Installs the compiled NGINX binary to the paths shown in the config summary (/usr/local/nginx/…)<br><strong>/usr/local/nginx/sbin/nginx -V</strong> Prints NGINX’s version and build configuration, confirming the SSL module is compiled in and which OpenSSL it’s linked against</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*W-JNLVN_Youz1x9JXtuDEQ.png" /></figure><p>confirmed: nginx version:<br><strong>nginx/1.30.4 , built with OpenSSL 3.0.13 30 Jan 2024 , TLS SNI support enabled , configure arguments: — with-http_ssl_module</strong> <br>the exact confirmation that NGINX is compiled with SSL support and linked against the OpenSSL build that has oqs-provider loaded.</p><p>Next step is to generate a self-signed EC (P-256) certificate for local testing:</p><p><strong>mkdir -p ~/quantum-safe-app/certs &amp;&amp; cd ~/quantum-safe-app/certs</strong> Creates a folder to hold the certificate and key files, keeping them organized with the rest of the project</p><p><strong>openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -keyout key.pem -out cert.pem -days 365 -nodes -subj “/CN=localhost”</strong></p><ul><li><strong>x509</strong> creates a self-signed cert directly (fine for a local lab, not for production).<br><strong>-newkey ec -pkeyopt ec_paramgen_curve:P-256</strong> generates a new elliptic-curve key on the P-256 curve.<br><strong>-days 365</strong> sets a one-year validity window.<br><strong>-nodes</strong> skips password-protecting the private key, for simplicity.<br><strong>-subj “/CN=localhost”</strong> sets the certificate’s identity to “localhost,” matching what’s being tested against.</li></ul><p>The certificate itself doesn’t need to be post-quantum for this lab; we’re specifically testing the TLS key exchange (ML-KEM), not certificate signatures (that would be ML-DSA, a separate post-quantum migration).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*KuUNAYyS_4KPkFd6eURelQ.png" /></figure><p>Files have landed. Both cert.pem (574 bytes) and key.pem (241 bytes) are present, correct sizes for a small P-256 EC cert/key pair.</p><p>The final NGINX config, edited with:</p><p><strong>sudo nano /usr/local/nginx/conf/nginx.conf</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*gFIS-D08iQj3wrV5aopF0w.png" /></figure><p><strong>The server block</strong> listens for HTTPS on port 443 using the certificate and key just generated.<br><strong>ssl_protocols TLSv1.3</strong> restricts the server to TLS 1.3, the version where these key exchange groups apply. <br><strong>ssl_conf_command Groups</strong> is the line doing the real work, it explicitly tells<br>NGINX which key exchange group(s) to offer during the handshake, and it’s what gets toggled between <strong>x25519; (classical baseline)</strong> and <strong>X25519MLKEM768:x25519; (hybrid, with classical fallback)</strong> for the comparison in Phase 6. <br><strong>The location block</strong> defines the reverse-proxy behavior: any request reaching NGINX gets forwarded to Flask on 127.0.0.1:5000, with the original hostname preserved in the headers. Everything above the location is NGINX’s job; everything inside it hands off to Flask, which has no idea any of this cryptography exists.</p><p>To test the config file syntax without actually starting NGINX, I ran:<br><strong>sudo /usr/local/nginx/sbin/nginx -t</strong> catches typos/errors before going live</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*eApLA9qfZobANn4HGhhApg.png" /></figure><p>The error occurred because there’s leftover content from the original default config still sitting below what I edited, specifically an error_page directive that’s now outside the block it’s supposed to be in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*YLCK6phQD_joBJY-WmT-HQ.png" /></figure><p>Went back to the file and deleted everything under line 35. The http block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*LFGb_IH4-rOy8km2RAPBLA.png" /><figcaption>Good to go</figcaption></figure><p><strong>sudo /usr/local/nginx/sbin/nginx</strong> Starts NGINX using the validated config<br><strong>ps aux | grep nginx</strong> Confirms NGINX processes are actually running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*ACubzI8kujdVsdoiTDH5wQ.png" /></figure><p>NGINX is up and running, master process (root) and worker process (nobody) both present. Phase is complete.</p><h3>Phase 6 — End-to-end verification and handshake inspection</h3><p>With NGINX up and running, and Flask still listening in the background through Gunicorn, the full chain is finally in place. Browser, or in this case curl, connects over HTTPS to NGINX, which terminates the TLS handshake using the certificate and key generated earlier, then forwards the decrypted request to Flask. This phase is simply confirming that the chain actually works end to end before moving into the comparison which is the goal of the whole lab. A successful response here, which would be the same plain text message defined back in Phase 3, now arriving over an encrypted connection means every layer built so far is wired together correctly. Then it’s safe to move on to the part that actually matters, comparing what this handshake looks like under classical versus post-quantum key exchange.</p><p><strong>curl -k </strong><a href="https://localhost/"><strong>https://localhost/</strong></a><strong> </strong>Tests the full path: browser-equivalent HTTPS request → NGINX → Flask, confirming the app responds correctly over TLS. -k skips certificate validation since it’s self-signed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*lJ-EJ9BVB-6Ao047yfHAeQ.png" /></figure><p>The first attempt returned 502 Bad Gateway . NGINX’s error log (<strong> sudo tail -20 /usr/local/nginx/logs/error.log </strong>) showed the real cause: <strong>connect() failed (111: Connection refused) while connecting to upstream… upstream: “</strong><a href="http://127.0.0.1:5000/"><strong>http://127.0.0.1:5000/</strong></a><strong>&quot;.</strong> NGINX was trying to reach Gunicorn and getting refused. <strong>ps aux | grep gunicorn</strong> confirmed nothing was<br>listening on port 5000 at all; Gunicorn had died, which traced back to the missing<strong> — daemon</strong> flag from Phase 4. Restarting it with <strong>— daemon</strong> and confirming three Gunicorn processes running (<strong> ps aux | grep gunicorn</strong> ) fixed it, <strong>curl -k </strong><a href="https://localhost/"><strong>https://localhost/</strong></a><strong> </strong>then returned “Quantum-safe server said wassup” cleanly, and it was safe to move on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*VEh6JQOb_uFt-RhEH6Oyag.png" /></figure><p>With the full chain confirmed working,now we move from “does it function” to “what is it actually doing.” Up to this point, every configuration choice has been taken on faith that it’s working as intended. Using openssl s_client to connect directly to the server and inspect the handshake makes that verifiable rather than assumed, it shows exactly which key exchange group NGINX and the client agreed on, providing the first concrete data point for the comparison this article is building toward. This is also the baseline measurement as confirming the classical configuration genuinely negotiates X25519 before any post-quantum group is introduced, so the later hybrid comparison has something real to compare against.</p><p><strong>echo | openssl s_client -connect localhost:443 -groups x25519</strong></p><p>Classical baseline: <strong>Server Temp Key: X25519, 253 bits , Protocol: TLSv1.3 , Cipher: TLS_AES_256_GCM_SHA384</strong>, a clean TLS 1.3 handshake using only the classical key exchange.<br>Handshake accounting: <strong>read 755 bytes, written 355 bytes</strong>. (The Verification error: selfsigned certificate message is expected and harmless as OpenSSL flagging the untrusted selfsigned cert, which is normal for a lab environment.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*mNzTpmzwXdQ4YDXSejx6RA.png" /></figure><p>After that I changed the ss_conf_command Groups in config file to run the same test on the hybrid ML-KEM group. <br><strong>echo | openssl s_client -connect localhost:443 -groups X25519MLKEM768</strong><br>Connects to NGINX as a TLS client, explicitly requesting the hybrid ML-KEM group, then prints the full handshake details so we can confirm which group was actually negotiated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*ro0E1p_QRX6gwKSt_7uF8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*tfoq1qsswli8qcNUbsp8MQ.png" /></figure><p>Hybrid: handshake succeeded, <strong>Protocol: TLSv1.3 , Cipher: TLS_AES_256_GCM_SHA384</strong>, but no Server Temp Key line printed this time. This turned out to be a tooling gap rather than a failure:<br>OpenSSL 3.0.13 predates OpenSSL’s native ML-KEM support, and its <strong>s_client</strong> display logic doesn’t know how to label a key type introduced by a third-party provider like oqs-provider.<br>The byte counts told the real story regardless: handshake read grew to <strong>1,844 bytes</strong>, written to <strong>1,531</strong> bytes which is roughly 2.4x and 4.3x the classical baseline, consistent with the extra key material ML-KEM-768 contributes to the exchange.</p><p>To confirm the group was actually being used despite the missing label:</p><p><strong>echo | openssl s_client -connect localhost:443 -groups X25519MLKEM768 -debug 2&gt;&amp;1 | head -60</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*WyEQZ4g39TH_AFIJ8lGJXw.png" /></figure><p>The raw debug output showed <strong>write to 0x5e889fade5d0 [0x5e889fbb9ec0] (1451 bytes =&gt; 1451 (0x5AB))</strong>, the raw ClientHello NGINX sent <strong>1,451 bytes</strong>. A classical-only ClientHello (just X25519) is typically only a few hundred bytes; a ClientHello this large is strong direct evidence it’s carrying the much larger ML-KEM-768 public key material in its key_share extension, genuinely useful raw data, just not human-labeled by this OpenSSL version.</p><p>It’s worth mentioning that tooling gaps like this are a real, common part of working at the edge of post-quantum adoption right now. The cryptography<br>itself works, the display and diagnostic layer built around it hasn’t fully caught up. That’s a small, concrete example of exactly the kind of friction organizations should expect during migration, not because the algorithms are unready, but because the surrounding tooling ecosystem is still maturing around them.</p><h3>Phase 7 — Capturing the handshakes in Wireshark</h3><p>This phase captures the actual handshakes on the wire using Wireshark, giving a direct, visual comparison between the classical and hybrid configurations rather than relying on OpenSSL’s interpretation of them. As noted at the outset of this project, TLS 1.3’s ClientHello and ServerHello messages are sent in plaintext, the key_share extension, carrying the real key exchange material is visible in a packet capture without any decryption setup. That’s what makes this phase the most concrete evidence in the entire lab: not a claim about what the postquantum handshake looks like, but the actual bytes it sent.</p><p><strong>sudo tshark -i lo -w ~/quantum-safe-app/hybrid.pcap -f “tcp port 443” &amp;</strong><br>Starts a background packet capture on the loopback interface, filtered to TLS traffic on port 443, saving to hybrid.pcap. The trailing &amp; runs it in the background so the terminal stays usable</p><p><strong>sleep 2</strong> Pauses 2 seconds to give tshark time to initialize before generating traffic</p><p><strong>curl -k </strong><a href="https://localhost/"><strong>https://localhost/</strong></a> Triggers an actual TLS handshake against NGINX (currently running the hybrid config), which tshark captures</p><p><strong>sudo pkill tshark </strong>Stops the background capture once the handshake has been recorded<br>Note: I had to install tshark separately</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*uocoCfFEBUjrs3eK1MH1Mg.png" /><figcaption>Captured traffic for the ML-KEM encrypted handshake</figcaption></figure><p>Now I will go back in the file to switch back to classical-only for the baseline capture</p><p>Commands were repeated with classical.pcap instead of hybrid.pcap</p><h4>Wireshark captures</h4><p><strong>wireshark ~/quantum-safe-app/classical.pcap &amp;</strong><br>Opens the classical handshake capture in Wireshark’s graphical interface, running in the background so the terminal stays usable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*8XFcjDy2SnIHDTil4HhLbg.png" /></figure><p><strong>wireshark ~/quantum-safe-app/hybrid.pcap &amp;</strong> to view the ML-KEM encrypted capture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*W9hsYM2tRJizTkKGeYlG6Q.png" /></figure><p>The ML-KEM captured handshake is the same size, will have to troubleshoot…</p><p>The first hybrid capture, made using curl as the client, produced a ClientHello identical in size to the classical baseline (583 bytes both). That result would have suggested the post-quantum configuration wasn’t working at all. It was working; the client simply hadn’t been told to ask for it. NGINX’s config controls what the server is willing to accept, it says nothing about what the client actually requests in its ClientHello, and curl’s default TLS behavior doesn’t request non-default<br>groups regardless of server configuration.</p><p><strong>echo | openssl s_client -connect localhost:443 -groups X25519MLKEM768 &gt; /dev/null 2&gt;&amp;1</strong><br>Connected using openssl s_client instead of curl, explicitly forcing the client to request the hybrid group. This was the actual fix, since curl’s default TLS behavior doesn’t request non-default groups regardless of what the server is configured to accept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7KdnD2TU1bE7KnvULtjygw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*vb_bWTBgORz0m42MuUvuHQ.png" /><figcaption><strong>Hybrid Final</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*HSC9Cm07nFwzJxIHKueh0A.png" /><figcaption><strong>Classical Final</strong></figcaption></figure><p>Both captures were opened in Wireshark’s GUI ( wireshark ~/quantum-safe-app/classical.pcap &amp; / hybrid.pcap &amp; ) and filtered on<strong> tls.handshake.type == 1</strong> to isolate the ClientHello frame. The final, screenshot-backed numbers:</p><p><strong>Classical ClientHello</strong>: 583 bytes<br><strong>Hybrid ClientHello</strong>: 1,517 bytes<br>Difference: +934 bytes (~2.6x larger) — consistent with ML-KEM-768’s public key size (~1,184 bytes) layered alongside the existing X25519 share</p><p>There’s a lesson here that goes beyond a single misconfigured test: crypto-agility isn’t only a server-side property. A server correctly configured for post-quantum key exchange is only half the equation if the clients connecting to it never ask for it. Migration, in practice, has to account for both ends of every connection, not just the one an organization directly controls.</p><h3>Phase 8 — Measurements and timing</h3><p>With both configurations captured, the comparison came down to numbers pulled directly from the data, both configurations were timed using the same openssl s_client connection, run back-to-back under identical conditions, repeated three times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*iYxhOeZSxRv23_dk0CHs0w.png" /></figure><p>Final results, consistent across all three runs: classical ~0.136–0.139s real time; hybrid ~0.135–0.138s real time — a difference of roughly one millisecond, negligible and within noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*cZgZHlUmddBxuFFZon90JA.png" /></figure><p>Two independent tools, a packet capture and OpenSSL’s own handshake accounting, arrived at the same conclusion: the hybrid handshake is doing real, additional work, and that work is concentrated almost entirely in the key exchange material.</p><p>On a local loopback connection, the extra 934 bytes of key material produced no measurable latency cost. That result deserves a caveat rather than a headline: this was a connection with no real network path, so it says little about latency over the open internet, where additional round-trip bytes do cost real, measurable time. What it does establish cleanly is that the overhead this migration introduces lives on the wire, not in local cryptographic computation which is a different cost profile than many assume before actually measuring it.</p><h3>Lessons Learned</h3><p>The biggest takeaway from this project was that post-quantum migration is not primarily a Cryptography problem. It is an engineering problem and, having now measured it directly, a genuinely quantifiable one.</p><p>In this environment, the hybrid ML-KEM handshake’s ClientHello grew from 583 bytes to 1,517 bytes over the classical-only handshake. That’s an increase of 934 bytes, consistent with the size of the ML-KEM-768 public key layered alongside the existing X25519 share. OpenSSL’s own handshake accounting told the same story through an independent measurement: total bytes read grew from 755 to 1,844, and bytes written grew from 355 to 1,531. Two different tools, measuring two different things, arrived at the same conclusion: the hybrid handshake is doing real, additional work, and that work is concentrated almost entirely in the key exchange<br>material itself.</p><p>What didn’t grow, at least not measurably, was time. Across repeated runs, classical and hybrid handshakes completed within roughly a millisecond of each other on a local connection. That result comes with an important caveat: this was a loopback connection with no real network<br>path, so it says little about latency over the open internet, where hundreds of additional bytes do cost real, measurable round-trip time. But it does isolate something useful, the computational cost of ML-KEM’s key generation and encapsulation, independent of network<br>effects, is not where this migration’s overhead lives. The overhead lives on the wire, not in the CPU.</p><p>There’s a second lesson here, less about cryptography and more about the tooling surrounding it. An early attempt at capturing the hybrid handshake produced a ClientHello identical in size to the classical baseline, a result that would have suggested the postquantum configuration wasn’t working at all. However, it was working; the client making the request<br>simply hadn’t been told to ask for it. NGINX’s configuration controls what a server is willing to accept, not what a client chooses to offer, and curl’s default TLS behavior doesn’t request non-default groups regardless of server configuration. That’s a small technical detail, but it points at something larger: crypto-agility isn’t only a server-side property. A server correctly configured for post-quantum key exchange is only half the equation if the clients connecting to it never asks for it. Migration, in practice, has to account for both ends of every connection, not<br>just the one an organization directly controls.</p><p>None of this required rewriting the Flask application built earlier in the lab. That application never touched TLS, never referenced a group name, and never needed to change across any of these tests. The entire post-quantum transition happened in configuration, a handful of lines in an OpenSSL config file, a single directive in an NGINX server block. That’s the practical<br>shape crypto-agility takes when it’s built correctly.</p><p>Organizations preparing for the deadlines set out in EO 14412 will face far more complexity than this lab did, more endpoints, more legacy systems, more clients they don’t control. But the core finding holds at any scale: the algorithms themselves, once the surrounding architecture is ready for them, are close to the easiest part. The real work is inventory, prioritization, and making sure both ends of every connection are actually asking for the protection that’s already available.</p><h3>Conclusion</h3><p>Quantum computers capable of breaking today’s public-key cryptography may still be years away. However, Executive Order 14412 has already put firm dates on how long organizations have to prepare: December 31, 2030 for key establishment, December 31, 2031 for digital signatures, and those dates reflect a real constraint: migrations like the one sketched out in this lab take time to plan, test, and roll out, even when the underlying technology already exists and runs on an ordinary laptop.</p><p>The Harvest Now, Decrypt Later strategy has already shifted the threat landscape, making proactive planning is essential rather than optional.</p><p>Post-quantum cryptography represents more than a new family of algorithms. It represents an opportunity to build resilient, crypto-agile systems capable of adapting to future advances in both cryptography and computing ,and, as this lab demonstrated with real, measured<br>numbers rather than assumptions, that adaptation can be as small as a configuration change once the underlying architecture is ready for it. The 934 extra bytes in a ClientHello are a real cost. They are also, on the evidence gathered here, a remarkably small price for closing a door<br>that adversaries are already trying to walk through.</p><h3>References</h3><p>Executive Order 14412 — <a href="https://www.whitehouse.gov/presidential-actions/2026/06/securing-the-nation-against-advanced-cryptographic-attacks/">https://www.whitehouse.gov/presidential-actions/2026/06/securing-the-nation-against-advanced-cryptographic-attacks/</a></p><p>NIST FIPS 203 (ML-KEM) — <a href="https://csrc.nist.gov/pubs/fips/203/final">FIPS 203, Module-Lattice-Based Key-Encapsulation Mechanism Standard | CSRC</a></p><p>NIST FIPS 204 (ML-DSA) — <a href="https://csrc.nist.gov/pubs/fips/204/final">FIPS 204, Module-Lattice-Based Digital Signature Standard | CSRC</a></p><p>Open Quantum Safe — liboqs (GitHub) — <a href="https://github.com/open-quantum-safe/liboqs">https://github.com/open-quantum-safe/liboqs</a></p><p>Open Quantum Safe — oqs-provider (GitHub) — <a href="https://github.com/open-quantum-safe/oqs-provider">https://github.com/open-quantum-safe/oqs-provider</a></p><p>NGINX — official project site — <a href="https://nginx.org/">https://nginx.org</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e4bbd1b183e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Nessus Findings to STIG Compliance: A DoD-style Vulnerability Assessment Lab]]></title>
            <link>https://medium.com/@FirasA7/from-nessus-findings-to-stig-compliance-a-dod-style-vulnerability-assessment-lab-0bd33077ceee?source=rss-094ba2b2f740------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bd33077ceee</guid>
            <category><![CDATA[compliance]]></category>
            <category><![CDATA[vulnerability-assessment]]></category>
            <category><![CDATA[grc]]></category>
            <category><![CDATA[us-dept-of-defense]]></category>
            <category><![CDATA[nessus]]></category>
            <dc:creator><![CDATA[Firas Abdelgadir]]></dc:creator>
            <pubDate>Mon, 25 Aug 2025 03:13:01 GMT</pubDate>
            <atom:updated>2025-08-25T14:28:15.229Z</atom:updated>
            <content:encoded><![CDATA[<p>As I’m preparing to start my career in Gov-tech and utilize my clearance in secure environments, I began exploring STIGs, RMF controls, NIST 800–53 frameworks and POA&amp;Ms to familiarize myself with compliance regarding DoD policies and guidelines.</p><p>Throughout this lab, I set up a vulnerability assessment environment to simulate how DoD assessors and Security Control Assessors (SCAs) approach findings. Using <strong>Nessus Essentials</strong>, <strong>STIG Viewer</strong>, and the <strong>Windows 11 STIG library</strong>, I identified, remediated, and validated an SMB Signing vulnerability. I then documented the issue in POA&amp;M format and tied the workflow back to RMF steps.</p><h3>Table of contents</h3><ul><li>Introduction</li><li>Lab set up and installations</li><li>Assessment process</li><li>POA&amp;M entry (before remediation)</li><li>Remediation and validation</li><li>RMF tie in</li><li>Conclusion</li></ul><h3>What are STIGs?</h3><p>Security Technical Implementation Guides (STIGs) are configuration standards developed by the Defense Information Systems Agency (DISA) to secure Department of Defense (DoD) systems and networks. They define how operating systems, applications, and devices must be configured to minimize vulnerabilities and ensure compliance with the Risk Management Framework (RMF). They safeguard the Department of Defense (DoD) IT network and systems, and complying with STIGs is a requirement for DoD agencies or any organization that is part of the DoD Information Network. Since these environments handle highly sensitive and classified information, these standards ensure that security is prioritized over usability, which differs from most default vendor configurations.</p><p>Each STIG rule is assigned a severity category, which helps prioritize remediation. They range from CAT I (critical), CAT II (significant) to CAT III (moderate). Throughout this lab I will be remediating a vulnerability that is categorized as CAT II after discovering it on my Windows machine.</p><h3>Lab set up and installation</h3><p>To simulate a real-world DoD-style compliance assessment, I built a lab environment using both open-source and DoD-provided tools. This environment allowed me to walk through the end-to-end assessment process, from identifying vulnerabilities against STIG baselines to documenting remediation and tying results back to RMF.</p><h4>Tools installed:</h4><p><strong>STIG Viewer 3.5.1</strong></p><ul><li>A DoD-provided tool used to view and edit .ckl (Checklist) files that represent STIG requirements. I Installed it on my Windows 11 host machine from the DoD cyber exchange public website.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ejl8YMtMAA-r_DOLtFL82w.png" /></figure><ul><li>I also installed the <strong>full STIG Library (July 2025 release) </strong>from the same website. It contains hundreds of baselines for operating systems, applications, and network devices.</li><li>As you can see on the picture below, The STIG Library is distributed as compressed ZIP files. Each contains XML-based STIG content (benchmarks and checklists) for operating systems, applications, and network devices. These XML files are what STIG Viewer parses to present the rules and allow you to document compliance.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e8wwrVdlCFmUBWWlSJdsQ.png" /></figure><p><strong>Nessus Essentials</strong></p><ul><li>Installed on a Kali Linux virtual machine running in VMware Workstation.</li><li>Used Nessus Essentials for vulnerability scanning against my Windows host system.</li><li>Although it’s limited compared to Nessus Professional, Essentials allowed me to identify findings (such as missing SMB signing) and validate remediation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ULPAeHIk9I3rQbj6AnEWw.png" /></figure><p><strong>Windows Registry Editor (Host PC)</strong></p><ul><li>Used to directly configure the registry key RequireSecuritySignature under:<br> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters</li><li>This was critical to testing the STIG requirement for mandatory SMB signing.</li></ul><h3>Assessment process</h3><p>With the lab fully set up, I moved into the assessment phase, which involved scanning my Windows host system, identifying a STIG violation, and documenting the results. This mirrored the workflow a Security Control Assessor (SCA) or DoD assessor would follow.</p><h4><strong>Step 1: Running a Nessus Scan</strong></h4><ul><li>I used <strong>Nessus Essentials</strong> on my Kali Linux VM to run a scan on my Windows 11 host system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqea_URH1oeOBn0RMOIjpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*pooRAL-nNG-_w-Jw_lzLkA.png" /></figure><ul><li>Nessus identified several informational findings and one medium-severity vulnerability:<br> <strong>“SMB Signing not required” (Plugin ID: 57608)</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmJk-YdoD1W8AKnZpC4hlA.png" /></figure><p><strong>SMB (Server Message Block)</strong> is the Windows protocol for file sharing, printer sharing, etc. (Port 445/TCP).</p><p>The finding says: <em>your SMB service does not require message signing</em>.<br>Without signing, attackers on the same network can launch <strong>man-in-the-middle (MitM)</strong> attacks by altering or replaying SMB messages.</p><h4>What SMB signing changes</h4><ul><li><strong>SMB signing</strong> forces Windows to cryptographically sign all SMB (file sharing, printer sharing, domain communication) traffic.</li><li>This protects against <strong>man-in-the-middle attacks</strong> where an attacker intercepts or tampers with SMB sessions.</li><li>Without signing, SMB is faster but less secure.</li></ul><p>In DOD environments, STIGS emphasize security more than usability, which is only logical since these environments work with classified/sensitive information.</p><h4><strong>Step 2: Mapping Nessus Findings to STIGs</strong></h4><p>To validate the vulnerability against DoD security requirements, I searched my <strong>STIG Library</strong> for the relevant rule. Since I’m using a Windows device, I found it on:</p><p><strong>STIG</strong>: Microsoft Windows 11, Ver 2, Rel 4 (dated July 2025).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wXfFZBvqYu6CLuOur3h-Rw.png" /></figure><p><strong>Rule Title</strong>: <em>The Windows SMB server must be configured to always perform SMB packet signing.</em></p><p><strong>Rule ID</strong>: <strong>SV-253451r958908</strong></p><p><strong>STIG ID</strong>: <strong>WN11-SO-000120</strong></p><p><strong>Severity</strong>: <strong>CAT II</strong> (serious, but not the absolute highest severity).</p><p><strong>Check Text</strong>: It points you exactly to the registry hive and key (RequireSecuritySignature) that must be set to 1.</p><p><strong>Fix Text</strong>: Recommends enabling via Group Policy or directly in registry.</p><h4><strong>Step 3: Documenting the Initial Finding</strong></h4><ul><li>In <strong>STIG Viewer</strong>, I created a new checklist for my Windows 11 system.</li><li>For Rule <strong>V-253451</strong>, I marked the finding as <strong>“Open”</strong>, documenting the Nessus output and the registry path (RequireSecuritySignature) that needed to be fixed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5tsTuip1-UDgYiAjCJmeZw.png" /></figure><ul><li>At this stage, this finding would also go into a <strong>Plan of Action &amp; Milestones (POA&amp;M)</strong> entry, capturing the risk, planned remediation, and expected completion date.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Dp1QseDLfpQtx8fAyTYSVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*-qWeCK60CiakK2HPMlPxqg.png" /></figure><h3>Remediation and Validation</h3><p>Once the vulnerability was documented in the POA&amp;M, the next step was to remediate it. In this lab, the focus was on enforcing <strong>SMB Signing</strong> on a Windows 11 host to address the STIG finding (<strong>STIG ID: WN11-SO-000120</strong>).</p><h4>Step 1: Registry Modification</h4><p>Since the host was running Windows 11 (non-Enterprise), the Group Policy Editor (gpedit.msc) was unavailable. Therefore, the registry was edited directly through registry editor (regedit):</p><p>First registry path:</p><p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManWorkstation\Parameters</p><p><strong>Key Modified:</strong> RequireSecuritySignature ,</p><p><strong>Value Changed:</strong> 0 → 1 (to enforce SMB signing)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wCrur4F327CeM91MPXZE9g.png" /></figure><p>Second registry path:</p><p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters</p><p><strong>Key Modified:</strong> RequireSecuritySignature , EnableSecuritySignature</p><p><strong>Value Changed:</strong> 0 → 1 (to enforce SMB signing)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cb3lgsbsziTLxlueWE0pGQ.png" /></figure><p>This change forces the SMB server and workstation to require digital signing of SMB packets, mitigating the risk of man-in-the-middle (MITM) attacks on SMB traffic.</p><h4>Step 2: Restarting Services</h4><p>Instead of rebooting the machine, the change was applied by restarting the relevant Windows services from an elevated Command Prompt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3F3oTFxdBygmcGoKbUbKA.png" /></figure><p>This ensured the new registry policy was active immediately.</p><h4>Step 3: Validation with Nessus</h4><p>After the change, Nessus Essentials was used to rescan the host</p><p><strong>Before Remediation:</strong></p><ul><li>Vulnerability: <strong>SMB Signing not required</strong></li><li>Severity: <strong>Medium (CAT II)</strong></li><li>Plugin ID: <strong>57608</strong></li></ul><p><strong>After Remediation:</strong></p><ul><li>Nessus no longer flagged the finding.</li><li>The vulnerability status was cleared, demonstrating that SMB signing was successfully enforced.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*kGItx_YpQMR5QrO8A7irfg.png" /></figure><h4>Step 4: Validation in STIG Viewer</h4><p>The same rule (<strong>V-253451</strong>) was then marked as <strong>“Not a Finding”</strong> within STIG Viewer. This closed the loop between vulnerability scanning (Nessus), remediation (registry change), and compliance validation (STIG Viewer).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fU_boiJ3MUOPG8fsgVdNAg.png" /></figure><h3>RMF tie in</h3><h4>Step 1: Categorize</h4><ul><li>The system (in this case, my Windows host in the lab) was categorized based on the type of information it handles.</li><li>Under the RMF, categorization is done using <strong>FIPS 199</strong> (Federal Information Processing Standards), which defines impact levels for <strong>Confidentiality, Integrity, and Availability (CIA)</strong>.</li><li>Even though this was a personal lab, the simulated categorization would assume at least a <strong>Moderate</strong> impact for confidentiality and integrity, since enabling/disabling SMB signing directly affects whether an attacker could perform <strong>man-in-the-middle attacks</strong> on sensitive communications.</li><li>This step sets the stage for selecting the proper STIG controls and NIST mappings (which then happens in Step 2).</li></ul><h4>Step 2: Select Controls</h4><ul><li>The Windows 11 STIG control <strong>WN11-SO-000120 (SMB Signing required)</strong> was selected from the full STIG library.</li><li>This mapped to NIST 800–53 controls such as <strong>SC-8 (Transmission Integrity)</strong> and <strong>IA-2 (Authentication and Identification)</strong>.</li></ul><h4>Step 3: Implement</h4><ul><li>I enforced the control by modifying the registry key RequireSecuritySignature=1 on my Windows host.</li><li>This represented the actual technical implementation of the STIG requirement.</li></ul><h4>Step 4: Assess</h4><ul><li>Nessus Essentials was used to scan the system before and after remediation.</li><li>The initial scan documented the finding (“SMB Signing not required”), and the follow-up scan validated that the issue was resolved.</li><li>In STIG Viewer, the corresponding rule was updated from <strong>“Open”</strong> to <strong>“Not a Finding.”</strong></li></ul><h4>Step 5: Authorize</h4><ul><li>In a DoD production environment, the initial finding would be entered into <strong>eMASS</strong> as a POA&amp;M.</li><li>Once remediated and validated, the POA&amp;M would be closed, strengthening the system’s package toward achieving an <strong>Authority to Operate (ATO)</strong>.</li></ul><h4>Step 6: Monitor</h4><ul><li>Continuous vulnerability scanning (using tools like Nessus, ACAS, or HBSS) would ensure that the SMB signing setting remains enforced and that the system does not drift back out of compliance.</li></ul><h3>Conclusion</h3><p>This lab gave me an opportunity to walk through the full lifecycle of identifying, remediating, and validating a security control using DoD standards. By combining <strong>STIG Viewer</strong>, the <strong>STIG library</strong>, and <strong>Nessus Essentials</strong>, I was able to simulate the same workflows that Security Control Assessors (SCAs) use in real-world environments.</p><p>The exercise reinforced several key lessons:</p><ul><li><strong>STIGs are prescriptive</strong>: they don’t just tell you “what’s wrong,” they provide clear <strong>check text</strong> and <strong>fix text</strong> that guide remediation.</li><li><strong>Automation tools accelerate compliance</strong>: Nessus scans allowed me to validate the registry change quickly, showing how vulnerability management ties directly into RMF’s <em>Assess</em> and <em>Monitor</em> phases.</li><li><strong>Documentation matters</strong>: creating a POA&amp;M entry, updating the STIG Viewer to “Not a Finding,” and tying it all back to RMF controls demonstrated the importance of reporting and traceability in DoD compliance.</li></ul><p>While this was a small-scale lab on a personal system, the same principles apply at enterprise scale across the Department of Defense Information Network (DoDIN). Whether remediating SMB signing or enforcing multifactor authentication, the process of <strong>Select → Implement → Assess → Authorize → Monitor</strong> remains the same.</p><p>Ultimately, this lab helped me bridge the gap between theory and practice. I not only gained hands-on experience with STIG compliance and vulnerability scanning but also learned how to present the results in a structured way that aligns with DoD assessment standards. This type of exercise will serve me well in future roles, particularly as I prepare for responsibilities that involve <strong>STIG reviews, Nessus/ACAS scans, eMASS documentation, and RMF assessments</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bd33077ceee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Splunk SIEM Environment for Log Monitoring and Threat Detection]]></title>
            <link>https://medium.com/@FirasA7/building-a-splunk-siem-environment-for-log-monitoring-and-threat-detection-8266b592b42c?source=rss-094ba2b2f740------2</link>
            <guid isPermaLink="false">https://medium.com/p/8266b592b42c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[splunk]]></category>
            <category><![CDATA[analyst]]></category>
            <dc:creator><![CDATA[Firas Abdelgadir]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 19:30:03 GMT</pubDate>
            <atom:updated>2025-04-28T17:15:32.276Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>As an aspiring Security Operations Center (SOC) Analyst, I understand the critical role of real-time monitoring and data analysis in mitigating security threats. This project allowed me to dive deep in the hands-on process of setting up and managing a Splunk SIEM (Security Information and Event Management) environment. By deploying Splunk Enterprise and configuring log forwarders across multiple servers, I gained valuable experience in centralizing log data, setting up indexes, applying advanced queries, creating actionable dashboards, and enhancing overall visibility into network activities. The result was a comprehensive solution that streamlined incident detection and improved response readiness.</p><h3>Table of contents</h3><ul><li>Project overview</li><li>What is Splunk?</li><li>Setting up Splunk Enterprise</li><li>Configuring forwarders</li><li>Creating the index</li><li>Building the dashboards</li><li>Challenges</li><li>Key takeaways</li><li>conclusion</li><li>New Additions</li></ul><h3>Project Overview</h3><p>The goal of this project was to design and implement a Splunk-based SIEM solution to monitor and analyze server logs effectively. I was provided with <strong>three real-life Ubuntu servers</strong> to configure and manage as part of this project. My focus was to centralize logs from all servers into a Splunk Enterprise environment, develop dashboards for real-time analysis, and apply queries to extract meaningful insights for identifying patterns, anomalies, and potential threats.</p><h3>What is Splunk?</h3><p>Splunk is a powerful data platform used to collect, analyze, and visualize machine-generated data in real time. It is widely employed for log monitoring, troubleshooting, and security analysis. In this project, Splunk played a critical role as a centralized log monitoring solution. By aggregating logs from multiple servers, Splunk enabled the detection of unauthorized access attempts, traffic anomalies, and other suspicious behaviors.</p><h3>Step 1: Setting Up Splunk Enterprise</h3><p>The first step was installing <strong>Splunk Enterprise</strong> on one of the servers (Server 2) to act as the central SIEM solution using the <strong>wget. </strong>I was able to get the installation link from <a href="http://www.splunk.com/">www.splunk.com</a></p><ul><li>Initially, I attempted to set up Splunk on a virtual machine, but this approach failed because the VM’s IP was not public, and the servers could not forward their logs.</li><li>Instead, I installed Splunk Enterprise directly on <strong>Server 2</strong> using the official .deb installation package. I configured it to listen for logs on <strong>port 9997</strong> and ensured Splunk would start at boot. The following installation screenshots will be from the VM process; however, I repeated the same exact steps on the actual server that I used as the central server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kuCB-7N_MMj6F2zdUPuMrg.png" /></figure><p>After installation, I accessed the Splunk web interface through Server 2’s IP address on <strong>port 8000</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnGfSXshPpH4rvacRx4MWg.png" /></figure><p>This is the main page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*wAl_mrDyPrx03ADbHbsSMQ.png" /></figure><h3>Step 2: Configuring Forwarders to Send Logs</h3><p>To centralize data, I installed <strong>Splunk Universal Forwarders</strong> on the two other servers (Server 1 and Server 3) using the<strong> wget </strong>command as well. The forwarders were configured to send logs from <strong>/var/log/auth.log </strong>to the central Splunk server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*WZjKI9gkbsoNWWhQMlOlqw.png" /></figure><p>Then I configured the Central Splunk Server as the Forwarder Target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*z7HMgJZM-0BqBkMkOHNpYg.png" /></figure><p>After that I configured the central server to listen to logs from the correct port. (9997)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYVlOS1i_ZnFxEieq1ByKA.png" /></figure><h3>Step 3: Creating the “auth_logs” Index</h3><p>To store and manage the forwarded logs, I first created a custom index in Splunk called <strong>auth_logs</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*El30hjSGeWGFjHxJsbu9Jw.png" /></figure><p>Then I configured the <strong>inputs.conf </strong>file on the forwarders to ensure all logs were sent to this specific index through the <strong>nano </strong>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*YM8LYlOpSkdJgLQBvSslAg.png" /></figure><p>With the forwarders successfully set up, Splunk Enterprise instance is successfully receiving logs from the servers, specifically from <strong>/var/log/auth.log</strong>, and indexing them under <strong>auth_logs.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHqOjlYWK5e6HfwyLV6GTQ.png" /></figure><h3>Step 4: Building Dashboards for Analysis</h3><p>Using Splunk’s powerful query capabilities, I built custom dashboards to visualize and analyze the collected data.</p><h3>Dashboard 1: Failed Login Attempts Analysis</h3><p><strong>Purpose</strong>: Monitor failed login attempts and identify potential brute-force attacks.</p><p><strong>Query Used</strong>: index=auth_logs “Failed password” | timechart count by host</p><h3>Breakdown:</h3><ol><li><strong>index=auth_logs :</strong><br>Searches the auth_logs index for relevant events.</li><li><strong>“Failed password”:</strong><br>Filters the logs to include only events where &quot;Failed password&quot; appears, which indicates failed login attempts.</li><li><strong>| timechart count by host:</strong></li></ol><ul><li><strong>timechart</strong>: Creates a<strong> </strong>time-based chart.</li><li><strong>count</strong>: Counts the number of failed login events.</li><li><strong>by host: </strong>Breaks the counts down by <strong>each host</strong> (e.g., fsu and fsu2).<br>This is why you see two lines on the graph: one for fsu and one for fsu2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*AJCJ9X59dx6Sk9R7Y35ycg.png" /></figure><p>The dashboard revealed that the servers were being targeted with around <strong>20,000 failed login attempts per day</strong> on average. At first both servers had the same host name, but I changed the second servers host name around December 2nd which is why the graph shows a spike in the attempts around that time period.</p><h3>Dashboard 2: Successful Login Attempts</h3><p><strong>Purpose</strong>: Monitor valid login attempts and identify expected user access.</p><p><strong>Query Used</strong>: index=auth_logs “Accepted password” | timechart count by host</p><p>This query works the same way as the previous one, only difference is it shows the successful attempts instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*PeOzN-dsrf2ZtLc0VERY4g.png" /></figure><p><strong>Key Insight</strong>:<br>While thousands of failed attempts were recorded, there were no unauthorized successful logins. The only successful logins occurred on the designated days when I accessed the servers.</p><h3>Challenges Faced</h3><p>One challenge I encountered was configuring the Splunk Forwarders to communicate with the central Splunk server. Initially, firewall rules and IP configuration caused connectivity issues, but troubleshooting allowed me to resolve them. Additionally, creating accurate dashboards required a solid understanding of Splunk queries (SPL) and log structures, which I improved through hands-on experimentation.</p><h3>Key Takeaways</h3><p>This project taught me several critical skills:</p><ul><li><strong>SIEM Deployment</strong>: Setting up Splunk as a centralized log monitoring solution.</li><li><strong>Log Forwarding</strong>: Installing forwarders and configuring them for seamless data flow.</li><li><strong>Dashboard Development</strong>: Building visualizations to analyze trends, detect suspicious activities, and identify attack patterns.</li><li><strong>Incident Monitoring</strong>: Using Splunk to track failed and successful login attempts for better situational awareness.</li></ul><h3>Conclusion</h3><p>Working on this project gave me hands-on experience with Splunk Enterprise, an essential tool in cybersecurity operations. I successfully set up a centralized log monitoring solution, configured log forwarders, and built actionable dashboards to analyze system activity. This experience strengthened my understanding of log management, query writing, and real-time monitoring — skills that are critical for a SOC Analyst role.</p><h3>New Additions</h3><h4>Suricata IDS Integration for Real-Time Threat Detection</h4><ul><li>Installed and configured <strong>Suricata</strong> on the fsu1 server to act as a live Intrusion Detection System (IDS).</li><li>Suricata was configured to monitor network traffic (on ens34) and output alerts and events into Splunk via a JSON log (eve.json).</li><li>Created a dedicated Splunk index (ids_logs) for all Suricata IDS traffic, organizing events by event type (e.g., flow, alert, stream, http).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zmDicYH9R02-Zq2C58-0Fw.png" /></figure><h4>Brute Force Login Detection and Blocking</h4><ul><li>Built a <strong>Brute Force Login Detection</strong> dashboard to track IPs making excessive failed login attempts.</li><li>Identified malicious IPs using dashboards and threat intelligence lookup (AbuseIPDB).</li><li>Implemented <strong>Linux firewall (UFW)</strong> rules to block brute force IPs directly from the server once detected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*-X58ger4QwAxJeOkNhAn1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vNtYL4Ts3zZrRX7KRRuDTg.png" /></figure><p><strong>Result:</strong><br> Brute-force attempts decreased dramatically, from an average of 10,000+ failed login attempts per week in December 2024 to consistently under 500 by april 2025.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Au-VFzyCXfxe92kCgvHaJA.png" /></figure><h4>Automated SSH Login Alerts with Email and Slack Integration</h4><ul><li>Configured Splunk to automatically send an <strong>email alert</strong> for <strong>unauthorized successful SSH logins</strong> from unknown IP addresses.</li><li>Integrated <strong>Slack notifications</strong> using a webhook to deliver alerts in real-time to a Slack channel.</li><li>Built a <strong>whitelist</strong> of known and trusted IP addresses to prevent alert fatigue (only unknown successful SSH logins trigger alerts).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*zyvv9VT05RcxOd99hbq7sg.png" /></figure><h3><strong>Reflections</strong></h3><p>Adding Suricata IDS and configuring active alerting greatly expanded the Splunk SIEM project’s capabilities.<br> Instead of simply <em>reacting</em> to log data, the system now <strong>proactively detects</strong> and <strong>alerts on active threats, </strong>and even <strong>blocks attackers</strong> when needed.</p><p>This project strengthened my skills in:</p><ul><li><strong>Security monitoring and detection engineering</strong></li><li><strong>SIEM administration and dashboard development</strong></li><li><strong>Incident response automation (Slack, Email alerts)</strong></li><li><strong>Firewall configuration for active defense</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8266b592b42c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Hadoop Cluster on Ubuntu: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@FirasA7/building-a-hadoop-cluster-on-ubuntu-a-step-by-step-guide-8000e17bfc1d?source=rss-094ba2b2f740------2</link>
            <guid isPermaLink="false">https://medium.com/p/8000e17bfc1d</guid>
            <category><![CDATA[cluster]]></category>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[mapreduce]]></category>
            <dc:creator><![CDATA[Firas Abdelgadir]]></dc:creator>
            <pubDate>Tue, 26 Nov 2024 05:16:45 GMT</pubDate>
            <atom:updated>2024-12-14T20:20:15.760Z</atom:updated>
            <content:encoded><![CDATA[<h3>Goal and Overview:</h3><p>In today’s data driven world, the ability to efficiently store and process vast amounts of information is essential. Apache Hadoop, an open-source framework, plays a vital role in addressing these needs. Hadoop is designed to handle the <strong>storage</strong> and <strong>processing</strong> of massive datasets in a distributed computing environment. It allows organizations to efficiently manage and analyze big data by splitting tasks across multiple computers, or <strong>nodes</strong>, in a cluster.</p><p>Hadoop is built on two key components:</p><ol><li><strong>Hadoop Distributed File System (HDFS)</strong>: A distributed storage system that splits large datasets into smaller chunks and stores them across multiple nodes, providing fault tolerance and scalability.</li><li><strong>MapReduce</strong>: A programming model used for processing and generating large datasets by breaking the task into smaller chunks, which are executed in parallel across the cluster.</li></ol><p>This project focuses on setting up and configuring a Hadoop cluster on an Ubuntu Linux platform. By leveraging the Hadoop Distributed File System (HDFS) for scalable storage and MapReduce for parallel data processing, I will guide you through the steps to build a pseudo-distributed Hadoop setup. This project aims to enhance my knowledge of distributed systems and provide a solid foundation for managing and processing large-scale datasets effectively.</p><h3>Table of contents:</h3><ol><li>Prerequisites</li><li>preparing the environment</li><li>Setting up java environments</li><li>Installing and configuring Hadoop</li><li>Installing and configuring secure shell</li><li>Configuring the system environment for Hadoop integration</li><li>Setting the Java_home environment variable for Hadoop</li><li>Starting the Hadoop system</li><li>Running MapReduce examples</li><li>Conclusion</li></ol><h3>Prerequisites for the Project: Setting Up Hadoop on Ubuntu</h3><p>Before diving into the Hadoop setup, it’s important to prepare your working environment. Here’s what you’ll need:</p><ol><li><strong>Virtual Machine Environment</strong>:<br>To create an isolated environment for this project, you’ll need a virtual machine application like VMware or VirtualBox. For this demonstration, I’ll be using <strong>VMware</strong>, which provides a seamless interface for managing virtualized systems.</li><li><strong>Ubuntu Operating System</strong>:<br>Install and configure Ubuntu on your chosen virtual machine. Ubuntu provides a reliable Linux platform for setting up the Hadoop cluster, ensuring compatibility with the tools and configurations required for this project.</li><li><strong>Hadoop Framework</strong>:<br>Download the required Hadoop version (e.g., Hadoop 2.7.4) from the Apache Hadoop repository. This framework will be the foundation of our setup, enabling both distributed storage (HDFS) and parallel processing (MapReduce).</li><li><strong>Basic Command-Line Knowledge</strong>:<br>Familiarity with Linux commands will be helpful, as much of the setup involves terminal-based configuration and file handling.</li></ol><h3>Preparing the environment:</h3><p>Before diving into Hadoop installation, the first step is ensuring your environment is ready. Here’s how I prepared mine:</p><ol><li><strong>VMware and Ubuntu Installation</strong>:<br>I already had <strong>VMware</strong> installed on my machine, which is a reliable tool for running virtual machines. For this project, I used VMware to create a virtual machine running <strong>Ubuntu</strong>. You can easily download Ubuntu from its official website. After downloading the Ubuntu ISO, I created a new virtual machine in VMware and installed Ubuntu as the guest operating system.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*XwDT0HWkk47-hHqKprh55w.png" /></figure><p>2. <strong>Ubuntu Setup</strong>:<br>The installation process for Ubuntu is straightforward. Simply follow the prompts provided by the Ubuntu installer, including configuring the necessary system settings like language preferences, time zone, and user credentials. Once Ubuntu was installed, I made sure that the virtual machine was connected to the internet to download any updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*GrtE5E-NIkl__I2Q5cn-Fw.png" /></figure><p>3. <strong>Preparing the System</strong>:<br>After installation, I updated Ubuntu with the latest patches and upgrades to ensure the system is secure and running smoothly. I also made sure to install the necessary packages and dependencies that would support Hadoop installation.</p><h3>Setting up Java environments</h3><p>Java is a prerequisite for running Hadoop, as it forms the backbone of the Hadoop Distributed File System (HDFS) and MapReduce processing framework. Here’s how I ensured my Ubuntu system was Java-ready:</p><ol><li>Before proceeding, I confirmed that Java wasn’t installed in my system through the <strong>java — version </strong>command.</li><li>Then I used the <strong>sudo add-apt-repository ppa:openjdk-r/ppa </strong>command<strong> </strong>to add the <strong>OpenJDK repository</strong> to my system so that I can download and install the latest or a specific version of OpenJDK that may not be available in the default Ubuntu repositories.</li><li>After that I used the <strong>sudo apt-get install openJDK-8-jre </strong>command to install the OpenJDK.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*65I0LU73fPoxT1xYI0eG8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*cTF8h7L0W8GUN1eDfVdakw.png" /><figcaption>By completing this step, the Ubuntu environment was fully prepared to support the installation and configuration of Hadoop.</figcaption></figure><h3>Installing and configuring Hadoop</h3><p>The next step is to install and configure Apache Hadoop on your Ubuntu system. This involves downloading the Hadoop framework, extracting its contents, setting up configuration files, and preparing the environment for Hadoop’s distributed storage (HDFS) and processing (MapReduce).</p><ol><li>I first downloaded tha Hadoop package from the apache archive using the<strong> wget </strong><a href="https://archive.apache.org/dist/hadoop/core/hadoop-2.7.4/hadoop-2.7.4.tar.gz"><strong>https://archive.apache.org/dist/hadoop/core/hadoop-2.7.4/hadoop-2.7.4.tar.gz</strong></a> command</li><li>Then I used <strong>tar -xzf hadoop-2.7.4.tar.gz </strong>to extract the Hadoop and make the files ready for use.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*MB2_Zw4BljBXpk7_zMNzow.png" /></figure><p>3. After extracting the main Hadoop package, I downloaded a supplementary file using the command: <strong>Wget </strong><a href="https://github.com/owlab-exp/docker-hadoop-arm64/raw/master/hadoop-native-64-2.7.0.tar"><strong>https://github.com/owlab-exp/docker-hadoop-arm64/raw/master/hadoop-native-64-2.7.0.tar</strong></a></p><p>This file contains native libraries optimized for ARM64 systems, which ensures smooth compatibility and performance of Hadoop’s components on the Ubuntu environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*n9y4uXA0KtXBeVKcN2axBg.png" /></figure><p>4. I then extracted files, which include key components like<strong> libhadoop.a</strong> and <strong>libhdfs.so</strong> that are required to replace the default 32-bit libraries with<strong> tar -xvf hadoop-native-64–2.7.0.tar</strong></p><p>5. To ensure the libraries are stored in the correct location within the Hadoop installation directory, I created a new directory using <strong>mkdir -p ~/hadoop-2.7.4/lib/native/</strong></p><p>6. The extracted 64-bit libraries were moved into the<strong> native</strong> directory through<strong> mv libhadoop* ~/hadoop-2.7.4/lib/native/</strong></p><p>7. After completing these steps, the directory was inspected to confirm that the libraries were successfully placed in the correct folder. The output confirmed that the libraries (<strong>libhadoop.a, libhdfs.a</strong>, etc.) were now present in the <strong>~/hadoop-2.7.4/lib/native/</strong> directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*hYlKyRaITSRbZTD4IIkPPA.png" /></figure><h3>Installing and configuring Secure Shell</h3><p>Now I will be installing and configuring SSH for the Hadoop cluster to enable secure and passwordless communication between nodes. This step is essential for seamless data transfer and coordination across the distributed system.</p><ol><li>I used the <strong>sudo apt-get install openssh-server </strong>to install the ssh server on the system which ensures that the system can accept ssh connections.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*DAU-4fIT4CVhphAk5tzcRw.png" /></figure><p>2. I then generated an SSH key pair (private and public keys) with the command <strong>ssh-keygen -t rsa -P “”</strong></p><p>3. After generating the keys, I indicated that they are authorized for ssh access and successfully confirmed that it works through the commands shown on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*FcGxKd0wZ_3YhDAjyRSfAg.png" /></figure><h3>Configuring the systems environment for Hadoop Integration</h3><p>To continue the Hadoop cluster setup, I configured the system environments by editing the <strong>.bashrc </strong>file to ensure that the Hadoop installation directory and its binary and sbin folders are added to the system’s PATH variable, which streamlines access to Hadoop commands from any directory.</p><ol><li>Using the <strong>nano ~/.bashrc</strong> command, I accessed the shell configuration file located in my home directory. This file customizes the shell environment whenever a new terminal session starts.</li><li>I appended the following lines to the <strong>.bashrc </strong>file:</li></ol><p><strong>export HADOOP_INSTALL=”/home/firas/hadoop-2.7.4&quot;</strong></p><p><strong>export PATH=$PATH:$HADOOP_INSTALL/bin:$HADOOP_INSTALL/sbin</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*zsWYk4xzln8fo7UttWNoMA.png" /><figcaption>These commands set the location of my Hadoop installation directory and extend the PATH variable to include the Hadoop binary and sbin folders.</figcaption></figure><p>3. After saving the changes, I ran<strong> source ~/.bashrc</strong> to apply the updated configurations immediately without restarting the terminal.</p><p>4. To confirm that the environment variables were set correctly, I used the <strong>echo</strong> <strong>$HADOOP_INSTALL </strong>and <strong>echo $PATH </strong>commands, which displayed the paths as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*Ii0H01wR-hnLfLXisO7X_A.png" /></figure><h3>Setting the JAVA_HOME Environment Variable for Hadoop</h3><p>To ensure proper integration between Hadoop and Java, I set the <strong>JAVA_HOME</strong> environment variable in the Hadoop configuration file. This step is critical for enabling Hadoop’s runtime to locate the necessary Java libraries for execution.</p><ol><li>First, I opened the <strong>hadoop-env.sh f</strong>ile located in the Hadoop configuration directory using the command:</li></ol><p><strong>nano ~/hadoop-2.7.4/etc/hadoop/hadoop-env.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*wZefFDkV6KZabG_fr5owkw.png" /></figure><p>2. Within the file I found the line: <strong>export JAVA_HOME=${JAVA_HOME}</strong></p><p>And replaced it with: <strong>export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ </strong>which is the actual path to the java installation so Hadoop can find the JDK on my system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*pYgnuTZ9CDlH9f2yCHmgDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*_fDkCHAfPrZQ8ag_RmszJA.png" /></figure><p>3. Next, I configured the <strong>core-site.xml </strong>which specifies the default filesystem for Hadoop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*b67DxdLFV70N1qQaRggXFg.png" /><figcaption>This step sets the default Hadoop filesystem to use the local machine as the primary node.</figcaption></figure><p>4. The <strong>hdfs-site.xml </strong>file defines HDFS-specific properties which include the replication factor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*-xFHAveEG5o-VgKs5htW6Q.png" /><figcaption>I configured it by setting the replication factor to 1, which means only one copy of each block will be maintained, which is suitable for a pseudo-distributed setup.</figcaption></figure><p>5. After setting up the core and HDFS properties, I proceeded to configure the <strong>mapred-site.xml</strong> file, which is essential for enabling the MapReduce framework in Hadoop. This step defines the job tracker and ensures that the MapReduce jobs run as expected in a pseudo-distributed environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*ZtUAvtx5i_T1-_dY4-rlxw.png" /><figcaption>The<strong> mapred.job.tracker</strong> property specifies the address and port of the job tracker, ensuring that MapReduce tasks are tracked and managed effectively.</figcaption></figure><h3>Starting the Hadoop System: Bringing the Cluster Online</h3><p>After completing the configuration steps, the next phase was to initialize and launch the Hadoop system. This process ensures that the Hadoop Distributed File System (HDFS) and MapReduce components are ready to handle data and processing tasks. Here’s how I started it:</p><ol><li>Before starting Hadoop, I formatted the HDFS Namenode. This step initializes the file system namespace and prepares it for data storage. The command used was: <strong>hdfs namenode -format</strong></li><li>To start the HDFS and MapReduce daemons, I used the following command:</li></ol><p><strong>start-all.sh</strong></p><p>3. Once the services were running, I opened the Hadoop web interface to confirm the cluster’s health and operational status. The interface can be accessed through the URL:</p><p><a href="http://localhost:50070/"><strong>http://localhost:50070</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*ciT9bzIIqaDDhmbhDjO4vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*hdHZ4VzMaxPlRevt6BEtAA.png" /><figcaption>As shown in the screenshot, the overview page displays critical information such as the cluster’s version, memory usage, and block pool ID. It also confirms that the cluster is active and ready to process data.</figcaption></figure><h3>Running MapReduce Examples: Exploring Hadoop’s Computational Power</h3><p>As a final step in this project, I ran a MapReduce example to demonstrate the computational capabilities of the Hadoop framework. This exercise not only validates the system’s functionality but also showcases Hadoop’s ability to process large datasets efficiently.</p><ol><li>I located the example JAR file, <strong>hadoop-mapreduce-examples-2.7.4.jar</strong>, in the share/hadoop/mapreduce/ directory of my Hadoop installation. Using the <strong>cp </strong>command, I copied this file to my home directory for ease of access:</li></ol><p><strong>cp ~/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar ~/</strong></p><p>2. To estimate the value of Pi, I executed the following command, specifying the number of maps and samples per map:</p><p><strong>hadoop jar ~/hadoop-mapreduce-examples-2.7.4.jar pi 10 100</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*mw-rU9-xqSZ2qMQlFuwPYg.png" /><figcaption>This command initializes 10 map tasks, each processing 100 samples, to calculate an approximate value of Pi.</figcaption></figure><p>The job ran successfully, and the results indicated an estimated value of Pi:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*IZwQIwe62gBPDhBh6OU8eg.png" /><figcaption>The job finished in approximately 4.94 seconds, demonstrating the efficiency of the MapReduce framework.</figcaption></figure><p>After successfully running the Pi Estimation job, I proceeded to execute the WordCount example, which demonstrates how Hadoop can process text files and calculate the frequency of words using the MapReduce framework. Here’s how I set up and executed the WordCount job.</p><ol><li>To begin, I created a text file named input.txt containing sample data for the WordCount job. This file serves as the input for the MapReduce program. I added some text to the file such as:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*UGsSgeF1OCm-r1Bx9vxB-A.png" /></figure><p>2. I then the file into the Hadoop Distributed File System (HDFS):</p><p><strong>hadoop fs -mkdir -p /user/firas/input</strong></p><p><strong>hadoop fs -put ~/input.txt /user/firas/input</strong></p><p>3. To verify the file upload, I listed the contents of the input directory:</p><p><strong>hadoop fs -ls /user/firas/input</strong></p><p>4. Using the <strong>hadoop-mapreduce-examples</strong> JAR file, I executed the WordCount job. This job takes the input file from HDFS and calculates the word frequencies.</p><p><strong>hadoop jar ~/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar wordcount /user/firas/input /user/firas/output</strong></p><p>This was the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*m0NglZdoYxs_aCZlsX52Hg.png" /><figcaption>It clearly displays the word frequencies.</figcaption></figure><h3>Conclusion</h3><p>In conclusion, this project demonstrated the process of setting up and configuring a pseudo-distributed Hadoop cluster on an Ubuntu Linux platform. By systematically preparing the environment, configuring the Hadoop framework, and executing MapReduce examples, I gained hands-on experience with the critical components of Hadoop, including HDFS for scalable storage and MapReduce for efficient data processing.</p><p>Throughout the project, I faced challenges such as resolving library incompatibilities, ensuring proper SSH configuration, and troubleshooting MapReduce execution errors. Each challenge provided an opportunity to deepen my understanding of distributed systems and refine my problem-solving skills.</p><p>From configuring Java environments and key Hadoop files to successfully running MapReduce jobs like Pi Estimation and WordCount, this project demonstrated the functionality and readiness of the Hadoop cluster. It also highlighted the powerful capabilities of Hadoop for managing large-scale data. This hands-on experience sets the stage for diving deeper into advanced Hadoop features and applying them to real-world big data challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8000e17bfc1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hospital Information System with MySQL: A Database Project]]></title>
            <link>https://medium.com/@FirasA7/hospital-information-system-with-mysql-a-database-project-541e2e3bd886?source=rss-094ba2b2f740------2</link>
            <guid isPermaLink="false">https://medium.com/p/541e2e3bd886</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cybersecurity-project]]></category>
            <category><![CDATA[database-design]]></category>
            <category><![CDATA[data-management]]></category>
            <dc:creator><![CDATA[Firas Abdelgadir]]></dc:creator>
            <pubDate>Mon, 30 Sep 2024 17:16:13 GMT</pubDate>
            <atom:updated>2024-09-30T17:16:13.718Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>As an upcoming cyber security graduate and a tech enthusiast, I will demonstrate how I familiarized myself with MySQL and used it to build a secure Hospital Information System (HIS) throughout this project.</p><h3><strong>Overview</strong></h3><p>The Hospital Information System (HIS) is essential for efficient healthcare management, aiming to improve operations, enhance patient care, and ensure accurate, accessible data. This project focuses on creating and implementing a strong database system at the core of HIS, covering the medical side of the operation that’s tailored to meet the detailed needs of hospital management. It’s carefully designed to manage important patient, staff, department, and medication information.</p><h3><strong>Content</strong></h3><ul><li>MySQL introduction</li><li>The foundation</li><li>ER diagram</li><li>Tables</li><li>User accounts and Roles</li><li>Access control strategy</li><li>Protection against SQL injection attacks and implementing preventative measures</li><li>Conclusion</li></ul><h3><strong>What is MySQL?</strong></h3><p>Developed by Oracle, <strong>MySQL</strong> is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL) to manage and interact with databases. MySQL is used in web applications, data analytics, and other data-driven environments for its reliability, flexibility, and ease of use. MySQL organizes data into structured tables, which can be linked to one another through relationships, ensuring that large datasets can be efficiently managed and queried.</p><h3><strong>The foundation</strong></h3><p>MySQL serves as the foundation of this Hospital Information System (HIS), providing a reliable and scalable solution for managing complex medical data. Using MySQL, I designed and implemented the following key features:</p><ul><li><strong>Database Structure:</strong> The HIS database consists of multiple interconnected tables, such as patients, physicians, nurses, departments, and medications. These entities are linked together through primary and foreign keys, ensuring relational integrity and easy data management.</li><li><strong>Role-Based Access Control:</strong> MySQL’s user privilege system was used to define role-based access control (RBAC) for different hospital staff. Each role (admin, doctor, nurse, pharmacist, and receptionist) was assigned appropriate privileges, ensuring that data access is restricted based on job responsibilities.</li><li><strong>Data Integrity:</strong> To maintain data integrity, foreign keys were used extensively across the system to enforce relationships between different tables (e.g., linking prescriptions to both physicians and patients). This ensures that critical relationships are maintained across the database.</li><li><strong>Security Features:</strong> Security was a top priority when designing the system. MySQL’s built-in security features were used to protect the database from common threats, such as SQL injection. Parameterized queries and input validation were implemented to ensure that user inputs are safely handled.</li></ul><h3><strong>ER Diagram</strong></h3><p>An <strong>Entity-Relationship (ER) Diagram</strong> is a visual representation of the relationships between entities within a database. It helps to model the structure of a database, showing the connections between different data points or “entities.” In an ER diagram, entities are represented by rectangles, and relationships between these entities are depicted by lines. Each entity can have attributes, which are the specific pieces of data that describe that entity. For example, a “Patient” entity might have attributes like SSN, name, address, and phone number.</p><p>ER diagrams play a crucial role in database design as they provide a blueprint of the system, helping developers understand the flow of data, how entities are related, and how the database will operate as a whole.</p><p><strong>The ER diagram for the Hospital Database</strong></p><p>Below is the Entity-Relationship diagram for the Hospital Information System (HIS) that I developed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*vZ__VDh43uw1kTabNvbKWA.png" /></figure><p>This diagram captures the core entities of the hospital&#39;s database, including <strong>patients</strong>, <strong>physicians</strong>, <strong>nurses</strong>, <strong>departments</strong>, <strong>medications</strong>, and <strong>prescriptions</strong>. Each of these entities plays a vital role in the hospital’s operations, and the diagram illustrates how they interact with one another.</p><p>Here’s a breakdown of the key entities and their relationships:</p><ul><li><strong>Department</strong>: Each department within the hospital is identified by a unique <strong>department_id</strong>. Departments have their own attributes like <strong>name</strong> and <strong>head</strong>, and they are linked to both <strong>physicians</strong> and <strong>nurses</strong>.</li><li><strong>Physician</strong>: This entity stores data on physicians working in the hospital, including attributes like <strong>employee_id</strong>, <strong>name</strong>, <strong>position</strong>, and <strong>SSN.</strong> Physicians are linked to <strong>departments</strong> and can issue <strong>prescriptions</strong> to patients.</li><li><strong>Nurse</strong>: Similar to physicians, nurses are assigned to departments. They also have attributes like <strong>employeeid</strong>, <strong>name</strong>, and <strong>position</strong>, helping the hospital manage its staff structure.</li><li><strong>Patient</strong>: The <strong>patient</strong> entity captures important patient information, such as <strong>SSN</strong>, <strong>name</strong>, <strong>address</strong>, and <strong>phone</strong>. Patients can receive multiple prescriptions from physicians, as shown in their connection to the <strong>prescribes</strong> table.</li><li><strong>Medication</strong>: This entity lists all the medications available for prescription, with details such as <strong>medication_id</strong>, <strong>name</strong>, <strong>type</strong>, and <strong>date</strong>.</li><li><strong>Prescribes</strong>: Acting as a junction table, <strong>prescribes</strong> links physicians, patients, and medications. It tracks which physician prescribed which medication to which patient, along with the date and dose.</li></ul><h3><strong>Database Tables: Structuring the Hospital Information System</strong></h3><p>The foundation of any database lies in its tables. For the Hospital Information System (HIS), I structured the database using a variety of interconnected tables to manage patient care, staff organization, and medication tracking. Each table represents a key entity in the hospital’s operation, and the relationships between these tables ensure that data is managed efficiently and securely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*ze6ZKkQDK59ZGC0HkrH1kg.png" /></figure><h4>Key Tables in the HIS Database:</h4><p><strong>Department Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>department_id </strong>(Primary Key)</li><li><strong>name</strong></li><li><strong>head</strong></li><li><strong>Purpose</strong>: This table stores the details of the hospital’s various departments, such as Surgery, Pediatrics, and Cardiology. Each department is managed by a <strong>head</strong>, typically a senior physician or specialist.</li></ul><p><strong>Medication Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>medication_id</strong> (Primary Key)</li><li><strong>name</strong></li><li><strong>date</strong></li><li><strong>type</strong></li><li><strong>Purpose</strong>: This table lists all medications available for prescription. It tracks details like medication type and the date it was added to the hospital’s database.</li></ul><p><strong>Nurse Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>employeeid</strong> (Primary Key)</li><li><strong>name</strong></li><li><strong>SSN</strong></li><li><strong>position</strong></li><li><strong>department_id</strong> (Foreign Key)</li><li><strong>Purpose</strong>: Similar to the physician table, this table tracks information about nurses, including their credentials and their assigned departments.</li></ul><p><strong>Patient Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>SSN </strong>(Primary Key)</li><li><strong>name</strong></li><li><strong>address</strong></li><li><strong>phone</strong></li><li><strong>insuranceid</strong></li><li><strong>Purpose</strong>: The patient table contains essential information about the hospital’s patients. It captures data such as social security number, contact details, and insurance information.</li></ul><p><strong>Physician Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>employeeid</strong> (Primary Key)</li><li><strong>name</strong></li><li><strong>position</strong></li><li><strong>SSN</strong></li><li><strong>department_id</strong> (Foreign Key)</li><li><strong>Purpose</strong>: This table manages data about hospital physicians, including their unique ID, role, social security number, and the department they work in.</li></ul><p><strong>Prescribes Table</strong></p><ul><li><strong>Attributes</strong>:</li><li><strong>prescription_id</strong> (Primary Key)</li><li><strong>physician_id</strong> (Foreign Key)</li><li><strong>patient_id</strong> (Foreign Key)</li><li><strong>medication_id</strong> (Foreign Key)</li><li><strong>date</strong></li><li><strong>dose</strong></li><li><strong>Purpose</strong>: Acting as a junction table, the <strong>prescribes </strong>table connects physicians, patients, and medications. It logs which physician prescribed which medication to which patient, as well as the dose and date of the prescription.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a4WjaNISHYDeDfqyn4B9xw.png" /></figure><p><strong>Throughout the process of creating this table, I had to ensure that:</strong></p><ul><li><strong>Foreign Key Constraints were properly enforced</strong>: By linking the <strong>physician_id</strong>, <strong>patient_id</strong>, and <strong>medication_id </strong>columns to their respective tables (<strong>physician</strong>, <strong>patient</strong>, <strong>medication</strong>), I ensured that the data remains consistent and that only valid references can be made. This was critical in maintaining the integrity of the hospital&#39;s prescription records.</li><li><strong>Primary Key for Uniqueness</strong>: The <strong>prescription_id </strong>serves as the unique identifier for each prescription. Implementing an <strong>AUTO_INCREMENT</strong> constraint ensured that each prescription gets assigned a unique ID automatically without requiring manual input, reducing the chance of errors.</li><li><strong>Data Relationships were Clearly Defined</strong>: I had to carefully think through the relationships between the tables. For example, a physician can prescribe multiple medications to multiple patients, so ensuring proper many-to-many relationships through foreign keys was crucial.</li><li><strong>Date and Dosage Fields Captured Precise Information</strong>: For each prescription, the <strong>date </strong>of issuance and the <strong>dose </strong>were important fields to track. The <strong>dose </strong>field was implemented as a VARCHAR (<strong>50)</strong> to accommodate flexible dosing instructions, such as &quot;500mg&quot; or &quot;1 tablet daily.&quot;</li></ul><h3>User Accounts and Roles: Securing Access in the Hospital Information System</h3><p>In any database, particularly one handling sensitive medical information, it’s crucial to define access controls and user roles properly. This ensures that only authorized personnel can access or modify data relevant to their roles, helping to maintain security and data integrity. For this Hospital Information System (HIS), I implemented user accounts with specific privileges based on the responsibilities of each role.</p><p>The following section outlines the roles and privileges assigned to various users within the database, ensuring that each individual or group has appropriate access to the data they need while maintaining overall security. The system is designed to allow <strong>administrators</strong> full control, while restricting the scope of access for <strong>doctors</strong>, <strong>nurses</strong>, <strong>pharmacists</strong>, and <strong>receptionists</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*qQ2cFfEBy65RpqWfgB6s_Q.png" /></figure><p><strong>Admin:</strong></p><ul><li>Role: Full administrative control over the entire database.</li><li>Privileges: All permissions (SELECT, INSERT, UPDATE, DELETE, etc.) on all tables.</li><li>User Account: ‘admin’@’localhost’</li></ul><p>Doctor:</p><ul><li>Role: Access to patient data and prescriptions, with limited modification rights.</li><li>Privileges: SELECT, INSERT, UPDATE on ‘patient’ and ‘prescribes’ tables.</li><li>User Account: ‘doctor’@’localhost’</li></ul><p>Nurse:</p><ul><li>Role: Access to patient information and limited prescription details.</li><li>Privileges: SELECT, INSERT on ‘patient’ table.</li><li>User Account: ‘nurse’@’localhost’</li></ul><p>Pharmacist:</p><ul><li>Role: Access to prescription details for medication dispensing.</li><li>Privileges: SELECT on ‘prescribes’ table.</li><li>User Account: ‘pharmacist’@’localhost’</li></ul><p>Receptionist:</p><ul><li>Role: Access to patient data and limited modification rights.</li><li>Privileges: SELECT, INSERT, UPDATE on ‘patient’ table.</li><li>User Account: ‘receptionist’@’localhost’</li></ul><h3>Access Control Strategy</h3><p>Implementing a secure and efficient access control strategy was a key priority in designing the Hospital Information System (HIS). The strategy focuses on restricting user privileges to ensure that staff members can only access or modify the data relevant to their roles. By adhering to the principle of <strong>least privilege</strong>, we minimize the risk of unauthorized access to sensitive information while maintaining operational efficiency.</p><h4>Key Components of the Access Control Strategy:</h4><ol><li><strong>Role-Based Access Control (RBAC)</strong>: The HIS employs a role-based access control (RBAC) approach, where each user is assigned a specific role within the system, determining their level of access. This simplifies management and ensures that permissions are aligned with job responsibilities.</li></ol><ul><li><strong>Admin</strong>: Has full control over the database, including <strong>SELECT</strong>, <strong>INSERT,</strong> <strong>UPDATE</strong>, and <strong>DELETE </strong>privileges on all tables. This role is reserved for database administrators who manage the system and perform critical tasks such as data backup, updates, and maintenance.</li><li><strong>Doctor</strong>: Can view and modify patient and prescription data. Doctors have <strong>SELECT,</strong> <strong>INSERT</strong>, and <strong>UPDATE</strong> privileges on the <strong>patient </strong>and <strong>prescribes </strong>tables, allowing them to access patient records and add or modify prescriptions.</li><li><strong>Nurse</strong>: Nurses have limited access to patient information. Their role grants them <strong>SELECT</strong> and <strong>INSERT </strong>privileges on the <strong>patient</strong> table, ensuring they can update patient information when necessary but without the ability to alter prescriptions or sensitive medical details.</li><li><strong>Pharmacist</strong>: Pharmacists have access to prescription details only. They are granted <strong>SELECT </strong>privileges on the <strong>prescribes </strong>table, allowing them to view prescription records for medication dispensing without modifying the data.</li><li><strong>Receptionist</strong>: The receptionist’s role allows access to patient information with limited modification rights. They are granted <strong>SELECT</strong>, <strong>INSERT</strong>, and <strong>UPDATE</strong> privileges on the <strong>patient</strong> table, enabling them to assist with patient registration and updates.</li></ul><ol><li><strong>Least Privilege</strong>: Each user role is assigned the minimal privileges necessary to perform their job functions. This approach reduces the risk of accidental or malicious data manipulation. For example, while doctors can update patient and prescription data, they cannot modify other parts of the database, such as medication records.</li><li><strong>User Account Isolation</strong>: Each role is associated with a unique user account, preventing cross-role access. Doctors, nurses, pharmacists, and receptionists each log into separate accounts with distinct permissions, ensuring no overlap in capabilities. This also aids in tracking changes made to the database, as each action is associated with a specific user account.</li><li><strong>Granular Control Over Data</strong>: Permissions are set at a granular level, restricting access to specific tables. For instance, only the <strong>pharmacist</strong> can view prescription details but cannot alter them, while <strong>receptionists</strong> can update patient details but are restricted from accessing medical information like prescriptions.</li></ol><h3><strong>Protecting Against SQL Injection Attacks: Securing the HIS Database</strong></h3><p>SQL injection is a common and potentially dangerous vulnerability in database systems, where an attacker can manipulate the SQL queries executed by the application to gain unauthorized access or modify the database. Since the Hospital Information System (HIS) handles sensitive medical data, it’s critical to implement robust measures to protect against SQL injection attacks.</p><h4>Risks of SQL Injection:</h4><ol><li><strong>Data Breaches</strong>: Attackers can extract sensitive information such as patient records, prescription details, and staff information by injecting malicious queries.</li><li><strong>Data Manipulation</strong>: Malicious actors can alter or delete data in the database, which could compromise the integrity of patient care and hospital operations.</li><li><strong>System Compromise</strong>: In more severe cases, attackers could gain control of the entire database or underlying server, leading to a full system breach.</li></ol><h4>Preventive Measures Implemented:</h4><ol><li><strong>Parameterized Queries</strong>: One of the primary defenses against SQL injection is using <strong>parameterized queries</strong>. These queries separate user input from the SQL command structure, preventing user-supplied data from being interpreted as executable code.</li></ol><p>Ex: “<strong>SELECT * FROM patients WHERE ssn = ?;</strong>” the ssn value is treated as a parameter, and the query structure remains protected from any malicious input.</p><p>2. <strong>Input Validation and Sanitization</strong>: Proper input validation ensures that user input adheres to expected formats (e.g., ensuring that a social security number contains only numbers). This step prevents invalid or malicious inputs from being processed by the database.</p><p>Ex of a PHP input validation: “<strong>$ssn = mysqli_real_escape_string($connection, $_POST[‘ssn’]);</strong>” The command sanitizes the ssn input before inserting it into the SQL query, ensuring that special characters or malicious inputs are neutralized.</p><p>3. <strong>Stored Procedures</strong>: Using <strong>stored procedures</strong> for critical database operations is another protective measure. Stored procedures contains SQL queries within the database itself, making them less vulnerable to manipulation through user input.</p><p>Ex: “<strong>CREATE PROCEDURE getPatientInfo (IN ssn INT)<br>BEGIN<br> SELECT * FROM patients WHERE ssn = ssn;<br>END;</strong>”</p><p>This ensures that the logic for accessing patient data is controlled within the database, reducing the attack surface for SQL injection.</p><p>4. <strong>Database User Privileges</strong>: Another defense layer is assigning <strong>minimal privileges</strong> to database users based on their roles (as outlined in the access control section). For example, even if an attacker were able to inject a malicious query, users like <strong>receptionists</strong> or <strong>pharmacists</strong> would have limited rights and could not execute damaging queries like <strong>DELETE</strong> or <strong>UPDATE</strong> on sensitive tables.</p><p>5. <strong>Error Message Suppression</strong>: Limiting the information provided in error messages prevents attackers from gaining insight into the database structure. For example, generic error messages like “Invalid query” are displayed rather than revealing internal query structure or database details.</p><h3>Conclusion</h3><p>The HIS project successfully integrates multiple security strategies to protect the sensitive medical data stored in its database. By implementing parameterized queries, input validation, stored procedures, restricted privileges, and error message suppression, the system is fortified against SQL injection and other common attacks. Together, these measures ensure the data integrity, security, and reliability of the hospital’s operations.</p><p>As a senior undergraduate in cybersecurity, this project has been a valuable experience in applying theoretical knowledge to real-world scenarios. It has helped me strengthen my skills in database security, access control, and secure software development. I’m excited to continue building my resume and e-portfolio with projects like this, showcasing my ability to design, develop, and secure complex systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=541e2e3bd886" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>