aboutsummaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorRuben Beltran del Rio <jj@r.bdr.sh>2026-04-30 16:12:12 +0200
committerRuben Beltran del Rio <jj@r.bdr.sh>2026-04-30 16:13:44 +0200
commitc2e5c0acf4d88a2ba058067cb0955578104c0827 (patch)
tree6b95f7ea9f5cda5219a95fdbde782834f04295a9 /extras
parent42fc9a475070728fde00909310cd7a995168425b (diff)
Update SSH wrapper
Diffstat (limited to 'extras')
-rwxr-xr-xextras/estampa-ssh22
1 files changed, 21 insertions, 1 deletions
diff --git a/extras/estampa-ssh b/extras/estampa-ssh
index 4b2202f..eeee862 100755
--- a/extras/estampa-ssh
+++ b/extras/estampa-ssh
@@ -16,9 +16,29 @@ PASTE_DIR="${1:?usage: estampa-ssh <paste-dir>}"
estampa --run "$PASTE_DIR" >/dev/null 2>&1 || true
case "${SSH_ORIGINAL_COMMAND:-}" in
- "scp -t "*|"scp -f "*|"/usr/lib/openssh/sftp-server"|"internal-sftp")
+ "scp -t "*|"scp -f "*)
+ # Legacy scp protocol (`scp -O ...` on the client).
exec $SSH_ORIGINAL_COMMAND
;;
+ */sftp-server|*/sftp-server\ *)
+ # Modern scp uses SFTP; sshd sets SSH_ORIGINAL_COMMAND to the
+ # subsystem path defined by `Subsystem sftp ...` in sshd_config.
+ exec $SSH_ORIGINAL_COMMAND
+ ;;
+ internal-sftp|"internal-sftp "*)
+ # `Subsystem sftp internal-sftp` runs in-process inside sshd,
+ # but here we're outside sshd so we need a real binary.
+ for sftp in \
+ /usr/lib/ssh/sftp-server \
+ /usr/lib/openssh/sftp-server \
+ /usr/libexec/sftp-server \
+ /usr/libexec/openssh/sftp-server
+ do
+ [ -x "$sftp" ] && exec "$sftp"
+ done
+ echo "estampa-ssh: no sftp-server binary found" >&2
+ exit 1
+ ;;
*)
echo "estampa-ssh: only scp/sftp uploads are allowed" >&2
exit 1