Mount SFTP folders in network storage, as CoreDesktop does
configure storage now finds machines that announce SFTP as well as SMB servers, and takes sftp://[user@]host[:port][/path] addresses. Folders are mounted with SSHFS on macFUSE, as you, with your SSH keys (Bitwarden's SSH agent while it runs one), and never ask for a password. storage-mount mounts them again at login and when the network changes, as it does SMB shares; each line of the list now records its mount point. macFUSE and SSHFS are offered for download, checked against their Team ID (3T5GSNBU6W, read from the packages' signatures). On macOS 26 and later macFUSE mounts through FSKit, whose extension you turn on once in System Settings. Earlier macOS needs its kernel extension, which this uses if it's running but doesn't set up. smoketest: 85-sftp installs both and mounts a folder from the VM itself over SSH, if macFUSE's extension can be turned on there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,7 @@ Each scenario runs on a fresh clone of Cirrus Labs' **vanilla** macOS image (def
|
||||
| `60-backup` | restic and rclone download. A local WebDAV server stands in for Nextcloud. The Federated Backup app is built and answers whether it has Full Disk Access. launchd runs a backup, a snapshot appears, a file restores from it, and a second run the same day does nothing. Turning backups off removes the app and the job. |
|
||||
| `70-apps` *(all)* | With Gatekeeper on: an un-notarized app is turned down, and a package signed by the wrong Team ID is refused. Element, Nextcloud and Tailscale download and install, and their Team IDs match `apps.sh`. Nextcloud opens with the Core's address. |
|
||||
| `80-storage` | The launchd job is added with the first share and removed with the last; a share whose server can't be reached is skipped quickly without asking |
|
||||
| `85-sftp` | macFUSE and SSHFS install, with their Team IDs checked; FSKit is chosen on macOS 26. Then it tries to turn on macFUSE's extension with `pluginkit`. If that works, the VM mounts a folder from itself over SSH, a file reads and writes through the mount, and storage-mount mounts it again after it's unmounted. |
|
||||
|
||||
## What still needs a person
|
||||
|
||||
@@ -64,6 +65,7 @@ macOS deliberately allows these only with a click, so test them by hand on a VM
|
||||
|
||||
- **Installing the profile:** in System Settings > Profiles, choose "Federated Core (...)", then Install. Then check Mail, Calendar and Contacts against a real Core. `configure core` notices the profile was installed.
|
||||
- **Full Disk Access for Federated Backup:** after granting it, `configure backup` says it can read all your files, and the backup log no longer has permission errors for Documents and Desktop.
|
||||
- **Turning on macFUSE's file system extension**, if `85-sftp` couldn't do it with `pluginkit`: then mount an SFTP folder with `configure storage`.
|
||||
- **Mounting a real SMB share:** the sign-in window, "Remember this password in my keychain", and whether `mount volume "smb://host"` without a share offers a list of shares.
|
||||
- **Tailscale's VPN approval**, and **Nextcloud's sign-in** in the browser.
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# shellcheck shell=bash
|
||||
DESCRIPTION="SFTP folders: macFUSE and SSHFS install, and the VM mounts a folder from itself over SSH"
|
||||
TIER=quick
|
||||
|
||||
source "$CONNECTOR/configure.d/60-storage.sh"
|
||||
SOURCE_DIR="$HOME/sftp-source"
|
||||
URL="sftp://$USER@localhost$SOURCE_DIR"
|
||||
|
||||
job_loaded() {
|
||||
launchctl print "gui/$(id -u)/$LABEL" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# The id of macFUSE's file system extension, as pluginkit lists it
|
||||
fsmodule_id() {
|
||||
pluginkit -m -A -D -p com.apple.fskit.fsmodule 2> /dev/null | grep -i macfuse | head -n 1 \
|
||||
| sed -E 's/^[-+=!? ]*//; s/[[:space:]]*\(.*$//; s/[[:space:]].*$//'
|
||||
}
|
||||
|
||||
point_of() {
|
||||
awk -F'|' -v url="$URL" '$1 == url { print $2 }' "$STORAGE_CONF"
|
||||
}
|
||||
|
||||
reads_through_mount() {
|
||||
[ "$(cat "$(point_of)/hello.txt")" = "hello over sftp" ]
|
||||
}
|
||||
|
||||
writes_through_mount() {
|
||||
echo written > "$(point_of)/from-mount.txt" && [ "$(cat "$SOURCE_DIR/from-mount.txt")" = written ]
|
||||
}
|
||||
|
||||
remounts() {
|
||||
local point
|
||||
point="$(point_of)"
|
||||
sftp_unmount "$point" || return 1
|
||||
sftp_mounted "$point" && return 1
|
||||
bash "$STORAGE_MOUNT"
|
||||
sleep 3
|
||||
sftp_mounted "$point"
|
||||
}
|
||||
|
||||
scenario() {
|
||||
local backend id
|
||||
check "fuse_backend picks one" fuse_backend
|
||||
backend="$(fuse_backend)"
|
||||
[ -n "$backend" ] || { skip "This macOS can't mount over SFTP without macFUSE's kernel extension"; return; }
|
||||
check_eq "it's FSKit on macOS 26 and later" fskit "$backend"
|
||||
|
||||
step "Installing macFUSE and SSHFS (Team IDs checked)"
|
||||
check "app_install macfuse" app_install macfuse
|
||||
check "app_install sshfs" app_install sshfs
|
||||
check "sshfs runs" "$SSHFS" --version
|
||||
|
||||
step "macFUSE's file system extension"
|
||||
id="$(fsmodule_id)"
|
||||
if [ -z "$id" ]; then
|
||||
skip "pluginkit doesn't list macFUSE's extension, so fskit_enabled can't tell whether it's on"
|
||||
else
|
||||
check "pluginkit lists it ($id)" true
|
||||
fskit_enabled || pluginkit -e use -i "$id" 2> /dev/null
|
||||
sleep 2
|
||||
fi
|
||||
if ! fskit_ready; then
|
||||
skip "Turning macFUSE's extension on needs a click in System Settings: check mounting by hand"
|
||||
return
|
||||
fi
|
||||
|
||||
step "A folder from this Mac, over SSH"
|
||||
mkdir -p "$HOME/.ssh" "$SOURCE_DIR"
|
||||
echo "hello over sftp" > "$SOURCE_DIR/hello.txt"
|
||||
[ -f "$HOME/.ssh/id_ed25519" ] || ssh-keygen -q -t ed25519 -N '' -f "$HOME/.ssh/id_ed25519"
|
||||
cat "$HOME/.ssh/id_ed25519.pub" >> "$HOME/.ssh/authorized_keys"
|
||||
ssh-keyscan -H localhost >> "$HOME/.ssh/known_hosts" 2> /dev/null
|
||||
mkdir -p "$CONF_DIR"
|
||||
: > "$STORAGE_CONF"
|
||||
check "sftp_key_works" sftp_key_works "$URL"
|
||||
check "add_sftp mounts it and adds it to the list" add_sftp "$URL"
|
||||
check "launchd has the job" job_loaded
|
||||
check "a file reads through the mount" reads_through_mount
|
||||
check "a file written through the mount lands on the server" writes_through_mount
|
||||
check "storage-mount mounts it again after it's unmounted" remounts
|
||||
check "remove_share" remove_share "$URL" "$(point_of)"
|
||||
check_not "it's no longer in the list" grep -qF "$URL" "$STORAGE_CONF"
|
||||
}
|
||||
Reference in New Issue
Block a user