Skip to content

Commit 7e2711b

Browse files
committed
Improve various things in the checksum code
- Size flist checksum data to hold the active size, not the max. - Add a negotiated hash method to the daemon auth code. - Use EVP for all openssl digests. This makes it easy to add more openssl digest methods and avoids deprecation warnings. - Support a way to re-enable deprecated digests via openssl conf file and allow a default file to be configured. - Supply a simple openssl-rsync.cnf file to enable legacy digests.
1 parent b8c2fde commit 7e2711b

18 files changed

+517
-270
lines changed

NEWS.md

+22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@
66

77
- ...
88

9+
### ENHANCEMENTS:
10+
11+
- Added negotiated daemon-auth support that allows a stronger checksum digest
12+
to be used.
13+
14+
### PACKAGING RELATED:
15+
16+
- The checksum code now uses openssl's EVP methods, which gets rid of various
17+
deprecation warnings and makes it easy to support more digest methods. On
18+
newer systems, the MD4 digest is marked as legacy in the openssl code, which
19+
makes openssl refuse to support it via EVP. You can just ignore this and
20+
allow the included MD4 code to be used for older rsync connections (when
21+
talking to an rsync prior to 3.0.0) or you can configure rsync to tell
22+
openssl to enable legacy algorithms (see below).
23+
24+
- A simple openssl config file is supplied that can be optionally installed for
25+
rsync to use. If you install packaging/openssl-rsync.cnf to a public spot
26+
(such as ` /etc/ssl/openssl-rsync.cnf` or similar) and then configure rsync
27+
using `--with-openssl-conf=/path/name.cnf`, this will cause rsync to export
28+
the configured path in the OPENSSL_CONF environment variable (when it is not
29+
already set). This will enable openssl's MD4 code for rsync to use.
30+
931
------------------------------------------------------------------------------
1032

1133
# NEWS for rsync 3.2.6 (9 Sep 2022)

authenticate.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
extern int read_only;
2626
extern char *password_file;
27+
extern struct name_num_obj valid_auth_checksums;
2728

2829
/***************************************************************************
2930
encode a buffer using base64 - simple and slow algorithm. null terminates
@@ -72,9 +73,9 @@ static void gen_challenge(const char *addr, char *challenge)
7273
SIVAL(input, 20, tv.tv_usec);
7374
SIVAL(input, 24, getpid());
7475

75-
sum_init(-1, 0);
76+
len = sum_init(valid_auth_checksums.negotiated_nni, 0);
7677
sum_update(input, sizeof input);
77-
len = sum_end(digest);
78+
sum_end(digest);
7879

7980
base64_encode(digest, len, challenge, 0);
8081
}
@@ -86,10 +87,10 @@ static void generate_hash(const char *in, const char *challenge, char *out)
8687
char buf[MAX_DIGEST_LEN];
8788
int len;
8889

89-
sum_init(-1, 0);
90+
len = sum_init(valid_auth_checksums.negotiated_nni, 0);
9091
sum_update(in, strlen(in));
9192
sum_update(challenge, strlen(challenge));
92-
len = sum_end(buf);
93+
sum_end(buf);
9394

9495
base64_encode(buf, len, out, 0);
9596
}
@@ -238,6 +239,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
238239
if (!users || !*users)
239240
return "";
240241

242+
negotiate_daemon_auth(f_out, 0);
241243
gen_challenge(addr, challenge);
242244

243245
io_printf(f_out, "%s%s\n", leader, challenge);
@@ -350,6 +352,7 @@ void auth_client(int fd, const char *user, const char *challenge)
350352

351353
if (!user || !*user)
352354
user = "nobody";
355+
negotiate_daemon_auth(-1, 1);
353356

354357
if (!(pass = getpassf(password_file))
355358
&& !(pass = getenv("RSYNC_PASSWORD"))) {

0 commit comments

Comments
 (0)