Files
connector-macos/smoketest/scenarios/70-apps.sh
T
David YoungandClaude Opus 5.5 eab26c0888 Stop SSHFS hanging, and name the real reason Gatekeeper refuses an app
With macFUSE's FSKit extension off, sshfs waits forever and ignores TERM;
sftp_mount gives it 30 seconds, then stops it and says to turn macFUSE on.

On a Mac that allows only App Store apps, app_install said the download
"isn't notarized"; it now says the Mac only allows App Store apps, and where
to change that.

The vanilla image is like that and since macOS 15 only System Settings or
MDM can change it, so 70-apps checks the message and skips the installs
there. 85-sftp checks that add_sftp gives up while the extension is off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:01:03 -07:00

73 lines
2.6 KiB
Bash

# shellcheck shell=bash
DESCRIPTION="Downloads Element, Nextcloud and Tailscale with Gatekeeper on: Team IDs, notarization, refusals"
TIER=all
source "$CONNECTOR/configure.d/lib/json.sh"
source "$CONNECTOR/configure.d/lib/apps.sh"
gatekeeper_on() {
spctl --status | grep -q 'assessments enabled'
}
# An app no one notarized: Gatekeeper should turn it down
unnotarized_refused() {
local app="$TMPDIR/Unnotarized.app"
rm -rf "$app"
osacompile -o "$app" -e 'return' && codesign --force --sign - "$app" > /dev/null 2>&1 || return 2
! spctl --assess --type execute "$app" 2> /dev/null
}
# Tailscale's package, offered as someone else's
wrong_team_refused() {
local pkg="$TMPDIR/tailscale.pkg"
app_info tailscale
curl -fsL --max-time 600 -o "$pkg" "$APP_URL" || return 2
APP_TEAM=ZZZZZZZZZZ
! install_pkg "$pkg"
}
# Tailscale's real package, turned down with the reason that applies
app_store_only_refused() {
local out
out="$(app_install tailscale 2>&1)" && return 1
echo "$out" | grep -q "only allows apps from the App Store"
}
team_of() {
codesign -dv "$(app_path "$1")" 2>&1 | sed -n 's/^TeamIdentifier=//p'
}
nextcloud_opens() {
open -a "$(app_path nextcloud)" --args --overrideserverurl https://nextcloud.smoke.invalid
sleep 10
pgrep -x Nextcloud > /dev/null
}
scenario() {
local app
# The vanilla image turns Gatekeeper off; a real Mac has it on
sudo spctl --global-enable 2> /dev/null || sudo spctl --master-enable 2> /dev/null
check "Gatekeeper is on" gatekeeper_on
gatekeeper_on || { skip "Gatekeeper couldn't be turned on, so the checks below prove less"; }
check "Gatekeeper turns down an app no one notarized" unnotarized_refused
check "install_pkg refuses a package signed by another Team ID" wrong_team_refused
# The vanilla image also allows only App Store apps, and since macOS 15
# only System Settings (a click) or MDM can change that
if ! developer_id_allowed; then
check "app_install says this Mac only allows App Store apps" app_store_only_refused
skip "Gatekeeper here only allows App Store apps, so Element, Nextcloud and Tailscale can't install (see README)"
return
fi
for app in element nextcloud tailscale; do
step "$app"
check "app_install $app (its Team ID and notarization check out)" app_install "$app"
app_info "$app"
check_eq "$app's Team ID is the one in apps.sh" "$APP_TEAM" "$(team_of "$app")"
done
check "Nextcloud opens with the Core's address" nextcloud_opens
pkill -x Nextcloud 2> /dev/null
skip "Tailscale's VPN approval and Nextcloud's sign-in need clicks: check those by hand"
}