fix: check for scp early to avoid shell ouput

This commit is contained in:
Pallav Vasa 2025-05-17 02:42:56 +00:00
parent 54e2ec2374
commit 80a3878295

View File

@ -20,6 +20,11 @@ log() {
log info "Received SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND" log info "Received SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND"
if [[ "${SSH_ORIGINAL_COMMAND:-}" == "scp -t $ALLOWED_PATH" ]]; then
eval "$SSH_ORIGINAL_COMMAND"
exit
fi
# Ensure the variable is set # Ensure the variable is set
if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then
log error "No SSH_ORIGINAL_COMMAND provided." log error "No SSH_ORIGINAL_COMMAND provided."
@ -88,8 +93,7 @@ status)
podman images podman images
;; ;;
scp) scp)
log info "Accepting scp upload to $ALLOWED_PATH" log error "Invalid scp upload path: $args"
[[ "${args}" == "-t $ALLOWED_PATH" ]] && eval "$SSH_ORIGINAL_COMMAND" || log error "Invalid scp upload path: $args"
;; ;;
*) *)
log error "Unknown command: $command" log error "Unknown command: $command"