optimisations
* use pyke's re cache * get an unlimited number of ldap attributes * get a perturbator for the OTP secret, in case of stolen phone * lowercase the username, to avoid strange behaviour with the OTP
This commit is contained in:
28
main.go
28
main.go
@@ -64,21 +64,25 @@ func main() {
|
||||
for _, profile := range config.GetPaths("config.profiles") {
|
||||
profileName := strings.Split(profile, ".")[2]
|
||||
ldapConf := ldapConfig{
|
||||
servers: parseConfigArray(config, profile+".servers"),
|
||||
baseDN: config.GetString(profile+".baseDN", ""),
|
||||
bindCn: config.GetString(profile+".bindCn", ""),
|
||||
bindPw: config.GetString(profile+".bindPw", ""),
|
||||
searchFilter: config.GetString(profile+".searchFilter", ""),
|
||||
primaryAttribute: config.GetString(profile+".primaryAttribute", ""),
|
||||
secondaryAttribute: config.GetString(profile+".secondaryAttribute", ""),
|
||||
validGroups: parseConfigArray(config, profile+".validGroups"),
|
||||
routes: parseConfigArray(config, profile+".routes"),
|
||||
mfaType: config.GetString(profile+".mfa", ""),
|
||||
certAuth: config.GetString(profile+".cert", "optionnal"),
|
||||
upgradeFrom: config.GetString(profile+".upgradeFrom", ""),
|
||||
servers: parseConfigArray(config, profile+".servers"),
|
||||
baseDN: config.GetString(profile+".baseDN", ""),
|
||||
bindCn: config.GetString(profile+".bindCn", ""),
|
||||
bindPw: config.GetString(profile+".bindPw", ""),
|
||||
searchFilter: config.GetString(profile+".searchFilter", ""),
|
||||
attributes: parseConfigArray(config, profile+".attributes"),
|
||||
validGroups: parseConfigArray(config, profile+".validGroups"),
|
||||
routes: parseConfigArray(config, profile+".routes"),
|
||||
mfaType: config.GetString(profile+".mfa", ""),
|
||||
certAuth: config.GetString(profile+".cert", "optionnal"),
|
||||
upgradeFrom: config.GetString(profile+".upgradeFrom", ""),
|
||||
}
|
||||
ldapConf.addIPRange(config.GetString(profile+".IPRange", ""))
|
||||
|
||||
if len(ldapConf.servers) > 0 && len(ldapConf.attributes) < 2 {
|
||||
log.Println("valud ldap configuration must have 2 attributes")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
server.ldap[profileName] = ldapConf
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user