mirror of
https://github.com/fosrl/pangolin.git
synced 2025-05-12 21:30:35 +01:00
Creating structure correctly
This commit is contained in:
parent
60449afca5
commit
dabd4a055c
4 changed files with 35 additions and 21 deletions
|
@ -164,7 +164,7 @@ func AddCrowdSecService(configPath string) error {
|
||||||
Image: "crowdsecurity/crowdsec:latest",
|
Image: "crowdsecurity/crowdsec:latest",
|
||||||
ContainerName: "crowdsec",
|
ContainerName: "crowdsec",
|
||||||
Environment: map[string]string{
|
Environment: map[string]string{
|
||||||
"GID": "${GID-1000}",
|
"GID": "1000",
|
||||||
"COLLECTIONS": "crowdsecurity/traefik crowdsecurity/appsec-virtual-patching crowdsecurity/appsec-generic-rules",
|
"COLLECTIONS": "crowdsecurity/traefik crowdsecurity/appsec-virtual-patching crowdsecurity/appsec-generic-rules",
|
||||||
"ENROLL_INSTANCE_NAME": "pangolin-crowdsec",
|
"ENROLL_INSTANCE_NAME": "pangolin-crowdsec",
|
||||||
"PARSERS": "crowdsecurity/whitelists",
|
"PARSERS": "crowdsecurity/whitelists",
|
||||||
|
|
|
@ -24,8 +24,8 @@ func installCrowdsec(config Config) error {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
moveFile("config/crowdsec/traefik_config.yaml", "config/traefik/traefik_config.yaml")
|
// moveFile("config/crowdsec/traefik_config.yml", "config/traefik/traefik_config.yml")
|
||||||
moveFile("config/crowdsec/dynamic.yaml", "config/traefik/dynamic.yaml")
|
moveFile("config/crowdsec/dynamic.yml", "config/traefik/dynamic.yml")
|
||||||
|
|
||||||
if err := retrieveBouncerKey(config); err != nil {
|
if err := retrieveBouncerKey(config); err != nil {
|
||||||
return fmt.Errorf("bouncer key retrieval failed: %v", err)
|
return fmt.Errorf("bouncer key retrieval failed: %v", err)
|
||||||
|
|
12
install/input.txt
Normal file
12
install/input.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
example.com
|
||||||
|
pangolin.example.com
|
||||||
|
admin@example.com
|
||||||
|
yes
|
||||||
|
admin@example.com
|
||||||
|
Password123!
|
||||||
|
Password123!
|
||||||
|
yes
|
||||||
|
no
|
||||||
|
no
|
||||||
|
no
|
||||||
|
yes
|
|
@ -140,22 +140,24 @@ func readString(reader *bufio.Reader, prompt string, defaultValue string) string
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
func readPassword(prompt string) string {
|
func readPassword(prompt string, reader *bufio.Reader) string {
|
||||||
fmt.Print(prompt + ": ")
|
if term.IsTerminal(int(syscall.Stdin)) {
|
||||||
|
fmt.Print(prompt + ": ")
|
||||||
// Read password without echo
|
// Read password without echo if we're in a terminal
|
||||||
password, err := term.ReadPassword(int(syscall.Stdin))
|
password, err := term.ReadPassword(int(syscall.Stdin))
|
||||||
fmt.Println() // Add a newline since ReadPassword doesn't add one
|
fmt.Println() // Add a newline since ReadPassword doesn't add one
|
||||||
|
if err != nil {
|
||||||
if err != nil {
|
return ""
|
||||||
return ""
|
}
|
||||||
}
|
input := strings.TrimSpace(string(password))
|
||||||
|
if input == "" {
|
||||||
input := strings.TrimSpace(string(password))
|
return readPassword(prompt, reader)
|
||||||
if input == "" {
|
}
|
||||||
return readPassword(prompt)
|
return input
|
||||||
}
|
} else {
|
||||||
return input
|
// Fallback to reading from stdin if not in a terminal
|
||||||
|
return readString(reader, prompt, "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func readBool(reader *bufio.Reader, prompt string, defaultValue bool) bool {
|
func readBool(reader *bufio.Reader, prompt string, defaultValue bool) bool {
|
||||||
|
@ -196,8 +198,8 @@ func collectUserInput(reader *bufio.Reader) Config {
|
||||||
fmt.Println("\n=== Admin User Configuration ===")
|
fmt.Println("\n=== Admin User Configuration ===")
|
||||||
config.AdminUserEmail = readString(reader, "Enter admin user email", "admin@"+config.BaseDomain)
|
config.AdminUserEmail = readString(reader, "Enter admin user email", "admin@"+config.BaseDomain)
|
||||||
for {
|
for {
|
||||||
pass1 := readPassword("Create admin user password")
|
pass1 := readPassword("Create admin user password", reader)
|
||||||
pass2 := readPassword("Confirm admin user password")
|
pass2 := readPassword("Confirm admin user password", reader)
|
||||||
|
|
||||||
if pass1 != pass2 {
|
if pass1 != pass2 {
|
||||||
fmt.Println("Passwords do not match")
|
fmt.Println("Passwords do not match")
|
||||||
|
|
Loading…
Reference in a new issue