Before you begin
Create an API key dedicated to the Package Firewall so that can authenticate to it. You can create it through one of the following methods:- Using the Endor Labs user interface, with the Package Firewall User role. See API keys to learn more.
- Using endorctl, with the
SYSTEM_ROLE_PACKAGE_FIREWALLrole. Make sure to install and configure endorctl before you create the key.
<namespace>with your namespace.<API key name>with the name of the API key for the Package Firewall use case.<YYYY-MM-DDTHH:MM:SSZ>with the API key expiration in ISO 8601 UTC format, for example2026-12-31T23:59:59Z.
Generate the MDM scripts
Clone the generator repository and run it with your namespace and Package Firewall credentials. Select your platform for the matching commands.- macOS / Linux
- Windows
-
Clone the generator repository: Clone the repository and change into the bash generator directory.
-
Generate the scripts: Pass your credentials as environment variables. This keeps them out of your shell history.
Alternatively, store the variables in a
.envfile, add.envto.gitignore, and source it.
endor-js.sh, endor-python.sh,endor-go.sh, endor-all.sh, and endor-remove.sh to out/<namespace>/. Re-running generate.sh overwrites the same directory.Upload the scripts to your MDM tool
Each generated script is self-contained with no runtime dependencies, so you upload it directly to your MDM tool. On macOS and Linux the scripts use the.sh extension; on Windows they use .ps1.
- macOS / Linux
- Windows
Run the scripts as
root. The script detects the logged-in console user and writes configuration files to the correct home directory.Kandji
Kandji
- Add the script: Go to Library > Custom Scripts > Add Script.
- Provide the script: Paste the script content or upload the file.
- Set the run context: Set Run as to Root.
- Set the frequency: Set Execution Frequency to Run once per device, or to every check-in for ongoing enforcement.
- Assign the script: Assign the script to the relevant device blueprint.
Jamf Pro
Jamf Pro
- Add the script: Go to Settings > Scripts > New and paste the script content.
- Create a policy: Go to Policies > New Policy > Scripts and add your script.
- Set the frequency: Set the Execution Frequency as appropriate.
- Scope the policy: Scope the policy to the target devices.
Generic MDM
Generic MDM
Upload the script file and run it as root. The script detects the logged-in console user and writes configuration files to the correct home directory.
How credentials are stored
The scripts write your credentials to a single source on each device and reference them from the package-manager configuration files. The storage mechanism depends on your platform.- macOS / Linux
- Windows
The scripts write all credentials to Each shell profile (
~/.config/endor/env.sh and set the file permissions to 600..zshrc, .bash_profile, and .bashrc) gets a one-line block that sources this file. The configuration files reference these variables instead of embedding credentials, except pip.conf and the go env file, which cannot expand variables.To rotate credentials, redeploy the MDM script to update env.sh on the target machines. No configuration file changes are needed.What the scripts do
Each install script writes the credential store and an Endor-managed block to the package-manager configuration files. The file locations depend on your platform.- macOS / Linux
- Windows
The
endor-js.sh script writes ~/.config/endor/env.sh and an Endor-managed block to the following files.The endor-go.sh script writes ~/.config/endor/env.sh and an Endor-managed block to the following file.The endor-python.sh script writes ~/.config/endor/env.sh and an Endor-managed block to the following files.How each package manager is configured
The scripts apply a few package-manager-specific behaviors that are the same on every platform.- JavaScript: The scripts write
_auth(base64) instead of_authToken, which bun requires. Yarn classic reads authentication from.npmrc, so the.npmrcwrite covers it. The scripts do not write the project-levelbunfig.toml. - Go: The scripts resolve the go env file path with
go env GOENV, then writeGOPROXYto it. Ifgois not installed, they fall back to the OS default path (~/Library/Application Support/go/envon macOS,~/.config/go/envon Linux, or%APPDATA%\go\envon Windows). Credentials are literal because go env files cannot expand environment variables. TheGOPROXYvalue ends in,direct, so Go downloads a module directly from its source when the firewall does not serve it. The go env file applies to everygocommand regardless of shell, and it has lower precedence than theGOPROXYprocess variable, so project-level overrides still work. - Python (pip): The scripts use a named
[endor-firewall]section, so they preserve any existing[global]settings. Credentials are literal because pip cannot expand environment variables. - Python (uv): uv ignores
pip.conf, so the scripts write the user-leveluv.toml, which references theENDOR_PYPI_URLvariable. - Python (poetry): poetry reads credentials from the
POETRY_HTTP_BASIC_ENDOR_FIREWALL_*environment variables, so no separate write step is needed. Add the source to yourpyproject.toml:
pyproject.toml and the credentials from environment variables. Add the Package Firewall as a source in each project. The source includes the URL only, never the credentials.
Preserve existing configuration
The scripts use a sentinel block pattern. Each script writes only a clearly delimited section to a configuration file and leaves everything else untouched, so existing settings survive every deployment. The following example shows an.npmrc file that already contains administrator settings. The script adds only the Endor-managed block between the BEGIN and END markers.
Remove the configuration
To offboard a machine, deploy the remove script. It strips the Endor block from every managed file and removes the credentials the install scripts added.- macOS / Linux
- Windows
Deploy
endor-remove.sh. It removes the Endor block from each configuration file and removes the credentials from ~/.config/endor/env.sh.