basic ldap auth algorithm
This commit is contained in:
25
main.go
25
main.go
@@ -5,14 +5,14 @@ import (
|
||||
"log"
|
||||
"log/syslog"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/pyke369/golang-support/uconfig"
|
||||
)
|
||||
|
||||
var config *uconfig.UConfig
|
||||
|
||||
func main() {
|
||||
var err error
|
||||
var config *uconfig.UConfig
|
||||
// default configuration file is ./openvpn-dm-mgt-server.conf
|
||||
configFile := flag.String("config", "openvpn-dm-mgt-server.conf", "configuration file")
|
||||
logToSyslog := flag.Bool("syslog", false, "Log to syslog")
|
||||
@@ -47,6 +47,27 @@ 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"),
|
||||
otpType: config.GetString(profile+".otp", ""),
|
||||
certAuth: config.GetString(profile+".cert", "optionnal"),
|
||||
upgradeFrom: config.GetString(profile+".upgradeFrom", ""),
|
||||
}
|
||||
ldapConf.addIPRange(config.GetString(profile+".IPRange", ""))
|
||||
|
||||
server.ldap[profileName] = ldapConf
|
||||
}
|
||||
|
||||
// time to start the listeners
|
||||
go server.Run()
|
||||
NewHTTPServer(
|
||||
config.GetString("config.httpPort", "127.0.0.01:8080"),
|
||||
|
||||
Reference in New Issue
Block a user