aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMrArmonius <mrarmonius@gmail.com>2021-07-07 01:49:33 +0200
committerMrArmonius <mrarmonius@gmail.com>2021-07-19 18:56:47 +0200
commita98556d5c1241f9150202d72ea096a775d97a582 (patch)
tree17825f52e0079e7eaa759a28951b9eb6fda6572e /main.go
parentaa912b5ceb24cb8772709171ea9589b0771bbe54 (diff)
downloadbottin-a98556d5c1241f9150202d72ea096a775d97a582.tar.gz
bottin-a98556d5c1241f9150202d72ea096a775d97a582.zip
Test End-to-end V1.0, testing Bottin's behavior
Tests wrote in golang without framework Testing on the Bottin's behavior Tests made: - crated random Users and Group - LDAP ADD - check the match between Consul's data and Test's data- LDAP Search - modify attributes and check them - LDAP Modify
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/main.go b/main.go
index 13d3da6..91c3bbd 100644
--- a/main.go
+++ b/main.go
@@ -320,12 +320,19 @@ func (server *Server) init() error {
return err
}
- admin_pass := make([]byte, 8)
- _, err = rand.Read(admin_pass)
- if err != nil {
- return err
+
+ admin_pass_str, environnement_variable_exist := os.LookupEnv("BOTTIN_DEFAULT_ADMIN_PW")
+ if !environnement_variable_exist {
+ admin_pass := make([]byte, 8)
+ _, err = rand.Read(admin_pass)
+ if err != nil {
+ return err
+ }
+ admin_pass_str = base64.RawURLEncoding.EncodeToString(admin_pass)
+ } else {
+ server.logger.Printf("It seems that exists a password in environnement variable")
}
- admin_pass_str := base64.RawURLEncoding.EncodeToString(admin_pass)
+
admin_pass_hash := SSHAEncode([]byte(admin_pass_str))
admin_dn := "cn=admin," + server.config.Suffix