mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	Database Root Credential Rotation (#3976)
* redoing connection handling * a little more cleanup * empty implementation of rotation * updating rotate signature * signature update * updating interfaces again :( * changing back to interface * adding templated url support and rotation for postgres * adding correct username * return updates * updating statements to be a list * adding error sanitizing middleware * fixing log sanitizier * adding postgres rotate test * removing conf from rotate * adding rotate command * adding mysql rotate * finishing up the endpoint in the db backend for rotate * no more structs, just store raw config * fixing tests * adding db instance lock * adding support for statement list in cassandra * wip redoing interface to support BC * adding falllback for Initialize implementation * adding backwards compat for statements * fix tests * fix more tests * fixing up tests, switching to new fields in statements * fixing more tests * adding mssql and mysql * wrapping all the things in middleware, implementing templating for mongodb * wrapping all db servers with error santizer * fixing test * store the name with the db instance * adding rotate to cassandra * adding compatibility translation to both server and plugin * reordering a few things * store the name with the db instance * reordering * adding a few more tests * switch secret values from slice to map * addressing some feedback * reinstate execute plugin after resetting connection * set database connection to closed * switching secret values func to map[string]interface for potential future uses * addressing feedback
This commit is contained in:
		| @@ -73,19 +73,13 @@ func TestMongoDB_Initialize(t *testing.T) { | ||||
| 		"connection_url": connURL, | ||||
| 	} | ||||
|  | ||||
| 	dbRaw, err := New() | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
| 	db := dbRaw.(*MongoDB) | ||||
| 	connProducer := db.ConnectionProducer.(*mongoDBConnectionProducer) | ||||
|  | ||||
| 	err = db.Initialize(context.Background(), connectionDetails, true) | ||||
| 	db := new() | ||||
| 	_, err := db.Init(context.Background(), connectionDetails, true) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	if !connProducer.Initialized { | ||||
| 	if !db.Initialized { | ||||
| 		t.Fatal("Database should be initialized") | ||||
| 	} | ||||
|  | ||||
| @@ -103,18 +97,14 @@ func TestMongoDB_CreateUser(t *testing.T) { | ||||
| 		"connection_url": connURL, | ||||
| 	} | ||||
|  | ||||
| 	dbRaw, err := New() | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
| 	db := dbRaw.(*MongoDB) | ||||
| 	err = db.Initialize(context.Background(), connectionDetails, true) | ||||
| 	db := new() | ||||
| 	_, err := db.Init(context.Background(), connectionDetails, true) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	statements := dbplugin.Statements{ | ||||
| 		CreationStatements: testMongoDBRole, | ||||
| 		Creation: []string{testMongoDBRole}, | ||||
| 	} | ||||
|  | ||||
| 	usernameConfig := dbplugin.UsernameConfig{ | ||||
| @@ -141,18 +131,14 @@ func TestMongoDB_CreateUser_writeConcern(t *testing.T) { | ||||
| 		"write_concern":  testMongoDBWriteConcern, | ||||
| 	} | ||||
|  | ||||
| 	dbRaw, err := New() | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
| 	db := dbRaw.(*MongoDB) | ||||
| 	err = db.Initialize(context.Background(), connectionDetails, true) | ||||
| 	db := new() | ||||
| 	_, err := db.Init(context.Background(), connectionDetails, true) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	statements := dbplugin.Statements{ | ||||
| 		CreationStatements: testMongoDBRole, | ||||
| 		Creation: []string{testMongoDBRole}, | ||||
| 	} | ||||
|  | ||||
| 	usernameConfig := dbplugin.UsernameConfig{ | ||||
| @@ -178,18 +164,14 @@ func TestMongoDB_RevokeUser(t *testing.T) { | ||||
| 		"connection_url": connURL, | ||||
| 	} | ||||
|  | ||||
| 	dbRaw, err := New() | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
| 	db := dbRaw.(*MongoDB) | ||||
| 	err = db.Initialize(context.Background(), connectionDetails, true) | ||||
| 	db := new() | ||||
| 	_, err := db.Init(context.Background(), connectionDetails, true) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("err: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	statements := dbplugin.Statements{ | ||||
| 		CreationStatements: testMongoDBRole, | ||||
| 		Creation: []string{testMongoDBRole}, | ||||
| 	} | ||||
|  | ||||
| 	usernameConfig := dbplugin.UsernameConfig{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Chris Hoffman
					Chris Hoffman