Remove most Root paths
This commit is contained in:
parent
65298bd9a9
commit
99c1e071f3
|
@ -3,11 +3,12 @@ package ldap
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/go-ldap/ldap"
|
||||
"github.com/hashicorp/vault/helper/mfa"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
|
@ -20,13 +21,7 @@ func Backend() *framework.Backend {
|
|||
Help: backendHelp,
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: append([]string{
|
||||
"config",
|
||||
"groups/*",
|
||||
"users/*",
|
||||
},
|
||||
mfa.MFARootPaths()...,
|
||||
),
|
||||
Root: mfa.MFARootPaths(),
|
||||
|
||||
Unauthenticated: []string{
|
||||
"login/*",
|
||||
|
@ -195,7 +190,7 @@ func getBindDN(cfg *ConfigEntry, c *ldap.Conn, username string) (string, error)
|
|||
return bindDN, nil
|
||||
}
|
||||
|
||||
func getUserDN(cfg *ConfigEntry,c *ldap.Conn, bindDN string) (string , error) {
|
||||
func getUserDN(cfg *ConfigEntry, c *ldap.Conn, bindDN string) (string, error) {
|
||||
userDN := ""
|
||||
if cfg.UPNDomain != "" {
|
||||
// Find the distinguished name for the user if userPrincipalName used for login
|
||||
|
@ -276,7 +271,7 @@ func getLdapGroups(cfg *ConfigEntry, c *ldap.Conn, userDN string, username strin
|
|||
}
|
||||
for _, rdn := range dn.RDNs {
|
||||
for _, rdnTypeAndValue := range rdn.Attributes {
|
||||
if strings.EqualFold(rdnTypeAndValue.Type, "CN" ) {
|
||||
if strings.EqualFold(rdnTypeAndValue.Type, "CN") {
|
||||
ldapMap[rdnTypeAndValue.Value] = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,6 @@ func Backend() *framework.Backend {
|
|||
b.Backend = &framework.Backend{
|
||||
Help: strings.TrimSpace(backendHelp),
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfigRoot(),
|
||||
pathConfigLease(&b),
|
||||
|
|
|
@ -12,12 +12,6 @@ func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
|
|||
func Backend() *framework.Backend {
|
||||
var b backend
|
||||
b.Backend = &framework.Backend{
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfigAccess(),
|
||||
pathRoles(),
|
||||
|
|
|
@ -20,12 +20,6 @@ func Backend() *framework.Backend {
|
|||
b.Backend = &framework.Backend{
|
||||
Help: strings.TrimSpace(backendHelp),
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfigConnection(&b),
|
||||
pathConfigLease(&b),
|
||||
|
|
|
@ -19,12 +19,6 @@ func Backend() *framework.Backend {
|
|||
b.Backend = &framework.Backend{
|
||||
Help: strings.TrimSpace(backendHelp),
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfigConnection(&b),
|
||||
pathConfigLease(&b),
|
||||
|
|
|
@ -35,10 +35,6 @@ func Backend(conf *logical.BackendConfig) (*framework.Backend, error) {
|
|||
Help: strings.TrimSpace(backendHelp),
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
"keys/*",
|
||||
},
|
||||
Unauthenticated: []string{
|
||||
"verify",
|
||||
},
|
||||
|
|
|
@ -78,10 +78,6 @@ func createBackend(conf *logical.BackendConfig) (*backend, error) {
|
|||
Help: strings.TrimSpace(backendHelp),
|
||||
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config/*",
|
||||
"keys/*",
|
||||
},
|
||||
Unauthenticated: []string{
|
||||
"verify",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue