Add new flag --ssh-hostkey-algos

The new flag allow users to set the list of hostkey algorithms
to use for ssh connections, enabling them to ensure specific
are/aren't used.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
Paulo Gomes 2022-06-12 10:44:02 +01:00
parent 9f24443c22
commit d46a42e198
No known key found for this signature in database
GPG Key ID: 9995233870E99BEE
1 changed files with 3 additions and 8 deletions

11
main.go
View File

@ -78,7 +78,6 @@ func main() {
featureGates feathelper.FeatureGates
watchAllNamespaces bool
concurrent int
kexAlgos []string
)
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
@ -87,8 +86,10 @@ func main() {
flag.BoolVar(&watchAllNamespaces, "watch-all-namespaces", true,
"Watch for custom resources in all namespaces, if set to false it will only watch the runtime namespace.")
flag.IntVar(&concurrent, "concurrent", 4, "The number of concurrent resource reconciles.")
flag.StringSliceVar(&kexAlgos, "ssh-kex-algos", []string{},
flag.StringSliceVar(&git.KexAlgos, "ssh-kex-algos", []string{},
"The list of key exchange algorithms to use for ssh connections, arranged from most preferred to the least.")
flag.StringSliceVar(&git.HostKeyAlgos, "ssh-hostkey-algos", []string{},
"The list of hostkey algorithms to use for ssh connections, arranged from most preferred to the least.")
clientOptions.BindFlags(flag.CommandLine)
logOptions.BindFlags(flag.CommandLine)
@ -164,15 +165,9 @@ func main() {
managed.InitManagedTransport(ctrl.Log.WithName("managed-transport"))
}
setPreferredKexAlgos(kexAlgos)
setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
}
func setPreferredKexAlgos(algos []string) {
git.KexAlgos = algos
}