Skip to content

Commit c96a4fd

Browse files
committed
MDEV-37548 : wsrep_allowlist allows all connections during SST
MDEV-37136 allowed connections by default if wsrep_schema is not initialized, but this allows and process to connect to a node which is joining to the cluster and receiving SST (i.e. all incoming connections are allowed until the storage engines get initialized). We need to allow all connections by default to maintain upgradability if nothing else is configured. However, if user has given wsrep_allowlist string or stored allowed connections to mysql.wsrep_allowlist table used address should be checked. When node is joining to the cluster and receiving SST InnoDB storage engine is not initialized, thus mysq.wsrep_allowlist table is not available and wsrep_schema is not intialized. In this case we still should check has user configured allowed connections using wsrep_allowlist configuration variable. If wsrep_allowlist configuration variable contains list of allowed addressed, we check is address used in new connection in this list. If it is not connection is not allowed.
1 parent f609dbd commit c96a4fd

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

sql/wsrep_allowlist_service.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,31 @@ bool Wsrep_allowlist_service::allowlist_cb (
3636
const wsrep::const_buffer& value)
3737
WSREP_NOEXCEPT
3838
{
39-
bool res=true; // allow all connections
39+
// Allow all connections if user has not given list of
40+
// allowed addresses or stored them on mysql.wsrep_allowlist
41+
// table. Note that table is available after SEs are initialized.
42+
bool res=true;
43+
std::string string_value(value.data());
4044
if (wsrep_schema)
4145
{
42-
std::string string_value(value.data());
4346
res= wsrep_schema->allowlist_check(key, string_value);
4447
}
48+
// If wsrep_schema is not initialized check if user has given
49+
// list of addresses where connections are allowed
50+
else if (wsrep_allowlist && wsrep_allowlist[0] != '\0')
51+
{
52+
res= false; // Allow only given addresses
53+
std::vector<std::string> allowlist;
54+
wsrep_split_allowlist(allowlist);
55+
for(auto allowed : allowlist)
56+
{
57+
if (!string_value.compare(allowed))
58+
{
59+
res= true; // Address found allow connection
60+
break;
61+
}
62+
}
63+
}
4564
return res;
4665
}
4766

0 commit comments

Comments
 (0)