B2 Middleware enables managed clients to securely access a munki repo from Backblaze's B2 Cloud Storage. B2 offers aggressive pricing for both storage and access.
B2 Middleware uses a private Application Key to get authorization for private B2 resources. Each request includes an expiration date after which the request is no longer valid.
- Backblaze B2 private bucket with your munki repo inside.
- B2 Account ID and Application Key.
- As of version 1.1 we support application keys with restricted permissions. This would be the preferred method in which to use this middleware.
-
Install
middleware_b2.py
to/usr/local/munki/
. -
Install
b2-root.pem
to/usr/local/munki/
. This is required for munki embedded python3 compatibility -
Set the munki preference
SoftwareRepoURL
to the following format:https://b2/BUCKET_NAME/PATH
This middleware looks specifically for a URL starting with https://b2 to be triggered. The first folder will be your bucket name. If you have your munki repo within a subfolder on this bucket please also provide that as well. The additional path is not needed if your repo is based at the root of your bucket.
-
Set B2 Middleware preferences for your Account ID, Application Key, and the resource expiration timeout in seconds. If unset expiration will default to 30 minutes.
sudo defaults write /Library/Preferences/ManagedInstalls B2AccountID -string "ACCOUNT_ID" sudo defaults write /Library/Preferences/ManagedInstalls B2ApplicationKey -string "APPLICATION_KEY" sudo defaults write /Library/Preferences/ManagedInstalls B2ValidDuration -int 3600
-
Run munki and verify that B2 requests are being made.
sudo managedsoftwareupdate --checkonly -vvv
The included luggage makefile can be used to create an installer package for B2 Middleware.
- Replace the
account_id
andapplication_key
on line 4+5 of the postinstall script with the appropriate values from Backblaze B2. make pkg
and install.- Set your
SoftwareRepoURL
to https://b2/BUCKET_NAME/PATH as stated in step 2 above.
One way you can sync your repo with B2 is with the commandline tool. For example:
b2 sync --excludeRegex '(.*\.DS_Store)|(.*\.git/.*)' --delete /path/to/munki/ https://b2/<B2_BUCKET_GOES_HERE>