mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
disable hostkeychecking for ssh from containers
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -267,6 +268,14 @@ func (sc *SSHConnector) runRemoteCommand(ctx context.Context, command []string)
|
|||||||
|
|
||||||
func (sc *SSHConnector) buildSSHArgs(command []string) []string {
|
func (sc *SSHConnector) buildSSHArgs(command []string) []string {
|
||||||
args := []string{"-o", "BatchMode=yes"}
|
args := []string{"-o", "BatchMode=yes"}
|
||||||
|
// In containerized environments, disable strict host key checking
|
||||||
|
if _, container := os.LookupEnv("CONTAINER"); container {
|
||||||
|
args = append(args,
|
||||||
|
"-o", "StrictHostKeyChecking=no",
|
||||||
|
"-o", "UserKnownHostsFile=/dev/null",
|
||||||
|
"-o", "LogLevel=ERROR",
|
||||||
|
)
|
||||||
|
}
|
||||||
if sc.server.SSHKeyPath != "" {
|
if sc.server.SSHKeyPath != "" {
|
||||||
args = append(args, "-i", sc.server.SSHKeyPath)
|
args = append(args, "-i", sc.server.SSHKeyPath)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user