Compare commits

...

3 Commits

View File

@ -8,8 +8,6 @@ REPO="babbarc/workspaces"
BRANCH="master" BRANCH="master"
URL="$PROTOCOL://$HOST/$REPO/raw/branch/$BRANCH" URL="$PROTOCOL://$HOST/$REPO/raw/branch/$BRANCH"
ALLOWED_PATH="/home/infilytics/home.tar.gz"
LOG_FILE="/tmp/.gitops-router-${PERSON}.log" LOG_FILE="/tmp/.gitops-router-${PERSON}.log"
log() { log() {
@ -18,18 +16,7 @@ log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $*" | tee -a "$LOG_FILE" echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $*" | tee -a "$LOG_FILE"
} }
logO() { log info "Received SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND"
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
exec scp -t "ALLOWED_PATH"
exit
fi
# Ensure the variable is set # Ensure the variable is set
if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then
@ -98,8 +85,8 @@ clean)
status) status)
podman images podman images
;; ;;
scp) remove)
log error "Invalid scp upload path: $args" podman rm "$args"
;; ;;
*) *)
log error "Unknown command: $command" log error "Unknown command: $command"