Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rsyncd banner breaks scanner (protocol error) #187

Open
elboulangero opened this issue Feb 8, 2023 · 1 comment
Open

New rsyncd banner breaks scanner (protocol error) #187

elboulangero opened this issue Feb 8, 2023 · 1 comment

Comments

@elboulangero
Copy link

In release 3.2.7, rsync changed the format of the banner sent by the daemon, cf. RsyncProject/rsync@418e38a. Before it was @RSYNCD: <version>.<subprotocol> and now it is @RSYNCD: <version>.<subprotocol> <digest1> <digestN>.

It breaks scanner, which is rather picky about what it expects, cf https://github.com/poeml/mirrorbrain/blob/master/tools/scanner.pl#L1230

In practice, here's what happens:

$ mb -b kali scan --enable md.mirrors.hacktegic.com
Wed Feb  8 05:25:20 2023 md.mirrors.hacktegic.com: starting
Wed Feb  8 05:25:22 2023 md.mirrors.hacktegic.com: total files before scan: 0
__DIE__: (=> /usr/bin/scanner 315 main::rsync_readdir => /usr/bin/scanner 1095 main::rsync_get_filelist)
md.mirrors.hacktegic.com: protocol error [@RSYNCD: 31.0 sha512 sha256 sha1 md5 md4
]
Completed in 2 seconds
@elboulangero
Copy link
Author

Here's the patch (to apply on a system where scanner is installed at /usr/bin/scanner.pl, like it is in Debian):

From fd25b09f47b6afa3fbab9e868e39f25ef5702e91 Mon Sep 17 00:00:00 2001
From: Arnaud Rebillout <arnaudr@kali.org>
Date: Wed, 8 Feb 2023 15:12:22 +0700
Subject: [PATCH] Allow random string after rsyncd version in banner

---
 scanner | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git /usr/bin/scanner.pl /usr/bin/scanner.pl
index 3153eea..150a6d7 100755
--- /usr/bin/scanner.pl
+++ /usr/bin/scanner.pl
@@ -1202,7 +1202,7 @@ sub rsync_get_filelist
   alarm 600;
   sysread(S, $buf, 4096);
   alarm 0;
-  die("$identifier: protocol error [$buf]\n") if $buf !~ /^\@RSYNCD: ([\d.]+)\n/s;
+  die("$identifier: protocol error [$buf]\n") if $buf !~ /^\@RSYNCD: ([\d.]+).*\n/s;
   $peer->{rsync_protocol} = $1;
   $peer->{rsync_protocol} = 28 if $peer->{rsync_protocol} > 28;
   swrite(*S, "$module\n");

@elboulangero elboulangero changed the title New rsyncd banner breaks scanner New rsyncd banner breaks scanner (protocol error) Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant