Replace masteruser and masterauth with primaryuser and primaryauth (#598)

Make the one backwards compatible config change we are allowed to
replace for removing master from our API.

`masterauth` and `masteruser` are still used as an alias, but aren't
explicitly referenced. As an addendum to
https://github.com/valkey-io/valkey/pull/591, it would be good to have
this in 8. Given the related PR for updated other references for master,
I just updated the ones around this specific change.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
This commit is contained in:
Madelyn Olson 2024-06-07 00:46:52 -07:00 committed by GitHub
parent ad5fd5b95c
commit bce240eab7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 25 additions and 24 deletions

View File

@ -3059,7 +3059,7 @@ standardConfig static_configs[] = {
createStringConfig("unixsocket", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.unixsocket, NULL, NULL, NULL),
createStringConfig("pidfile", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.pidfile, NULL, NULL, NULL),
createStringConfig("replica-announce-ip", "slave-announce-ip", MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.slave_announce_ip, NULL, NULL, NULL),
createStringConfig("masteruser", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.masteruser, NULL, NULL, NULL),
createStringConfig("primaryuser", "masteruser", MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.masteruser, NULL, NULL, NULL),
createStringConfig("cluster-announce-ip", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_ip, NULL, NULL, updateClusterIp),
createStringConfig("cluster-config-file", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.cluster_configfile, "nodes.conf", NULL, NULL),
createStringConfig("cluster-announce-hostname", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_hostname, NULL, isValidAnnouncedHostname, updateClusterHostname),
@ -3082,7 +3082,7 @@ standardConfig static_configs[] = {
createStringConfig("locale-collate", NULL, MODIFIABLE_CONFIG, ALLOW_EMPTY_STRING, server.locale_collate, "", NULL, updateLocaleCollate),
/* SDS Configs */
createSDSConfig("masterauth", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.masterauth, NULL, NULL, NULL),
createSDSConfig("primaryauth", "masterauth", MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.masterauth, NULL, NULL, NULL),
createSDSConfig("requirepass", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.requirepass, NULL, NULL, updateRequirePass),
/* Enum Configs */

View File

@ -3161,6 +3161,7 @@ static int isSensitiveCommand(int argc, char **argv) {
} else if (argc > 2 && !strcasecmp(argv[0], "config") && !strcasecmp(argv[1], "set")) {
for (int j = 2; j < argc; j = j + 2) {
if (!strcasecmp(argv[j], "masterauth") || !strcasecmp(argv[j], "masteruser") ||
!strcasecmp(argv[j], "primaryuser") || !strcasecmp(argv[j], "primaryauth") ||
!strcasecmp(argv[j], "tls-key-file-pass") || !strcasecmp(argv[j], "tls-client-key-file-pass") ||
!strcasecmp(argv[j], "requirepass")) {
return 1;

View File

@ -44,7 +44,7 @@ tags {"benchmark network external:skip logreqres:skip"} {
}
test {benchmark: connecting using URI with authentication set,get} {
r config set masterauth pass
r config set primaryauth pass
set cmd [valkeybenchmarkuriuserpass $master_host $master_port "default" pass "-c 5 -n 10 -t set,get"]
common_bench_setup $cmd
default_set_get_checks
@ -145,7 +145,7 @@ tags {"benchmark network external:skip logreqres:skip"} {
}
test {benchmark: tls connecting using URI with authentication set,get} {
r config set masterauth pass
r config set primaryauth pass
set cmd [valkeybenchmarkuriuserpass $master_host $master_port "default" pass "-c 5 -n 10 -t set,get"]
common_bench_setup $cmd
default_set_get_checks

View File

@ -9,14 +9,14 @@ proc server_set_password {} {
foreach_valkey_id id {
assert_equal {OK} [R $id CONFIG SET requirepass $::password]
assert_equal {OK} [R $id AUTH $::password]
assert_equal {OK} [R $id CONFIG SET masterauth $::password]
assert_equal {OK} [R $id CONFIG SET primaryauth $::password]
}
}
proc server_reset_password {} {
foreach_valkey_id id {
assert_equal {OK} [R $id CONFIG SET requirepass ""]
assert_equal {OK} [R $id CONFIG SET masterauth ""]
assert_equal {OK} [R $id CONFIG SET primaryauth ""]
}
}
@ -26,16 +26,16 @@ proc server_set_acl {id} {
R $id CLIENT KILL USER default SKIPME no
assert_equal {OK} [R $id AUTH $::user $::password]
assert_equal {OK} [R $id CONFIG SET masteruser $::user]
assert_equal {OK} [R $id CONFIG SET masterauth $::password]
assert_equal {OK} [R $id CONFIG SET primaryuser $::user]
assert_equal {OK} [R $id CONFIG SET primaryauth $::password]
}
proc server_reset_acl {id} {
assert_equal {OK} [R $id ACL SETUSER default on]
assert_equal {1} [R $id ACL DELUSER $::user]
assert_equal {OK} [R $id CONFIG SET masteruser ""]
assert_equal {OK} [R $id CONFIG SET masterauth ""]
assert_equal {OK} [R $id CONFIG SET primaryuser ""]
assert_equal {OK} [R $id CONFIG SET primaryauth ""]
}
proc verify_sentinel_connect_replicas {id} {

View File

@ -59,26 +59,26 @@ start_server {tags {"auth_binary_password external:skip"}} {
r auth "abc\x00def"
} {OK}
start_server {tags {"masterauth"}} {
start_server {tags {"primaryauth"}} {
set master [srv -1 client]
set master_host [srv -1 host]
set master_port [srv -1 port]
set slave [srv 0 client]
test {MASTERAUTH test with binary password} {
test {primaryauth test with binary password} {
$master config set requirepass "abc\x00def"
# Configure the replica with masterauth
# Configure the replica with primaryauth
set loglines [count_log_lines 0]
$slave config set masterauth "abc"
$slave config set primaryauth "abc"
$slave slaveof $master_host $master_port
# Verify replica is not able to sync with master
wait_for_log_messages 0 {"*Unable to AUTH to MASTER*"} $loglines 1000 10
assert_equal {down} [s 0 master_link_status]
# Test replica with the correct masterauth
$slave config set masterauth "abc\x00def"
# Test replica with the correct primaryauth
$slave config set primaryauth "abc\x00def"
wait_for_condition 50 100 {
[s 0 master_link_status] eq {up}
} else {

View File

@ -64,8 +64,8 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} {
r config set slowlog-log-slower-than 0
r slowlog reset
catch {r acl setuser "slowlog test user" +get +set} _
r config set masteruser ""
r config set masterauth ""
r config set primaryuser ""
r config set primaryauth ""
r config set requirepass ""
r config set tls-key-file-pass ""
r config set tls-client-key-file-pass ""
@ -81,8 +81,8 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} {
assert_equal 11 [llength $slowlog_resp]
assert_equal {slowlog reset} [lindex [lindex $slowlog_resp 10] 3]
assert_equal {acl setuser (redacted) (redacted) (redacted)} [lindex [lindex $slowlog_resp 9] 3]
assert_equal {config set masteruser (redacted)} [lindex [lindex $slowlog_resp 8] 3]
assert_equal {config set masterauth (redacted)} [lindex [lindex $slowlog_resp 7] 3]
assert_equal {config set primaryuser (redacted)} [lindex [lindex $slowlog_resp 8] 3]
assert_equal {config set primaryauth (redacted)} [lindex [lindex $slowlog_resp 7] 3]
assert_equal {config set requirepass (redacted)} [lindex [lindex $slowlog_resp 6] 3]
assert_equal {config set tls-key-file-pass (redacted)} [lindex [lindex $slowlog_resp 5] 3]
assert_equal {config set tls-client-key-file-pass (redacted)} [lindex [lindex $slowlog_resp 4] 3]

View File

@ -544,17 +544,17 @@ dir ./
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
# masterauth <master-password>
# primaryauth <primary-password>
#
# However this is not enough if you are using ACLs
# and the default user is not capable of running the PSYNC
# command and/or other commands needed for replication. In this case it's
# better to configure a special user to use with replication, and specify the
# masteruser configuration as such:
# primaryuser configuration as such:
#
# masteruser <username>
# primaryuser <username>
#
# When masteruser is specified, the replica will authenticate against its
# When primaryuser is specified, the replica will authenticate against its
# master using the new AUTH form: AUTH <username> <password>.
# When a replica loses its connection with the master, or when the replication