Skip to content

All your computers and your phone/iPhone, working as one desk. Screens, apps, files, clipboard, calls, texts, notifications, mouse and keyboard, shared between Mac, Windows, Linux , Android, Web and ios / ipados . Free and open source. No account, no cloud, and no shared network needed.

1.5 KB
Raw Blame
#!/bin/sh
# TwinDesk — Copyright (C) 2026 inukaasith. GPL-3.0, see LICENSE.
# Biometric unlock on a real Linux (docs/full-kvm.md), as root in a VM (linux/scripts/vm-test.sh sh): the
# real pam_twindesk.so against the real Unlock of linux/fullkvm/service.js, the phone being a P-256 key in
# Node (pam-e2e.js). A test PAM service (twindesk-test: pam_twindesk then pam_deny) and pamtester stand in
# for the login screen. Needs gcc, libpam0g-dev, pamtester and node.
#   sudo sh linux/fullkvm/test/pam-e2e.sh        → yes: authenticated; no and a forged key: refused
set -e
cd "$(dirname "$0")/../../.."
T=$(mktemp -d /tmp/twindesk-pam.XXXXXX)
gcc -O2 -Wall -Wextra -std=gnu11 -fPIC -shared linux/fullkvm/pam/pam_twindesk.c -o "$T/pam_twindesk.so" -lpam
printf 'auth sufficient %s/pam_twindesk.so\nauth required pam_deny.so\naccount required pam_permit.so\n' "$T" > /etc/pam.d/twindesk-test
USER1=$(getent passwd 1000 | cut -d: -f1)
fail=0
for answer in yes no forged; do
  TWINDESK_UNLOCK_DIR="$T/keys" node linux/fullkvm/test/pam-e2e.js "$answer" > "$T/svc.log" 2>&1 &
  svc=$!
  sleep 1.5
  if pamtester twindesk-test "$USER1" authenticate </dev/null >"$T/pam.log" 2>&1; then got=yes; else got=no; fi
  wait $svc || true
  want=no; [ "$answer" = yes ] && want=yes
  if [ "$got" = "$want" ]; then echo "ok - $answer: $(tail -1 "$T/pam.log")"; else echo "FAIL - $answer: got $got"; cat "$T/pam.log" "$T/svc.log"; fail=1; fi
done
rm -f /etc/pam.d/twindesk-test /run/twindesk/unlock.sock
rm -rf "$T"
exit $fail