Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 92 additions & 98 deletions go.mod

Large diffs are not rendered by default.

703 changes: 341 additions & 362 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/client/identityfile/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func writeOracleFormat(cfg WriteConfig, writer ConfigWriter) ([]string, error) {
// issuer for an oracle wallet user_cert, and the server cert we create
// is not signed by the DB Client CA, so don't pass trusted certs
// (DB Client CA) here.
pf, err := pkcs12.Encode(rand.Reader, keyK, certBlock, nil, cfg.Password)
pf, err := pkcs12.LegacyRC2.WithRand(rand.Reader).Encode(keyK, certBlock, nil, cfg.Password)
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down
1 change: 0 additions & 1 deletion lib/observability/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ func NewTraceProvider(ctx context.Context, cfg Config) (*Provider, error) {
attrs = append(attrs, cfg.Attributes...)

res, err := resource.New(ctx,
resource.WithSchemaURL(semconv.SchemaURL),
resource.WithFromEnv(),
resource.WithProcessExecutableName(),
resource.WithProcessRuntimeName(),
Expand Down
4 changes: 2 additions & 2 deletions lib/srv/db/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,12 +1001,12 @@ func TestMongoDBMaxMessageSize(t *testing.T) {
expectedQueryError bool
}{
"default message size": {
messageSize: 300,
messageSize: 400,
},
"message size exceeded": {
// Set a value that will enable handshake message to complete
// successfully.
maxMessageSize: 300,
maxMessageSize: 400,
messageSize: 500,
expectedQueryError: true,
},
Expand Down
31 changes: 29 additions & 2 deletions lib/srv/db/mongodb/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ func (s *TestServer) handleMessage(message protocol.Message) (protocol.Message,
switch command {
case commandIsMaster:
return s.handleIsMaster(message)
case commandHello:
return s.handleHello(message)
case commandAuth:
return s.handleAuth(message)
case commandPing:
Expand Down Expand Up @@ -272,7 +274,7 @@ func (s *TestServer) handleAuth(message protocol.Message) (protocol.Message, err
// handleIsMaster makes response to the client's "isMaster" command.
//
// isMaster command is used as a handshake by the client to determine the
// cluster topology.
// cluster topology. Replaced by hello command in newer versions.
func (s *TestServer) handleIsMaster(message protocol.Message) (protocol.Message, error) {
isMasterReply, err := makeIsMasterReply(s.getWireVersion(), s.getMaxMessageSize())
if err != nil {
Expand All @@ -287,6 +289,28 @@ func (s *TestServer) handleIsMaster(message protocol.Message) (protocol.Message,
return nil, trace.NotImplemented("unsupported message: %v", message)
}

// handleHello makes response to the client's "hello" command.
//
// hello command is used as a handshake by the client to determine the
// cluster topology.
func (s *TestServer) handleHello(message protocol.Message) (protocol.Message, error) {
reply, err := bson.Marshal(bson.M{
"ok": 1,
"isWritablePrimary": true,
"maxMessageSizeBytes": s.getMaxMessageSize(),
"maxWireVersion": s.getWireVersion(),
"readOnly": false,
"compression": []string{"zlib"},
// `serviceId` is required for LoadBalanced mode. Reference:
// https://github.com/mongodb/specifications/blob/master/source/load-balancers/load-balancers.rst
"serviceId": primitive.NewObjectID(),
})
if err != nil {
return nil, trace.Wrap(err)
}
return protocol.MakeOpMsg(reply), nil
}

// handlePing makes response to the client's "ping" command.
//
// ping command is usually used by client to test connectivity to the server.
Expand Down Expand Up @@ -716,6 +740,7 @@ const (

commandAuth = "authenticate"
commandIsMaster = "isMaster"
commandHello = "hello"
commandPing = "ping"
commandFind = "find"
commandSaslStart = "saslStart"
Expand Down Expand Up @@ -745,7 +770,9 @@ func makeIsMasterReply(wireVersion int, maxMessageSize uint32) ([]byte, error) {
"maxWireVersion": wireVersion,
"maxMessageBytes": maxMessageSize,
"compression": []string{"zlib"},
"serviceId": primitive.NewObjectID(),
// `serviceId` is required for LoadBalanced mode. Reference:
// https://github.com/mongodb/specifications/blob/master/source/load-balancers/load-balancers.rst
"serviceId": primitive.NewObjectID(),
})
}

Expand Down