From 3f7ac1f42b1ae91ec7ea07c0fae562cccd794e0b Mon Sep 17 00:00:00 2001 From: u Date: Mon, 29 May 2023 06:30:11 -0400 Subject: fix shell escaping to fix systemd fix for filenames containing hyphens --- Makefile | 2 +- src/AnonymousForceCommand | 2 ++ src/AuthorizedKeysCommand | 7 +++++++ src/user-d.AnonymousForceCommand | 2 -- src/user-d.AuthorizedKeysCommand | 7 ------- 5 files changed, 10 insertions(+), 10 deletions(-) create mode 100755 src/AnonymousForceCommand create mode 100755 src/AuthorizedKeysCommand delete mode 100755 src/user-d.AnonymousForceCommand delete mode 100755 src/user-d.AuthorizedKeysCommand diff --git a/Makefile b/Makefile index a01e965..48079f6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ unit_instance_name != systemd-escape "$$(realpath "$(fossil_database)")" our_name = fossil-sync unit_files_basenames = $(addprefix $(our_name)@.,service path timer) unit_files = $(addprefix src/,$(unit_files_basenames)) -unit_instances = $(subst @,@$(unit_instance_name),$(unit_files_basenames)) +unit_instances = $(subst @,@"$(unit_instance_name)",$(unit_files_basenames)) unit_instance = $(our_name)@$(unit_instance_name).service default: install start ui diff --git a/src/AnonymousForceCommand b/src/AnonymousForceCommand new file mode 100755 index 0000000..a8a09f3 --- /dev/null +++ b/src/AnonymousForceCommand @@ -0,0 +1,2 @@ +#!/bin/bash +socat stdio /run/fossil-user.S diff --git a/src/AuthorizedKeysCommand b/src/AuthorizedKeysCommand new file mode 100755 index 0000000..6bf0ec9 --- /dev/null +++ b/src/AuthorizedKeysCommand @@ -0,0 +1,7 @@ +#!/bin/sh +cmd=/etc/ssh/user-d.AnonymousForceCommand +[ -x "$cmd" ] || exit + +key=$1 +shift +printf 'restrict,pty,command="%s" %s\n' "$cmd $*" "$key" diff --git a/src/user-d.AnonymousForceCommand b/src/user-d.AnonymousForceCommand deleted file mode 100755 index a8a09f3..0000000 --- a/src/user-d.AnonymousForceCommand +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -socat stdio /run/fossil-user.S diff --git a/src/user-d.AuthorizedKeysCommand b/src/user-d.AuthorizedKeysCommand deleted file mode 100755 index 6bf0ec9..0000000 --- a/src/user-d.AuthorizedKeysCommand +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -cmd=/etc/ssh/user-d.AnonymousForceCommand -[ -x "$cmd" ] || exit - -key=$1 -shift -printf 'restrict,pty,command="%s" %s\n' "$cmd $*" "$key" -- cgit v1.2.3