mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	 0b34b73c47
			
		
	
	0b34b73c47
	
	
	
		
			
			Check if plugin version matches running version When registering a plugin, we check if the request version matches the self-reported version from the plugin. If these do not match, we log a warning. This uncovered a few missing pieces for getting the database version code fully working. We added an environment variable that helps us unit test the running version behavior as well, but only for approle, postgresql, and consul plugins. Return 400 on plugin not found or version mismatch Populate the running SHA256 of plugins in the mount and auth tables (#17217)
		
			
				
	
	
		
			50 lines
		
	
	
		
			886 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			886 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package consul
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	"github.com/hashicorp/vault/sdk/framework"
 | |
| 	"github.com/hashicorp/vault/sdk/logical"
 | |
| )
 | |
| 
 | |
| // ReportedVersion is used to report a specific version to Vault.
 | |
| var ReportedVersion = ""
 | |
| 
 | |
| func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
 | |
| 	b := Backend()
 | |
| 	if err := b.Setup(ctx, conf); err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 	return b, nil
 | |
| }
 | |
| 
 | |
| func Backend() *backend {
 | |
| 	var b backend
 | |
| 	b.Backend = &framework.Backend{
 | |
| 		PathsSpecial: &logical.Paths{
 | |
| 			SealWrapStorage: []string{
 | |
| 				"config/access",
 | |
| 			},
 | |
| 		},
 | |
| 
 | |
| 		Paths: []*framework.Path{
 | |
| 			pathConfigAccess(&b),
 | |
| 			pathListRoles(&b),
 | |
| 			pathRoles(&b),
 | |
| 			pathToken(&b),
 | |
| 		},
 | |
| 
 | |
| 		Secrets: []*framework.Secret{
 | |
| 			secretToken(&b),
 | |
| 		},
 | |
| 		BackendType:    logical.TypeLogical,
 | |
| 		RunningVersion: ReportedVersion,
 | |
| 	}
 | |
| 
 | |
| 	return &b
 | |
| }
 | |
| 
 | |
| type backend struct {
 | |
| 	*framework.Backend
 | |
| }
 |