Compare commits
2 Commits
54e2ec2374
...
f8a09a135b
Author | SHA1 | Date | |
---|---|---|---|
f8a09a135b | |||
80a3878295 |
@ -18,7 +18,18 @@ log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $*" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
log info "Received SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND"
|
||||
logO() {
|
||||
local level="${1^^}" # convert to uppercase
|
||||
shift
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $*" >>"$LOG_FILE"
|
||||
}
|
||||
|
||||
logO 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
|
||||
if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then
|
||||
@ -88,8 +99,7 @@ status)
|
||||
podman images
|
||||
;;
|
||||
scp)
|
||||
log info "Accepting scp upload to $ALLOWED_PATH"
|
||||
[[ "${args}" == "-t $ALLOWED_PATH" ]] && eval "$SSH_ORIGINAL_COMMAND" || log error "Invalid scp upload path: $args"
|
||||
log error "Invalid scp upload path: $args"
|
||||
;;
|
||||
*)
|
||||
log error "Unknown command: $command"
|
||||
|
Reference in New Issue
Block a user