diff --git a/builtin/credential/app-id/backend.go b/builtin/credential/app-id/backend.go index 74e096b75..fb54bc9d5 100644 --- a/builtin/credential/app-id/backend.go +++ b/builtin/credential/app-id/backend.go @@ -18,7 +18,7 @@ func Factory(conf *logical.BackendConfig) (logical.Backend, error) { func Backend(conf *logical.BackendConfig) (*framework.Backend, error) { // Initialize the salt - salt, err := salt.NewSalt(conf.View, nil) + salt, err := salt.NewSalt(conf.StorageView, nil) if err != nil { return nil, err } @@ -82,7 +82,7 @@ func Backend(conf *logical.BackendConfig) (*framework.Backend, error) { // but for now we want a smooth upgrade experience by automatically // upgrading to use salting. if salt.DidGenerate() { - if err := b.upgradeToSalted(conf.View); err != nil { + if err := b.upgradeToSalted(conf.StorageView); err != nil { return nil, err } } diff --git a/builtin/logical/ssh/backend.go b/builtin/logical/ssh/backend.go index 5e9b3b356..171188bd2 100644 --- a/builtin/logical/ssh/backend.go +++ b/builtin/logical/ssh/backend.go @@ -22,7 +22,7 @@ func Factory(conf *logical.BackendConfig) (logical.Backend, error) { } func Backend(conf *logical.BackendConfig) (*framework.Backend, error) { - salt, err := salt.NewSalt(conf.View, nil) + salt, err := salt.NewSalt(conf.StorageView, nil) if err != nil { return nil, err } @@ -69,7 +69,7 @@ a credential accordingly and issue it. Dynamic Key: is a RSA private key which can be used to establish SSH session using publickey authentication. When the client receives a key and uses it to establish -connections with hosts, Vault server will have no way to know when and how many +connections with hosts, Vault server will have no way to know when and how many times the key will be used. So, these login attempts will not be audited by Vault. To create a dynamic credential, Vault will use the shared private key registered with the role. Named key should be created using 'keys/' endpoint and used with diff --git a/logical/logical.go b/logical/logical.go index a010766d8..552bb049a 100644 --- a/logical/logical.go +++ b/logical/logical.go @@ -33,7 +33,7 @@ type Backend interface { // BackendConfig is provided to the factory to initialize the backend type BackendConfig struct { // View should not be stored, and should only be used for initialization - View Storage + StorageView Storage // The backend should use this logger. The log should not contain any secrets. Logger *log.Logger diff --git a/vault/auth.go b/vault/auth.go index c688d5739..8898d7d33 100644 --- a/vault/auth.go +++ b/vault/auth.go @@ -25,8 +25,8 @@ const ( ) var ( - // loadAuthFailed if loadCreddentials encounters an error - loadAuthFailed = errors.New("failed to setup auth table") + // errLoadAuthFailed if loadCreddentials encounters an error + errLoadAuthFailed = errors.New("failed to setup auth table") ) // enableCredential is used to enable a new credential backend @@ -185,13 +185,13 @@ func (c *Core) loadCredentials() error { raw, err := c.barrier.Get(coreAuthConfigPath) if err != nil { c.logger.Printf("[ERR] core: failed to read auth table: %v", err) - return loadAuthFailed + return errLoadAuthFailed } if raw != nil { c.auth = &MountTable{} if err := json.Unmarshal(raw.Value, c.auth); err != nil { c.logger.Printf("[ERR] core: failed to decode auth table: %v", err) - return loadAuthFailed + return errLoadAuthFailed } } @@ -203,7 +203,7 @@ func (c *Core) loadCredentials() error { // Create and persist the default auth table c.auth = defaultAuthTable() if err := c.persistAuth(c.auth); err != nil { - return loadAuthFailed + return errLoadAuthFailed } return nil } @@ -247,7 +247,7 @@ func (c *Core) setupCredentials() error { c.logger.Printf( "[ERR] core: failed to create credential entry %#v: %v", entry, err) - return loadAuthFailed + return errLoadAuthFailed } // Mount the backend @@ -255,7 +255,7 @@ func (c *Core) setupCredentials() error { err = c.router.Mount(backend, path, entry, view) if err != nil { c.logger.Printf("[ERR] core: failed to mount auth entry %#v: %v", entry, err) - return loadAuthFailed + return errLoadAuthFailed } // Ensure the path is tainted if set in the mount table @@ -288,10 +288,9 @@ func (c *Core) newCredentialBackend( } config := &logical.BackendConfig{ - View: view, - Logger: c.logger, - Config: conf, - System: sysView, + StorageView: view, + Logger: c.logger, + Config: conf, } b, err := f(config) diff --git a/vault/logical_passthrough.go b/vault/logical_passthrough.go index 03d721c24..da39d53a4 100644 --- a/vault/logical_passthrough.go +++ b/vault/logical_passthrough.go @@ -62,7 +62,7 @@ func PassthroughBackendFactory(conf *logical.BackendConfig) (logical.Backend, er } // PassthroughBackend is used storing secrets directly into the physical -// backend. The secrest are encrypted in the durable storage and custom TTL +// backend. The secrets are encrypted in the durable storage and custom TTL // information can be specified, but otherwise this backend doesn't do anything // fancy. type PassthroughBackend struct { diff --git a/vault/mount.go b/vault/mount.go index 731368ae1..a96b8251a 100644 --- a/vault/mount.go +++ b/vault/mount.go @@ -486,10 +486,13 @@ func (c *Core) newLogicalBackend(t string, sysView logical.SystemView, view logi } config := &logical.BackendConfig{ - View: view, - Logger: c.logger, - Config: conf, - System: sysView, + StorageView: view, + Logger: c.logger, + Config: conf, + System: &logical.StaticSystemView{ + DefaultLeaseTTLVal: c.defaultLeaseTTL, + MaxLeaseTTLVal: c.maxLeaseTTL, + }, } b, err := f(config)