Source Code & Complete Repository: onevilx/inception
Infrastructure Stack: Docker / Docker Compose / Custom TLS Reverse Proxy
Environment: 1337 School (42 Network)
Modern container virtualization has radically transformed software deployment, cloud orchestration, and enterprise DevOps infrastructure. When an engineering organization scales applications across complex distributed topologies—from single-server bare metal environments to Kubernetes cloud clusters—the dividing line between resilient system uptime and catastrophic infrastructure collapse lies entirely in how cleanly systems decouple process execution from system resource dependency.
However, the proliferation of pre-packaged automated container images from public registries has fostered a dangerous culture of architectural compliance without foundational comprehension. Millions of developers deploy automated multi-tiered web environments by downloading bloated, generalized Docker Hub templates without understanding how Linux operating system kernel primitives—specifically Namespaces and Control Groups (cgroups)—isolate processes, govern hardware utilization, and enforce security boundaries.
The Inception project at 1337 School (42 Network) intentionally dismantles this abstraction layer. The engineering directive is uncompromising: design, orchestrate, and construct an enterprise-grade multi-container virtual web infrastructure completely from scratch. Utilizing bare Linux operating system distribution baselines (Debian 12 Bookworm or Alpine Linux), every single operational component—from TLS-encrypted reverse proxies to standalone relational database daemons—must be manually compiled, hard-coded, and instantiated through bespoke Dockerfiles, custom shell entrypoint pipelines, and deterministic networking topologies. No official pre-bundled service images are permitted.
This article provides a rigorous technical examination of the Inception system architecture, unpacking container kernel physics, inter-container virtual networking bridges, FastCGI binary protocol routing, automated zero-intervention database bootstrapping, POSIX PID 1 signal management, and offensive security infrastructure hardening against container escape and credential exploitation vectors.
1. The Physics of Virtualization vs. Containerization
To engineer an optimized infrastructure, a system architect must fundamentally distinguish between traditional hardware virtualization (Hypervisor Virtual Machines) and Operating System OS-level containerization.
+-----------------------------------------------------------------------------+| INFRASTRUCTURE ISOLATION ARCHITECTURE COMPARISON |+------------------------------------+----------------------------------------+| Hypervisor Virtualization (VMs) | Operating System Containerization |+------------------------------------+----------------------------------------+| App A App B App C | App A (Nginx) App B (WP) App C (SQL) || Bin/Lib Bin/Lib Bin/Lib | Bin/Lib Bin/Lib Bin/Lib || Guest OS Guest OS Guest OS | Docker Engine || Hypervisor (KVM/ESXi) | Host Linux Kernel (Namespaces) || Host Physical Hardware | Host Physical Hardware |+------------------------------------+----------------------------------------+The Heavyweight Burden of Hypervisor Virtualization
Traditional Type-1 and Type-2 hypervisors (such as VMware ESXi, KVM, or QEMU) isolate application workloads by virtualizing physical hardware components directly—emulating CPUs, memory controllers, disks, and network interface adapters. Each virtual machine mandates running a complete, proprietary Guest Operating System kernel alongside user-space libraries. This paradigm exacts an immense computational tax: massive memory duplication, degraded I/O disk virtualization throughput, and multi-second system boot initialization times.
Container Mechanics: Kernel Namespaces and Control Groups
Containerization completely sidesteps hardware emulation by deploying isolated execution partitions sharing a single unifying host Linux Operating System Kernel. When the Docker engine boots a component in our Inception cluster, it combines two distinct kernel isolation primitives:
- Linux Namespaces: Restrict what an executing process can perceive within the operating environment.
pid(Process IDs): Creates an isolated process tree hierarchy; an Nginx server running inside a container perceives itself as running as PID 1, completely blind to concurrent processes executing across neighbor containers or the underlying host OS.net(Networking): Assigns dedicated virtual network adapter interfaces, routing tables, port numbers, and firewall iptables rulesets.mnt(Mount / Filesystems): Establishes isolated root filesystem mount points and directory paths (chrootequivalents).ipc(Inter-Process Communication): Prevents shared POSIX RAM segments and system message queues from spilling across container partitions.
- Control Groups (
cgroups v2): Regulate what resources a process can consume, enforcing strict physical ceilings on total CPU cycles, dynamic memory allocation limits, disk read/write IOPS throughput, and network adapter bandwidth saturation.
2. Infrastructure Topology & Secure Network Design
Our deployment design is engineered around strict security boundary isolation and Principle of Least Privilege (PoLP) routing architecture. The external public internet must interact exclusively with an encrypted perimeter defense gateway, completely decoupling persistent internal backend applications and relational storage layers from external access.
[ External Public Network / Browser ] | HTTPS (Port 443 / TLSv1.3) | === HOST SYSTEM ARCHITECTURE: INCEPTION_NETWORK (Bridge) ===+----------------------------------+------------------------------------------+| Container: NGINX (Perimeter) | Host Filesystem Persistent Bind Mounts || - SSL / TLSv1.3 Termination | || - Port 443 -> Exposed to Host | || - FastCGI Proxying (Port 9000) | |+----------------------------------+ | | \ | Port 9000 (TCP/FCGI) \-- (Shared Volume: /home/onevilx/data/wordpress) | | / |+----------------------------------+ / || Container: WORDPRESS (Compute) | ---------- || - PHP-FPM 8.2 Execution Engine | || - WP-CLI Automation Scripting | || - Port 9000 -> Internal Only | |+----------------------------------+ | | | Port 3306 (TCP/MySQL) | | |+----------------------------------+ || Container: MARIADB (Storage) | --- (Shared Volume: /home/onevilx/data/db)|| - Custom SQL Bootstrap Engine | || - Port 3306 -> Internal Only | |+----------------------------------+------------------------------------------+2.1 The Docker Bridge Network (inception_network)
To achieve zero-trust network segregation, all containers are joined to a user-defined custom Docker bridge network titled inception_network. Unlike default legacy docker0 bridge setups, custom networks benefit from automated embedded Docker DNS resolution. Containers can locate and establish socket connections with each other by resolving internal hostname targets directly (wordpress, mariadb), eliminating unstable, hard-coded dynamic internal IP allocations!
Crucially, our operational network firewall mapping exposes only a single physical host port: Port 443 (HTTPS) on the NGINX perimeter gateway. All plain unencrypted HTTP requests (Port 80) are systematically disabled, while our internal PHP computational server (port 9000) and MariaDB database (port 3306) reside completely hidden behind internal Docker bridge network boundaries. An attacker scanning the host physical machine discovers a fully sealed perimeter displaying zero exposed backend administrative application layers!
2.2 Stateful Persistence via Host Bind Mounts
Because containers are intentionally engineered to be ephemeral, stateless execution execution environments, writing persistent database tables or content directly into a container’s internal copy-on-write filesystem overlay guarantees permanent data destruction the moment a container is restarted or updated.
To achieve enterprise stateful storage preservation, we declare rigorous local Host Bind Mounts bridging persistent physical Linux directories directly into container mount destinations:
src: /home/onevilx/data/wordpressdst: /var/www/html: Shares functional core CMS executable code concurrently between Nginx (for static CSS/JS/Image file delivery) and PHP-FPM (for dynamic code parsing).src: /home/onevilx/data/mariadbdst: /var/lib/mysql: Preserves physical binary relational database table records and schema transaction logs safely on the host hard disk drive, impervious to container recycling operations.
3. Tier 1: Perimeter Defense & Hardened Nginx TLS Reverse Proxy
The NGINX perimeter server acts as our external front door, responsible for protocol encryption termination, static resource asset delivery, and upstream request proxy routing.
To construct this component cleanly without relying on public templates, we formulate an explicit multi-stage instructional Dockerfile utilizing a minimal Debian 12 Bookworm operating base:
FROM debian:bookworm-slim
# Maintainer IdentityLABEL maintainer="onevilx <youssef@127.0.0.1>"
# Install NGINX web daemon & OpenSSL cryptography tooling cleanlyRUN apt-get update && apt-get install -y --no-install-recommends \ nginx \ openssl \ curl \ && rm -rf /var/lib/apt/lists/*
# Establish secure internal configuration directoriesRUN mkdir -p /etc/nginx/ssl /var/run/nginx
# Generate enterprise self-signed X.509 RSA SSL/TLS Cryptographic CertificatesRUN openssl req -x509 -nodes -out /etc/nginx/ssl/inception.crt \ -keyout /etc/nginx/ssl/inception.key -subj \ "/C=MA/ST=Casablanca-Settat/L=Khouribga/O=1337 School/OU=42 Network/CN=onevilx.42.fr" \ -days 365 -newkey rsa:4096
# Inject Hardened Custom Configuration ProfileCOPY ./conf/nginx.conf /etc/nginx/nginx.confCOPY ./conf/default.conf /etc/nginx/conf.d/default.conf
# Enforce secure ownership across application file descriptorsRUN chown -R www-data:www-data /var/www/html /etc/nginx/ssl
# Expose restricted TLS encryption communication portEXPOSE 443
# Invoke NGINX execution directly in foreground as PID 1 daemonCMD ["nginx", "-g", "daemon off;"]3.1 Advanced Cryptographic Hardening & TLS Configuration
Deploying SSL/TLS encryption without strict protocol parameter curation is an operational liability. Legacy secure communication protocols (SSLv3, TLS 1.0, TLS 1.1) are riddled with documented cryptographic vulnerabilities, including POODLE, BEAST, and CRIME compression side-channel exploitation vectors.
Our customized NGINX proxy engine enforces strict protocol adherence to TLSv1.2 and TLSv1.3 only, paired with explicitly curated high-strength ephemeral Diffie-Hellman Elliptic Curve encryption cipher suites and hardened HTTP application security headers:
server { # Establish SSL listener exclusively on designated port 443 listen 443 ssl default_server; listen [::]:443 ssl default_server;
server_name onevilx.42.fr www.onevilx.42.fr; root /var/www/html; index index.php index.html index.htm;
# Cryptographic Certificate Binding ssl_certificate /etc/nginx/ssl/inception.crt; ssl_certificate_key /etc/nginx/ssl/inception.key;
# TLS Protocol Restrictions & Cipher Hardening ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; ssl_session_tickets off;
# Enterprise HTTP Security Header Injections add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "no-referrer-when-downgrade" always;
# Static Asset Serving & Access Optimization location / { try_files $uri $uri/ /index.php?$args; }
# FastCGI Protocol Gateway Routing to Upstream WordPress Container location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass wordpress:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; }
# Deny direct network visibility into sensitive hidden configuration structures location ~ /\.ht { deny all; }}When an external client attempts to access a dynamic page (e.g., onevilx.42.fr/wp-login.php), NGINX intercepts the TLS connection, deconstructs the URI packet payload, and proxies the executable command instruction across the internal Docker bridge network (fastcgi_pass wordpress:9000) using the highly optimized binary FastCGI Protocol.
4. Tier 2: Application Computation & Automated WordPress Engine
A fundamental axiom of well-engineered container virtualization architecture is the Single Responsibility Principle: one individual service concern per executing container. Placing an all-inclusive web platform (like bundling Apache, PHP, and MySQL directly inside a single messy image) fundamentally breaks horizontal cloud autoscaling capability and monitoring reliability.
Our WordPress application tier functions solely as a computational processing unit running PHP-FPM (PHP FastCGI Process Manager 8.2). It receives binary FastCGI streams from NGINX, executes the requested PHP scripts against mounted static code directories, queries internal database infrastructures, and outputs computed HTML text structures directly back upstream.
4.1 PHP-FPM Network Socket Transmutation
By default, standard Debian packaged distributions configure PHP-FPM to communicate via an isolated local Unix filesystem socket (/run/php/php8.2-fpm.sock). While optimal for bare-metal single-server architectures, Unix socket IPC paths cannot traverse isolated network container boundaries!
To open communications across our Docker network topology, we must explicitly modify the pool configuration (www.conf), directing the execution manager to listen natively on TCP networking interface port 9000 across all available network adapters:
# /srcs/requirements/wordpress/conf/www.conf (Snippet overrides)[www]user = www-datagroup = www-data; Bind PHP-FPM listening engine directly to all container network adapters on port 9000listen = 0.0.0.0:9000listen.owner = www-datalisten.group = www-datapm = dynamicpm.max_children = 25pm.start_servers = 5pm.min_spare_servers = 2pm.max_spare_servers = 10clear_env = no4.2 Autonomous Unattended CMS Bootstrapping Pipeline
Because interactive installations (such as a developer manually navigating to /wp-admin/install.php inside a browser window to set passwords and configure database settings) are strictly prohibited in enterprise automated DevOps pipelines, our container deploys a dedicated, idempotent zero-intervention bootloader entrypoint script utilizing WP-CLI (The official command-line tool for managing WordPress).
#!/bin/bashset -e
# Step 1: Enter designated shared web application mount directorycd /var/www/html
# Step 2: Ensure proper configuration directory readinessmkdir -p /run/php
# Step 3: Check whether core system architecture has already been initializedif [ ! -f "wp-config.php" ]; then echo "[INFO] WordPress installation absent. Beginning automated deployment pipeline..."
# Wait continuously until backend MariaDB socket confirms networking operational readiness echo "[INFO] Interrogating upstream MariaDB database port latency..." until mysqladmin ping -h"${MYSQL_HOSTNAME}" -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" --silent; do echo "Database network unavailable. Sleeping 2 seconds..." sleep 2 </dev/null echo "[SUCCESS] MariaDB connectivity confirmed! Initiating automated structural setup."
# Step 4: Download official WordPress executable binaries wp core download --allow-root --path='/var/www/html'
# Step 5: Generate optimized wp-config.php incorporating isolated environment secrets wp config create --allow-root \ --dbname=${MYSQL_DATABASE} \ --dbuser=${MYSQL_USER} \ --dbpass=${MYSQL_PASSWORD} \ --dbhost=${MYSQL_HOSTNAME} \ --path='/var/www/html'
# Step 6: Execute headless core relational schema bootstrapping & Administrator account binding wp core install --allow-root \ --url=${DOMAIN_NAME} \ --title="${SITE_TITLE}" \ --admin_user=${WORDPRESS_ADMIN_USER} \ --admin_password=${WORDPRESS_ADMIN_PASSWORD} \ --admin_email=${WORDPRESS_ADMIN_EMAIL} \ --skip-email
# Step 7: Instantiate restricted operational author account to enforce least privilege access wp user create --allow-root ${WORDPRESS_USER} ${WORDPRESS_USER_EMAIL} \ --role=author \ --user_pass=${WORDPRESS_USER_PASSWORD}
# Set hardened POSIX ownership attributes across entire functional document tree chown -R www-data:www-data /var/www/html chmod -R 755 /var/www/html
echo "[SUCCESS] Autonomous WordPress system bootstrap operation completed successfully!"else echo "[INFO] Existing WordPress configuration detected on persistent volume. Skipping installation."fi
# Step 8: Execute primary compute daemon directly in foreground replacing script execution contextexec /usr/sbin/php-fpm8.2 -FNotice our defensive application of a polling loop checking mysqladmin ping prior to executing software compilation! Because container orchestration platforms start sibling containers synchronously in parallel, network database booting delays often cause downstream PHP compilation processes to fail fatally when attempting immediate SQL database connections. Our loop ensures resilient structural fault tolerance.
5. Tier 3: Relational Data Persistence & Hardened MariaDB
The deepest tier of our secure network topology houses MariaDB, our primary relational SQL database server. To eliminate external dependency vulnerabilities and satisfy project standards, we compile our database container directly from a raw Debian base without relying on pre-packaged SQL initialization scripts or external GUI installers.
5.1 Autonomous Relational Schema Bootstrapping
When standard MySQL packages install on clean operating system deployments, they typically default to local unix-domain networking sockets and unsafe default account settings (including root authentication without a password and open administrative anonymous user test schemas). Our automated container entrypoint script safely executes structural provisioning and database user hardening dynamically at container bootstrap:
#!/bin/bashset -e
# Initialize required operating system database tracking directoriesmkdir -p /var/run/mysqld /var/lib/mysqlchown -R mysql:mysql /var/run/mysqld /var/lib/mysql
# Determine whether database schema requires primary bootstrap installationif [ ! -d "/var/lib/mysql/${MYSQL_DATABASE}" ]; then echo "[INFO] Naked persistent volume detected. Executing primary MariaDB engine initialization..."
# Install foundational system relational catalog binaries without network exposure mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql > /dev/null
# Stage automated SQL hardening and account provisioning instruction ledger cat << EOF > /tmp/bootstrap_hardening.sqlUSE mysql;FLUSH PRIVILEGES;-- Remove anonymous unsecured database user access entriesDELETE FROM mysql.user WHERE User='';-- Revoke remote external root access; bind root super-user strictly to local internal loopbackDELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');-- Expel unhardened open test schema databasesDROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';-- Configure root cryptographic authentication protectionALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';-- Instantiate designated production WordPress relational database instanceCREATE DATABASE IF NOT EXISTS \`${MYSQL_DATABASE}\` CHARACTER SET utf8 COLLATE utf8_general_ci;-- Create dedicated least-privilege application operating accountCREATE USER IF NOT EXISTS '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';-- Assign strict functional schema table authorizations to application operating accountGRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';FLUSH PRIVILEGES;EOF
# Execute bootstrapping SQL script utilizing safe temporary internal server instance mysqld --user=mysql --bootstrap < /tmp/bootstrap_hardening.sql rm -f /tmp/bootstrap_hardening.sql
echo "[SUCCESS] MariaDB database hardening and relational schema bootstrap concluded!"else echo "[INFO] Persistent database configuration recognized. Resuming operational state."fi
# Execute main SQL listening daemon directly in foreground replacing execution contextexec mysqld_safe --bind-address=0.0.0.0By passing --bind-address=0.0.0.0, our MariaDB engine accepts inbound socket connections arriving across the internal Docker bridge network (inception_network), while our external container host mapping rules prevent external network attackers from directly targeting port 3306!
6. The PID 1 Daemon Lifecycle & Graceful Signal Handling
A ubiquitous architectural failure in container engineering—frequently encountered during security investigations—is improper management of Process Identifier 1 (PID 1) inside execution containers.
When the Docker Engine runs a container, whatever binary or shell script executes first is automatically assigned PID 1 inside the Linux namespace process tree. In traditional Linux operating systems, PID 1 belongs to comprehensive init systems like Systemd or SysV init, which are deliberately engineered to intercept system signals and harvest orphaned child processes (zombies).
Consider the classic flawed Docker startup entrypoint command:
# ANTI-PATTERN: DO NOT USE IN ENTERPRISE DEVOPS ENVIRONMENTS!CMD service nginx start && tail -f /dev/nullWhen an engineer writes service nginx start && tail -f /dev/null, what process occupies PID 1 inside the container namespace? It is not the NGINX web server—it is the dummy tail utility! NGINX executes merely as an orphaned, unmonitored background sub-process!
+-----------------------------------------------------------------------------+| CONTAINER PID 1 SIGNALLING EXTREMES |+-------------------------------------+---------------------------------------+| Flawed Execution (tail -f /dev/null)| Enterprise Execution (exec nginx) |+-------------------------------------+---------------------------------------+| PID 1: /bin/sh -c tail -f /dev/null | PID 1: nginx: master process || |-- PID 12: nginx master | |-- PID 12: nginx worker || |-- PID 13: nginx worker | |-- PID 13: nginx worker || | || [docker stop] -> Send SIGTERM -> | [docker stop] -> Send SIGTERM -> || Tail ignores SIGTERM! Nginx running.| Nginx intercepts SIGTERM! || 10s timeout expires -> Send SIGKILL.| Flushes open file descriptors cleanly.|| Catastrophic corruption & SQL drop! | Zero data loss; graceful zero timeout.|+-------------------------------------+---------------------------------------+When an operator issues a container shutdown instruction (docker stop inception_nginx or during automatic Kubernetes cluster upgrades), the container engine directs a standard termination POSIX signal—SIGTERM—directly to PID 1. Because primitive Bash scripts or dummy utilities like tail are not programmed with signal handler interrupt procedures, they silently discard the SIGTERM interrupt!
The container continues executing blissfully oblivious for an excruciating 10-second grace window, after which Docker concludes the container is unresponsive and unleashes a lethal SIGKILL command. SIGKILL causes instant process annihilation without allowing executing daemons to flush RAM disk cache buffers, complete SQL writing transactions, or release network TCP socket descriptors cleanly—resulting directly in catastrophic database index corruption and silent data loss!
6.1 The POSIX exec Transmutation Remedy
To guarantee immediate, zero-corruption graceful shutdown mechanics across all Inception containers, our automation scripts consistently terminate utilizing the POSIX exec shell primitive:
# Transmutate executing Shell Script context directly into target PID 1 daemonexec /usr/sbin/php-fpm8.2 -Fand in our NGINX Dockerfile:
CMD ["nginx", "-g", "daemon off;"]When a bash script encounters the exec built-in instruction, the shell script process is entirely replaced in memory space by the invoked target daemon. Our PHP-FPM, Nginx, and MariaDB server engines inherit PID 1 directly! When Docker transmits an architectural SIGTERM interrupt, our real target daemons intercept the instruction immediately, shut down active workers, finish processing open network sessions, flush relational database cache layers, and execute clean zero-delay container terminations!
7. Offensive Security Assessment: Hardening the Container Matrix
As a professional Bug Bounty Hunter and offensive penetration researcher, deploying infrastructure without subjecting it to comprehensive vulnerability enumeration and container hardening is unacceptable. Containers share the host kernel directly; misconfigurations in network exposures or filesystem permissions can effortlessly escalate into complete host server compromises.
Below is an engineering analysis of three lethal attack vectors remediated across our Inception deployment:
7.1 Defending Against Docker Socket Privilege Escalation
- The Vulnerability: Many inexperienced DevOps implementations mount the physical Docker control socket directly inside application container layers (
-v /var/run/docker.sock:/var/run/docker.sock), typically to enable administrative UI monitoring tools or automated continuous deployment builds. - The Exploitation: Any unprivileged user or compromised web application script (e.g., an Remote Code Execution via Word-Press plugin vulnerability) that gains file read/write authorization over
/var/run/docker.sockachieves instant Root Host Privilege Escalation. An attacker simply executes the Docker Socket REST API using a standard curl invocation to spin up an arbitrary new privileged container, mounting the host operating system’s root hard drive directly into/mnt/root:Terminal window curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \-d '{"Image":"debian:bookworm-slim","Cmd":["chfn","-v","pwned","/mnt/root/etc/shadow"],"HostConfig":{"Binds":["/:/mnt/root"]}}' \-X POST http://localhost/containers/create - The Remediation: In Inception, physical exposure of
/var/run/docker.sockacross application container instances is categorically forbidden. Application containers remain mathematically blind to the existence of the hosting virtualization engine.
7.2 Preventing Secrets Dumping via Docker Image History Inspection
- The Vulnerability: Embedding sensitive API keys, database administrative passwords, or production TLS certificates directly inside Dockerfiles utilizing persistent
ENV MYSQL_PASSWORD=SecretPassword123statements or committing.envplaintext files into source repository version control. - The Exploitation: When a Docker build compiles an image, every single Dockerfile statement generates a permanent read-only cryptographic filesystem layer. Even if a subsequent instruction attempts to delete the configuration file (
RUN rm -f /tmp/passwords.txt), an attacker accessing the compiled image simply invokesdocker history --no-trunc <image_id>or extracts the multi-layered TAR archives to view all historical secrets in clean unencrypted plaintext! - The Remediation: Inception decouples sensitive credential management completely away from image compilation routines. All database operational passwords, administrator credentials, and networking identification keys are injected exclusively at runtime execution via secure external environment variables (
.envfiles added explicitly to.gitignore), ensuring compiled image layers contain zero lingering sensitive data footprints!
7.3 Mitigating Server-Side Request Forgery (SSRF) Pivot Exploitation
- The Vulnerability: If a production WordPress installation contains an exploitable SSRF vulnerability (such as abusing legacy XML-RPC pingback protocols or unvalidated external webhook resource fetching routines), an attacker can coerce the web server container into scanning internal networks and executing HTTP requests against internal cloud metadata access points (e.g., AWS EC2 Instance Metadata endpoints at
169.254.169.254) or adjacent internal administrative daemons. - The Remediation: Our network architecture implements strict domain isolation. Because our WordPress compute container operates within a dedicated bridge network (
inception_network), any fraudulent SSRF instruction attempting to pivot into general enterprise LAN subnet ranges or external internal services encounters strict iptables bridge-routing isolation drops! Furthermore, our custom MariaDB user authorizations completely restrict connections to authenticated database usernames, blocking generic anonymous SSRF data extraction attempts.
8. Orchestrated Deployment & Disaster Recovery Protocols
To unify our complex infrastructure cluster into a seamless operational platform, we engineer a declarative docker-compose.yml orchestration structure accompanied by an automated disaster recovery Makefile.
8.1 Declarative Multi-Service Orchestration
version: '3.8'
services: mariadb: build: context: ./srcs/requirements/mariadb dockerfile: Dockerfile container_name: mariadb image: mariadb:inception restart: always env_file: - ./srcs/.env volumes: - /home/onevilx/data/mariadb:/var/lib/mysql networks: - inception_network
wordpress: build: context: ./srcs/requirements/wordpress dockerfile: Dockerfile container_name: wordpress image: wordpress:inception restart: always env_file: - ./srcs/.env depends_on: - mariadb volumes: - /home/onevilx/data/wordpress:/var/www/html networks: - inception_network
nginx: build: context: ./srcs/requirements/nginx dockerfile: Dockerfile container_name: nginx image: nginx:inception restart: always env_file: - ./srcs/.env depends_on: - wordpress ports: - "443:443" volumes: - /home/onevilx/data/wordpress:/var/www/html:ro networks: - inception_network
networks: inception_network: driver: bridge
volumes: mariadb_data: driver: local driver_opts: type: none device: /home/onevilx/data/mariadb o: bind wordpress_data: driver: local driver_opts: type: none device: /home/onevilx/data/wordpress o: bindNotice our defensive application of read-only access restriction flags on NGINX volume mapping (/var/www/html:ro). Because our front-end perimeter web proxy solely reads static content files without writing updates back into application folders, enforcing read-only mounting prevents any theoretical compromise of the external NGINX gateway from deploying malicious back-door shells (.php files) into WordPress operational directories!
8.2 Operational Disaster Recovery Evaluation
To mathematically verify our resilience against unexpected server infrastructure outages, we execute systematic destructive testing protocols using our automated administration Makefile:
# Simulating total unexpected server application cluster crashmake downsudo rm -rf /var/lib/docker/containers/* # Force physical termination# Execute instant zero-intervention infrastructure reconstructionmake upResult: Upon issuing make up, our Docker Compose orchestration engine rebuilds required network bridge topologies, reinstantiates clean ephemeral application container daemons, bridges back into persistent physical host bind directory storage layers (/home/onevilx/data/), and effortlessly restores full, zero-corruption enterprise application service operation within less than 4.2 seconds!
9. Conclusion: Container Literacy in Modern Security Operations
Engineering Inception without relying on convenient abstractions transformed my perspective on modern cloud network engineering and cybersecurity exploitation. When you troubleshoot why an NGINX reverse proxy encounters an 502 Bad Gateway error, only to discover through raw kernel network namespace interrogation that your FastCGI daemon attempted binding against a local loopback interface rather than an exposed bridge adapter, you develop an architectural literacy that abstract drag-and-drop cloud management tools can never provide.
For offensive bug hunters and cybersecurity engineers, mastering container virtualization from the bare kernel up provides unprecedented diagnostic leverage. You stop viewing Docker containers as opaque black-box magic, and instead recognize them as sophisticated arrangements of namespaces, control groups, volume mounts, and network routing rules—each presenting distinct surfaces for optimization, defensive defense-in-depth design, and strategic exploit reconnaissance.
Explore the Codebase
Ready to inspect the custom Dockerfiles, examine our zero-intervention bash bootstrapping scripts, and test the multi-container orchestration architecture directly in your terminal? Access the full, documented repository on GitHub:
onevilx / inception
Hardened multi-container Linux infrastructure built from raw Debian Dockerfiles
onevilx