Repository navigation
Add macOS enterprise setup script for armis-cli and MCP rollout - #369
Open
yiftach-armis wants to merge 7 commits into
Open
yiftach-armis wants to merge 7 commits into
yiftach-armis wants to merge 7 commits into
Conversation
- Add `make test-scripts` (shellcheck + bats) and a macOS CI job, since the script targets the stock bash 3.2 on macOS. - Add stubs for armis-cli, curl, sudo, id, pgrep, python3.12 and the JSON merge helper so tests run without network or root, using a temporary HOME. - Unignore test/scripts/stubs/armis-cli, which the `armis-cli` ignore rule would otherwise exclude. - Document fleet/MDM deployment in README and SSO-SETUP.
- Add scripts/enterprise-setup.sh to install a pinned, checksum-verified armis-cli, authenticate, register the MCP server in detected editors and agents, and verify the result. It runs by hand or from an MDM. - Back up each client config before changing it, skip invalid JSON, and restore the backup if registration fails, so one client's failure does not affect the others or remove a user's existing servers. - Report per endpoint, user and component, with a JSON file and exit codes 0-3 that an MDM can act on. - Support --dry-run and --uninstall, and keep credentials out of arguments, logs and reports. - Add bats tests with stubbed armis-cli, curl and sudo, and docs/ENTERPRISE-DEPLOYMENT.md covering configuration, MDM use and troubleshooting.
- Install and uninstall now run with `--format json`. The script reads per-client status, hook warnings and credential rotation results from that report instead of scraping the human-readable output. - Credential rotation uses `armis-cli install --rotate-credentials`. This replaces the script's own .env rewriting code. - Require armis-cli 1.27.0 or later, since earlier releases lack these flags. A lower `ARMIS_CLI_VERSION` now exits with a usage error before anything is downloaded. - Remove the feature detection for `--plugin-version` and `--project`, the VS Code settings check, and the shell JSON writer for the run report. The report is now built through the osascript helper. - Update the CLI stub, bats tests and deployment docs to match.
- Record configs that did not exist before install as "orig<TAB>-" so a failed install deletes its leftover file instead of leaving it behind. - Leave a client unchanged and report failure when its config cannot be backed up, instead of installing without a rollback path. - Run the sample scan once per user through `mcp doctor --deep` rather than a separate scan, and skip it while an SSO sign-in is pending. - Check a stored SSO session with ARMIS_DEFAULT_AUTH_METHOD unset so a broken session fails fast instead of starting a device-flow prompt. - Write the doctor support bundle to a user-writable temp dir, then copy it to the root-owned log dir. - Remove commit-gate hooks before `uninstall --force` deletes the plugin directory they exec, and do so without ARMIS_HOOK_ENABLE. - Force TMPDIR=/tmp when running as root so per-user steps can read WORK under `sudo -E`. - Update the deployment doc and add bats tests and stub support.
- Drop ARMIS_CLIENT_ID/SECRET from the environment in sso mode and during uninstall so they cannot override the SSO session or leak through sudo --preserve-env. Keep masking the dropped secret in logs. - Treat an ARMIS_CLIENTS subset as a partial uninstall instead of running `armis-cli uninstall --force`. - Verify uninstall results: fail clients with no report entry or whose JSON config still has the armis-appsec entry, and report JetBrains config edit failures instead of claiming removal. - Skip mcp doctor for users where no client was configured. - Fix servers_kept so an empty post-install config reports every previous server as lost. - Extend the armis-cli stub and bats tests to cover these cases.
Test Coverage Reporttotal: (statements) 75.4% Coverage by function |
- Resolve "latest" from the github.com releases redirect and fetch the installer from that tag instead of main. Fail with exit 2 when it cannot be resolved or is older than the minimum supported version. - Drop the api.github.com preflight check, which is no longer needed. - Leave a profile unchanged and report a warning when its managed block has a begin marker but no end marker, so a hand-edited block cannot truncate the file. Tolerate trailing whitespace on marker lines. - Treat the JetBrains per-project hint as informational on a bare run, and as a warning only with --only jetbrains. - Share version_lt and valid_version helpers. - Add tests, extend the curl stub, and update the deployment docs.
- Probe each developer's login shell for `command -v armis-cli`. Report a warning (exit 1) when the binary is missing from PATH or when a copy with a different version comes first, such as an older Homebrew install. Homebrew copies get `brew upgrade` advice. - Report an older existing armis-cli as "found, will be replaced" in dry runs, instead of "not installed". Record the replaced version after a real install. - Set `ARMIS_NO_UPDATE_CHECK` for version probes so they don't hit the network. - Add `ARMIS_LOGIN_SHELL` as a test hook, with a `loginshell` stub and bats tests for the shadowed, Homebrew, same-version and missing cases. - Document the new exit-1 cause in ENTERPRISE-DEPLOYMENT.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No linked issue.
Type of Change
Problem
Rolling out armis-cli and the Armis AppSec MCP server to many Macs is manual. Each developer has to install the CLI, sign in, and register the MCP server in every editor they use. IT teams have no way to do this from an MDM (Jamf, Kandji), check that it worked, or see which machines failed.
Solution
Adds
scripts/enterprise-setup.sh, a macOS script that can be run by hand or from an MDM. It does the following:armis-cli mcp doctor, with an optional sample scan.Safety behavior:
The script also supports
--dry-run,--uninstall,--onlyand--skip. Exit codes are 0 (ok), 1 (partial), 2 (verification failed) and 3 (bad arguments or preflight failure).Also added:
docs/ENTERPRISE-DEPLOYMENT.md, with links from the README anddocs/SSO-SETUP.md.armis-cli,curl,sudo,idandpgrep.make test-scriptstarget.Testing
Automated Tests
The new bats suite is
test/scripts/enterprise-setup.bats. It covers install, idempotent re-runs, backups and restore, malformed configs, credential handling, SSO, dry run, uninstall, and bash 3.2 compatibility. The new CI jobScript tests (macOS)runs shellcheck and bats. I have not seen a test run result for this branch, so TODO: confirm it passes.Manual Testing
TODO: not yet run against a real Mac or an MDM.
Reviewer Notes
install --format jsonand uses--rotate-credentials..gitignoregets an exception so thetest/scripts/stubs/armis-clistub can be committed.ARMIS_SAMPLE_SCAN=1, the default) uses tenant scan quota.Checklist
Screenshots (if applicable)
Not applicable.
docs/ENTERPRISE-DEPLOYMENT.mdincludes sample output.