A lightweight Go web server for serving Munki repositories with AWS CloudFront signed URL support for secure package downloads.
munkisrv is a Go web server for serving Munki repositories. It comes with built-in support for generating AWS CloudFront pre-signed URLs.
munkisrv is a lightweight HTTP server designed to serve Munki repositories. It provides:
/healthzThe server provides three main endpoints:
GET /healthz - Health check endpointGET /repo/* - Serves static Munki repository filesGET /repo/pkgs/* - Redirects to signed CloudFront URLs for package downloadsCreate a config.yaml file with the following structure:
# Server configurations
server:
host: "localhost"
port: ":3000"
# CloudFront configurations
cloudfront:
url: "https://your-distribution.cloudfront.net"
key_id: "YOUR_CLOUDFRONT_KEY_ID"
private_key: |
-----BEGIN PRIVATE KEY-----
YOUR_PRIVATE_KEY_CONTENT_HERE
-----END PRIVATE KEY-----
Configuration can be overridden using environment variables with the prefix ENV_:
ENV_SERVER_HOST - Server hostENV_SERVER_PORT - Server portENV_CLOUDFRONT_URL - CloudFront distribution URLENV_CLOUDFRONT_KEY_ID - CloudFront key pair IDENV_CLOUDFRONT_PRIVATE_KEY - CloudFront private keyClone the repository
Build the binary:
go build ./cmd/munkisrv
Run the server with a configuration file:
./munkisrv -c path/to/config.yaml
The server will start on the configured port (default: :3000) and serve:
/repo/*/repo/pkgs/*/healthzSend a test request:
curl http://127.0.0.1:3000/repo/catalogs/all
Configure munki to connect:
sudo defaults write /Library/Preferences/ManagedInstalls.plist SoftwareRepoURL http://127.0.0.1:3000/repo
github.com/aws/aws-sdk-go-v2/feature/cloudfront/sign - CloudFront URL signinggithub.com/go-chi/chi/v5 - HTTP router and middlewaregithub.com/spf13/viper - Configuration managementThe server uses AWS CloudFront signed URLs to secure package downloads. Private keys are parsed and validated at startup to ensure proper cryptographic operations.
This service does not provide authentication or authorization — users are expected to handle both outside of this web service (e.g., via a reverse proxy, network policy, or service mesh)
The /healthz endpoint checks the availability of the embedded Munki repository by attempting to open the catalogs/all file. This ensures the server is properly configured and the repository is accessible.
This server is designed to work with the Munki open-source software deployment system for macOS. It serves the repository structure that Munki clients expect:
At a minimum, configure your munki client to access the /repo path at your domain.
sudo defaults write /Library/Preferences/ManagedInstalls.plist SoftwareRepoURL https://<yourdomain>/repo
Ensure munki is configured to follow HTTP redirects.
sudo defaults write /Library/Preferences/ManagedInstalls.plist FollowHTTPRedirects https