validator is now login-validator and is part of the server image
This commit is contained in:
parent
fd58db5eb1
commit
ee6fbe3e74
11 changed files with 23 additions and 5 deletions
|
|
@ -1,53 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var tftpDir string
|
||||
|
||||
func main() {
|
||||
var studentsFile string
|
||||
|
||||
var lc loginChecker
|
||||
|
||||
var bind = flag.String("bind", ":8081", "Bind port/socket")
|
||||
flag.StringVar(&studentsFile, "students", "./students.csv", "Path to a CSV file containing students list")
|
||||
flag.StringVar(&ARPTable, "arp", ARPTable, "Path to ARP table")
|
||||
flag.StringVar(&tftpDir, "tftpdir", "/var/tftp/", "Path to TFTPd directory")
|
||||
flag.StringVar(&loginSalt, "loginsalt", "adelina", "secret used in login HMAC")
|
||||
|
||||
flag.StringVar(&lc.ldapAddr, "ldaphost", "auth.cri.epita.fr", "LDAP host")
|
||||
flag.IntVar(&lc.ldapPort, "ldapport", 636, "LDAP port")
|
||||
flag.BoolVar(&lc.ldapIsTLS, "ldaptls", false, "Is LDAP connection LDAPS?")
|
||||
flag.StringVar(&lc.ldapBase, "ldapbase", "dc=epita,dc=net", "LDAP base")
|
||||
flag.StringVar(&lc.ldapBindUsername, "ldapbindusername", "", "LDAP user to use in order to perform bind (optional if search can be made anonymously)")
|
||||
flag.StringVar(&lc.ldapBindPassword, "ldapbindpassword", "", "Password for the bind user")
|
||||
flag.Parse()
|
||||
|
||||
var err error
|
||||
|
||||
// Sanitize options
|
||||
log.Println("Checking paths...")
|
||||
if tftpDir, err = filepath.Abs(tftpDir); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
lc.students, err = readStudentsList(studentsFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println("Registering handlers...")
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", Index)
|
||||
mux.Handle("/login", lc)
|
||||
mux.HandleFunc("/logout", logout)
|
||||
http.HandleFunc("/", mux.ServeHTTP)
|
||||
|
||||
log.Println("Ready, listening on port", *bind)
|
||||
http.ListenAndServe(*bind, nil)
|
||||
}
|
||||
Reference in a new issue