# benevo/esxi-unlocker architecture

> Architecture diagram of the GitHub repository benevo/esxi-unlocker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/benevo/esxi-unlocker
- Repository: https://github.com/benevo/esxi-unlocker

## Overview

1. Repository purpose  
This repo is a small ESXi-side patching package, not an application server. Its job is to modify VMware ESXi host binaries so macOS guests can boot and be managed correctly.

2. Main architectural boundary  
There are two distinct environments: the build/distribution side and the ESXi host side. `esxi-build.py` appears to produce the release artifact, while the install/uninstall/test scripts and `etc/rc.local.d/unlocker.py` run on the ESXi host itself.

3. Host patching core  
The central behavior is in the unlocker logic, which targets two VMware components: `vmware-vmx` for macOS boot support and `libvmkctl` for vSphere guest control. The architecture is therefore a binary patcher layered on top of VMware’s own ESXi runtime.

4. Startup integration  
`etc/rc.local.d/unlocker.py` indicates the patcher is wired into ESXi boot-time initialization. That means the patch is applied automatically during host startup unless explicitly disabled, rather than being a one-time manual edit.

5. Operational lifecycle  
The repo is organized around three host operations: install, validate, and uninstall. `esxi-install.sh` applies the unlocker, `esxi-smctest.sh` checks whether the patch is active, and `esxi-uninstall.sh` reverses the changes.

6. Persistent activation and rollback  
The README’s warning about uninstalling the previous version first suggests the patch changes persistent system files on the ESXi host. The uninstaller is therefore an important safety boundary, because the repo is designed to both apply and cleanly remove low-level binary modifications.

7. Boot-time control surface  
A notable runtime control is the `nounlocker` boot option, which disables the unlocker temporarily during startup. This gives the architecture a built-in bypass path for recovery and troubleshooting without removing the package.

8. Packaging and distribution flow  
The intended delivery format is a tarball copied onto the datastore, extracted on the host, and then executed from the ESXi shell or SSH. So the repo is distributed as a host-local filesystem package rather than through a centralized service or package manager.

9. Validation path  
`esxi-smctest.sh` is the verification entry point. Its expected output mentions `/bin/vmx`, `smcPresent = true`, and `custom.vgz`, showing that validation is focused on confirming the modified ESXi binaries and the SMC-related macOS support state.

10. Technology constraints  
The implementation is Python-centric for ESXi compatibility, with shell scripts used for orchestration. The repository is specifically aimed at ESXi 6.5 and 6.7, so the architecture is tightly coupled to VMware’s host binaries and boot layout for those versions.

11. Overall system view  
At a high level, the flow is: package the unlocker, deploy it to an ESXi host, patch VMware host binaries at install or boot time, optionally verify the patch, and provide a rollback path via uninstall or boot-time disablement. There are no external networked services in the architecture beyond transferring the distribution to the host.

Main entry points: [`etc/rc.local.d/unlocker.py`](https://github.com/benevo/esxi-unlocker/blob/master/etc/rc.local.d/unlocker.py) (Boot hook), [`esxi-smctest.sh`](https://github.com/benevo/esxi-unlocker/blob/master/esxi-smctest.sh) (SMC test), [`esxi-uninstall.sh`](https://github.com/benevo/esxi-unlocker/blob/master/esxi-uninstall.sh) (Uninstall), [`esxi-install.sh`](https://github.com/benevo/esxi-unlocker/blob/master/esxi-install.sh) (Install)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build & package"]
  node_build_script["Build script<br/>python packager<br/>[esxi-build.py]"]
  node_release_pkg["Release tarball<br/>deployment artifact"]
end

subgraph group_host["ESXi host runtime"]
  node_host_bundle["Host bundle<br/>host package"]
  node_install_script["Install<br/>[esxi-install.sh]"]
  node_startup_hook["Boot hook<br/>rc.local entry<br/>[unlocker.py]"]
  node_unlocker_core["Unlocker core<br/>python patcher"]
  node_vmx_patch["vmware-vmx patch<br/>binary patch"]
  node_vmkctl_patch["libvmkctl patch<br/>binary patch"]
  node_boot_toggle(("nounlocker<br/>boot option"))
  node_validate_script["SMC test<br/>shell verifier<br/>[esxi-smctest.sh]"]
  node_rollback_script["Uninstall<br/>shell remover<br/>[esxi-uninstall.sh]"]
  node_vmx_runtime["/bin/vmx<br/>vmware runtime"]
  node_smc_state(("SMC state<br/>validation signal"))
  node_custom_vgz(("custom.vgz<br/>validation marker"))
end

node_build_script -->|"packages"| node_release_pkg
node_release_pkg -->|"extracts"| node_host_bundle
node_host_bundle -->|"invokes"| node_install_script
node_install_script -->|"installs"| node_startup_hook
node_startup_hook -->|"launches"| node_unlocker_core
node_boot_toggle -.->|"disables"| node_startup_hook
node_unlocker_core -->|"patches"| node_vmx_patch
node_unlocker_core -->|"patches"| node_vmkctl_patch
node_vmx_patch -->|"affects"| node_vmx_runtime
node_validate_script -->|"checks"| node_vmx_runtime
node_validate_script -->|"expects"| node_smc_state
node_validate_script -->|"expects"| node_custom_vgz
node_rollback_script -->|"reverts"| node_unlocker_core
node_rollback_script -->|"removes"| node_startup_hook

click node_build_script "https://github.com/benevo/esxi-unlocker/blob/master/esxi-build.py"
click node_install_script "https://github.com/benevo/esxi-unlocker/blob/master/esxi-install.sh"
click node_startup_hook "https://github.com/benevo/esxi-unlocker/blob/master/etc/rc.local.d/unlocker.py"
click node_validate_script "https://github.com/benevo/esxi-unlocker/blob/master/esxi-smctest.sh"
click node_rollback_script "https://github.com/benevo/esxi-unlocker/blob/master/esxi-uninstall.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_build_script,node_release_pkg toneBlue
class node_host_bundle,node_install_script,node_startup_hook,node_unlocker_core,node_vmx_patch,node_vmkctl_patch,node_boot_toggle,node_validate_script,node_rollback_script,node_vmx_runtime,node_smc_state,node_custom_vgz toneAmber
```

## Components

### Build & package

Creates the distributable unlocker archive from the repository sources.

- [Build script](https://github.com/benevo/esxi-unlocker/blob/master/esxi-build.py): python packager · Assembles the release artifact for deployment to an ESXi host. · `esxi-build.py`
- **Release tarball**: deployment artifact · The tarball copied to the ESXi datastore and extracted on-host.

### ESXi host runtime

Components that execute on the ESXi host to patch, verify, or roll back VMware binaries.

- **Host bundle**: host package · Extracted files and scripts that are run from the ESXi shell or SSH.
- [Install](https://github.com/benevo/esxi-unlocker/blob/master/esxi-install.sh): shell installer · Applies the unlocker package onto the ESXi host. · `esxi-install.sh`
- [Boot hook](https://github.com/benevo/esxi-unlocker/blob/master/etc/rc.local.d/unlocker.py): rc.local entry · Launch point wired into ESXi startup for automatic activation. · `etc/rc.local.d/unlocker.py`
- **Unlocker core**: python patcher · Coordinates the host-side patching logic and runtime control.
- **vmware-vmx patch**: binary patch · Modifies VMware's VM process to support macOS guest boot behavior.
- **libvmkctl patch**: binary patch · Modifies VMware's guest control library to enable vSphere-side support.
- **nounlocker**: boot option · Startup flag that temporarily disables unlocker execution for recovery.
- [SMC test](https://github.com/benevo/esxi-unlocker/blob/master/esxi-smctest.sh): shell verifier · Checks whether the ESXi patches are active and macOS support is present. · `esxi-smctest.sh`
- [Uninstall](https://github.com/benevo/esxi-unlocker/blob/master/esxi-uninstall.sh): shell remover · Reverses the host-side changes made by the unlocker. · `esxi-uninstall.sh`
- **/bin/vmx**: vmware runtime · Target runtime whose patched state is validated by the test script.
- **SMC state**: validation signal · Indicates macOS guest support status such as smcPresent being true.
- **custom.vgz**: validation marker · Expected artifact or marker used to confirm the unlocker is active.

## Connections

- Build script → Release tarball: packages · Build script creates the deployable archive.
- Release tarball → Host bundle: extracts · The archive is copied to datastore and unpacked on the ESXi host.
- Host bundle → Install: invokes · Installer runs from the extracted host-side bundle.
- Install → Boot hook: installs · Installer wires the unlocker into ESXi startup.
- Boot hook → Unlocker core: launches · Boot-time hook executes the Python unlocker.
- nounlocker → Boot hook: disables · Boot option bypasses unlocker execution during startup.
- Unlocker core → vmware-vmx patch: patches · Core logic modifies vmware-vmx for macOS boot support.
- Unlocker core → libvmkctl patch: patches · Core logic modifies libvmkctl for guest control support.
- vmware-vmx patch → /bin/vmx: affects · Patched binary is validated through the VM runtime path.
- SMC test → /bin/vmx: checks · Test script inspects the modified VM runtime.
- SMC test → SMC state: expects · Verification confirms SMC-related state is enabled.
- SMC test → custom.vgz: expects · Verification looks for the unlocker-specific marker.
- Uninstall → Unlocker core: reverts · Uninstaller removes or undoes unlocker changes.
- Uninstall → Boot hook: removes · Rollback clears boot-time integration.
