Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

feat(security): treat negotiation succeed if server is old version #145

Merged
merged 5 commits into from
Dec 29, 2020

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Dec 18, 2020

if the client is new version with authentication and enables it, and server is old version, which doesn't has the rpc code RPC_NEGOTIATION. The client will sends negotiation message when it starts, and server will return error ERR_HANDLER_NOT_FOUND, then the session will be reset.
Here is the corresponding error log:

com.xiaomi.infra.pegasus.client.PException: {version}: com.xiaomi.infra.pegasus.rpc.ReplicationException: ERR_SESSION_RESET: [metaServer=[127.0.0.1:34601, 127.0.0.1:34602, 127.0.0.1:34603],tableName=stat] Unable to connect to the meta servers!
	at com.xiaomi.infra.pegasus.client.PegasusClient.getTable(PegasusClient.java:60)
	at com.xiaomi.infra.pegasus.client.PegasusClient.getTable(PegasusClient.java:46)
	at com.xiaomi.infra.pegasus.client.PegasusClient.set(PegasusClient.java:351)
	at com.xiaomi.infra.pegasus.client.PegasusCli.main(PegasusCli.java:206)
Caused by: com.xiaomi.infra.pegasus.rpc.ReplicationException: ERR_SESSION_RESET: [metaServer=[127.0.0.1:34601, 127.0.0.1:34602, 127.0.0.1:34603],tableName=stat] Unable to connect to the meta servers!
	at com.xiaomi.infra.pegasus.rpc.async.TableHandler.handleMetaException(TableHandler.java:495)
	at com.xiaomi.infra.pegasus.rpc.async.TableHandler.<init>(TableHandler.java:98)
	at com.xiaomi.infra.pegasus.rpc.async.ClusterManager.openTable(ClusterManager.java:152)
	at com.xiaomi.infra.pegasus.rpc.async.ClusterManager.openTable(ClusterManager.java:40)
	at com.xiaomi.infra.pegasus.client.PegasusClient.getTable(PegasusClient.java:57)
	... 3 more

Same with the situation which server disables authentication. In this case, the server will return negotiation_status.SASL_AUTH_DISABLEto client.

foreverneverer
foreverneverer previously approved these changes Dec 18, 2020
@levy5307 levy5307 merged commit 55f7893 into XiaoMi:master Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants