]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Allow basic connectivity check via rrsync
authorColin Watson <cjwatson@debian.org>
Fri, 29 Mar 2024 01:24:32 +0000 (01:24 +0000)
committerWayne Davison <wayne@opencoder.net>
Wed, 20 Nov 2024 05:35:49 +0000 (21:35 -0800)
rsbackup (https://github.com/ewxrjk/rsbackup) uses "ssh <host> true" to
check that the host in question is reachable.  I like to configure my
backed-up hosts to force the backup system to go via `rrsync`, but I
always have to add a local tweak to allow `SSH_ORIGINAL_COMMAND=true` to
work.  I think this would be safe enough to include in rrsync.

support/rrsync

index 4b4b87c55c9f89d6779179d035be12aa1e1f7ae8..e8b0cc0d2254efc22e3a4e931ede38398fea7ad7 100755 (executable)
@@ -156,6 +156,10 @@ def main():
     command = os.environ.get('SSH_ORIGINAL_COMMAND', None)
     if not command:
         die("Not invoked via sshd")
+    if command == 'true':
+        # Allow checking connectivity with "ssh <host> true".  (For example,
+        # rsbackup uses this.)
+        sys.exit(0)
     command = command.split(' ', 2)
     if command[0:1] != ['rsync']:
         die("SSH_ORIGINAL_COMMAND does not run rsync")