README
¶
baton-jamf
baton-jamf is a connector for Jamf built using the Baton SDK. It communicates with the Jamf API to sync data about users, user accounts, groups, user groups, roles, sites, and managed devices, and can provision Jamf accounts (create/delete) and grant/revoke access to groups, user groups, roles, sites, and managed devices.
Check out Baton to learn more the project in general.
Capabilities
| Capability | Status |
|---|---|
| Sync | Yes |
| Account Creation (Users, User Accounts) | Yes — one type per connector instance, see create-account-resource-type below |
| Account Deletion (Users, User Accounts) | Yes — except the user account the connector authenticates with |
| Provisioning (Grant/Revoke) | Yes — Groups (userAccount principal only, Group Access accounts only), User Groups (static groups only), Sites (user principal only), Managed Devices (assigned, user principal only, opt-in — see Data Model below), Roles (built-in privilege sets and individual privileges, userAccount/group principal, see below). |
Account creation/deletion and Grant/Revoke all require -p/$BATON_PROVISIONING to be set; without it the connector only syncs.
Requires Jamf Pro 11.26.0 or later (GET /api/v1/users was added in 11.26.0). Managed Devices, which are opt-in, use the Jamf Pro API v4 computers-inventory endpoints, added in 11.30.0, and the v2 mobile-devices endpoints.
Authentication
Pick one method with --auth-method:
username-password(default): a local Jamf Pro account, set with--usernameand--password. The connector exchanges them for a short-lived bearer token and requests a new one shortly before it expires.api-client: a Jamf Pro API client, set with--jamf-client-idand--jamf-client-secret. Assign the client API roles that carry the privileges below. An API client can't hold the Administrator privilege set, even with every privilege, so it can't grant theAdministrator,AuditororEnrollment Onlyroles or add members to admin groups that use them; useusername-passwordwith an Administrator account for those.
Each method's flags are required only when that method is selected.
Required Jamf privileges
The Administrator privilege set covers everything. For least privilege, grant:
| Task | Privilege |
|---|---|
| Startup, config validation, token refresh | None — any enabled local Jamf Pro account or API client (every Custom set also keeps Read License Information) |
| Sync users | Read User |
| Sync user accounts and groups | Read Accounts |
| Sync user groups | Read Static User Groups, Read Smart User Groups (Smart is only needed when smart groups exist — it's checked per group) |
| Sync sites | Read Sites, Read Accounts |
| Sync roles | Read API Roles, Read Accounts |
| Sync managed devices (opt-in) | Read Computers, Read Mobile Devices |
| Create/delete users | Create User and Read User (the connector reads the user back after creating); Delete User |
| Create/delete user accounts | Create Accounts and Read Accounts; Delete Accounts |
Group Grant/Revoke (userAccount principal) |
Read Accounts, Update Accounts, Read Account Groups |
Role Grant/Revoke (userAccount/group principal) |
Read Accounts, Update Accounts (Read API Roles is not needed for writes) |
| User Group Grant/Revoke (static group) | Read Static User Groups, Update Static User Groups |
Site Grant/Revoke (user principal) |
Read User, Update User |
| Managed Device Grant/Revoke | Computers: Read Computers, Update Computers, Read User. Mobile devices: Read Mobile Devices, Update Mobile Devices, Read User, plus Assign Users to Mobile Devices to Grant (clearing the assignee on Revoke doesn't need it) |
Read Accounts/Create Accounts/Update Accounts/Delete Accounts cover both admin user accounts and admin groups; reading a group's members for Group Grant/Revoke needs Read Account Groups. Every write path reads the object first, so each Update privilege above needs its Read counterpart too.
Without the Administrator privilege set, Jamf only lets an account or API client hand out privileges it holds itself:
- Granting or revoking an
Administrator,AuditororEnrollment Onlyrole, and adding or removing a member of a group that has one of them, need the Administrator privilege set, which an API client can't hold. - Changing a
Customaccount or group, including adding or removing a group member, needs every privilege it holds, includingRead License Information, which everyCustomset keeps. - Deleting an account needs neither.
A missing privilege fails the sync or the operation with a permission error.
Group Grant/Revoke adds or removes a userAccount from an admin account
group's member list. Only Group Access accounts can usefully be granted
membership — a Full or Site Access account's rights come from its own
privilege_set, not its groups, so Grant rejects adding one (membership grants
it nothing). For accounts C1 creates, set the access_level profile field to
Group Access (see account creation below). Do not use Grant/Revoke on
directory (LDAP) groups: their membership is managed by the directory and the
connector does not detect them.
Smart User Groups cannot be granted/revoked: Grant fails with
cannot grant membership on smart user group <id> — membership is computed from criteria, not assignable and Revoke with cannot revoke membership on smart user group <id>. Site Grant/Revoke is only provisionable for the user principal;
userGroup/userAccount/group site membership remains sync-only (single-
valued/exclusive, not a true membership list). Managed Device assigned is
single-valued — granting it to a new user displaces whichever user was
previously assigned. Every device has the assigned entitlement, so Grant
also assigns a previously-unassigned device to a user. Computers use the Jamf
Pro v4 computers-inventory API.
Granting a computer overwrites the assignee's username, name, email,
position and phone with the new user's values (Jamf never fills these in on
its own for computers); Revoke clears all five. Mobile devices only ever
have their username set directly — Jamf derives the assignee's name, email
and phone from the directory automatically, and Revoke clears all of them
together by clearing the username.
Role Grant/Revoke sets or clears a userAccount or group's role. All three
built-in privilege sets (Administrator, Auditor, Enrollment Only) and
every individual privilege are grantable — Custom itself is not a role you
grant directly. Granting a set displaces whichever one the principal
previously held. Revoke moves the principal to Custom with only the
Read License Information privilege, which can't be revoked itself.
Individual privileges can
only be granted while the principal's privilege_set is already Custom:
the flow is Revoke the current set first (which moves it to Custom), then
Grant the individual privileges — granting a built-in set again later leaves
Custom and discards those individual privileges. A principal with a built-in
set already holds each of its privileges: granting one succeeds without a
change, and revoking one fails with "its privilege set includes it; change the
privilege set instead". Group Access accounts are
not supported for Role Grant/Revoke — their rights come from their groups, so
assign the role to the group instead. Changing a Full or Site Access
account's role removes it from any admin group it belonged to. A write rejected for the connector's own Jamf
account is reported as a permission error.
Sync cost
Requests per full sync:
| Resource type | Requests |
|---|---|
user |
max(1, ⌈users / 1000⌉) |
userAccount |
max(1, ⌈accounts / 100⌉) |
group |
1, plus one read per group |
userGroup |
1, plus one read per user group |
site |
1, plus per site ⌈users / 1000⌉ + 1, ⌈user groups / 1000⌉ + 1 and max(1, ⌈accounts / 100⌉), each only when user, userGroup or userAccount is synced |
role |
1, plus max(1, ⌈accounts / 10⌉) and one read per account, when userAccount is synced |
managedDevice |
max(1, ⌈computers / 100⌉) + max(1, ⌈mobile devices / 100⌉) for the device list, plus max(1, ⌈computers / 1000⌉) + max(1, ⌈mobile devices / 1000⌉) for the grants |
Validation adds one request, plus one token request per new process (each Lambda container) and each time the token expires. Most SDK calls make one request; the largest is a role grants page of accounts, which reads each one's details (up to 11). A group or user group detail comes back whole, so that read grows with the size of the group. For example, 50,000 users, 1,000 accounts, 50 groups, 200 user groups, 20 sites holding the users and 20,000 devices come to roughly 1,800 requests; sync time is about that count times the instance's API response time.
Account creation
--create-account-resource-type ($BATON_CREATE_ACCOUNT_RESOURCE_TYPE) picks
the account type C1 creates: user (default, directory users) or
userAccount (Jamf Pro console admins). New accounts are enabled. A
userAccount gets a random password; a user has no password.
The login is required (C1 sets it automatically), and so is access_level for a userAccount. All other profile fields are optional:
| Field | Account type | Values | If empty |
|---|---|---|---|
full_name |
Both | Any text | Not set |
email |
Both | An email address | Not set |
access_level |
userAccount |
"Full Access" or "Group Access" |
Required |
access_leveldecides which grants work once the account exists:Group Accessfor an account that gets access from Jamf admin groups (grant the Group entitlement),Full Accessfor an account that gets roles or privileges (grant the Role entitlement).- C1 mappings are CEL expressions. To choose
access_levelfrom what was requested, map it torequested_entitlement.app_resource_type == "group" ? "Group Access" : "Full Access"(app_resource_typeis the requested resource type's name in lowercase). A fixed value keeps its quotes, for example"Group Access". access_levelis case-sensitive, and a missing or unknown value fails the request before it reaches Jamf.
The privileges these need are in Required Jamf privileges. If Jamf rejects a request, the error carries Jamf's reason.
Getting Started
Prerequisites
- Jamf Pro instance
brew
brew install conductorone/baton/baton conductorone/baton/baton-jamf
baton-jamf
baton resources
docker
docker run --rm -v $(pwd):/out -e BATON_USERNAME=jamfUsername -e BATON_PASSWORD=jamfPassword -e BATON_INSTANCE_URL=https://jamfProServerUrl.example.com public.ecr.aws/conductorone/baton-jamf:latest -f "/out/sync.c1z"
docker run --rm -v $(pwd):/out ghcr.io/conductorone/baton:latest -f "/out/sync.c1z" resources
source
go install github.com/conductorone/baton/cmd/baton@main
go install github.com/conductorone/baton-jamf/cmd/baton-jamf@main
BATON_USERNAME=jamfUsername BATON_PASSWORD=jamfPassword BATON_INSTANCE_URL=https://jamfProServerUrl.example.com baton-jamf
baton resources
Data Model
baton-jamf pulls down information about the following Jamf resources:
- Users
- Groups
- User Accounts
- User Groups
- Roles
- Sites
- Managed Devices — opt-in in C1, for cloud-hosted and self-hosted connectors
alike. A run not connected to C1 syncs it unless
--sync-resource-types/$BATON_SYNC_RESOURCE_TYPESleaves it out (e.g.user,userAccount,group,userGroup,role,site). Provisioning for devices is only available whenmanagedDeviceis included in the sync.
Account creation/deletion and Grant/Revoke (see Capabilities above) all
require -p/$BATON_PROVISIONING.
Contributing, Support, and Issues
We started Baton because we were tired of taking screenshots and manually building spreadsheets. We welcome contributions, and ideas, no matter how small -- our goal is to make identity and permissions sprawl less painful for everyone. If you have questions, problems, or ideas: Please open a Github Issue!
See CONTRIBUTING.md for more details.
baton-jamf Command Line Usage
baton-jamf
Usage:
baton-jamf [flags]
baton-jamf [command]
Available Commands:
capabilities Get connector capabilities
check-update Check whether a newer stable connector release is available
completion Generate the autocompletion script for the specified shell
config Get the connector config schema
health-check Check the health of a running connector
help Help about any command
Flags:
--auth-method string ($BATON_AUTH_METHOD)
--client-id string The client ID used to authenticate with ConductorOne ($BATON_CLIENT_ID)
--client-secret string The client secret used to authenticate with ConductorOne ($BATON_CLIENT_SECRET)
--create-account-resource-type string Which Jamf account type C1 should create when provisioning accounts. 'user' (default) creates directory users; 'userAccount' creates Jamf Pro console admin accounts. Only one type can be created at a time per connector instance. ($BATON_CREATE_ACCOUNT_RESOURCE_TYPE) (default "user")
-f, --file string The path to the c1z file to sync with ($BATON_FILE) (default "sync.c1z")
-h, --help help for baton-jamf
--instance-url string required: Base URL of your Jamf Pro instance, including https:// (for example https://yourcompany.jamfcloud.com) ($BATON_INSTANCE_URL)
--jamf-client-id string required: Client ID of a Jamf Pro API client ($BATON_JAMF_CLIENT_ID)
--jamf-client-secret string required: Client secret of a Jamf Pro API client ($BATON_JAMF_CLIENT_SECRET)
--log-format string The output format for logs: json, console ($BATON_LOG_FORMAT) (default "json")
--log-level string The log level: debug, info, warn, error ($BATON_LOG_LEVEL) (default "info")
--password string required: Password for your Jamf Pro instance ($BATON_PASSWORD)
-p, --provisioning This must be set in order for provisioning actions to be enabled ($BATON_PROVISIONING)
--skip-entitlements-and-grants This must be set to skip syncing of entitlements and grants ($BATON_SKIP_ENTITLEMENTS_AND_GRANTS)
--skip-full-sync This must be set to skip a full sync ($BATON_SKIP_FULL_SYNC)
--sync-resource-types strings The resource type IDs to sync ($BATON_SYNC_RESOURCE_TYPES)
--sync-resources strings The resource IDs to sync ($BATON_SYNC_RESOURCES)
--ticketing This must be set to enable ticketing support ($BATON_TICKETING)
--username string required: Username for your Jamf Pro instance ($BATON_USERNAME)
-v, --version version for baton-jamf
Use "baton-jamf [command] --help" for more information about a command.
See --help for the full, up-to-date list of flags (this trims flags shared by every Baton connector that are rarely needed, e.g. OpenTelemetry and worker-tuning options).
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
baton-jamf
command
|
|
|
pkg
|
|
|
config
Code generated by baton-sdk.
|
Code generated by baton-sdk. |
|
config/gen
command
|
|
|
Package main implements a mock Jamf Pro server (Classic API, the /api/v1/auth and /api/v1/oauth/token endpoints, and the Pro users, accounts and site objects endpoints) for testing the baton-jamf connector without a real Jamf Pro tenant.
|
Package main implements a mock Jamf Pro server (Classic API, the /api/v1/auth and /api/v1/oauth/token endpoints, and the Pro users, accounts and site objects endpoints) for testing the baton-jamf connector without a real Jamf Pro tenant. |