From 0ca27786ce5a62e0be92112c066044022a657cd3 Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Mon, 28 May 2018 16:51:57 +0200 Subject: [PATCH] Inform Dryad about SSH listen address When multiple Dryads run under the same IP address, SSH and Dryad listen ports must be different. Change-Id: Iedf8dd5aafb0c45c6d8c6c6b45bc61d47c720041 Signed-off-by: Aleksander Mistewicz --- dryad/conf/conf.go | 10 ++++++++-- dryad/conf/conf_test.go | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dryad/conf/conf.go b/dryad/conf/conf.go index 049fb7b..d8b37cd 100644 --- a/dryad/conf/conf.go +++ b/dryad/conf/conf.go @@ -31,11 +31,15 @@ import ( // for Dryad's RPC client and server. const DefaultRPCPort = 7175 +// DefaultSSHPort is a default port off SSH daemon. +const DefaultSSHPort = 22 + // NewConf returns a new instance of General configuration with default values set. func NewConf() *General { return &General{ - Address: fmt.Sprintf(":%d", DefaultRPCPort), - Caps: Capabilities(map[string]string{}), + Address: fmt.Sprintf(":%d", DefaultRPCPort), + SSHAdress: fmt.Sprintf(":%d", DefaultSSHPort), + Caps: Capabilities(map[string]string{}), User: &User{ Name: "boruta-user", Groups: []string{}, @@ -60,6 +64,8 @@ type General struct { Address string `toml:"listen_address"` // BorutaAddress is used to connect to Boruta server. BorutaAddress string `toml:"boruta_address"` + // SSHAdress is a ssh daemon listen address. + SSHAdress string `toml:"ssh_address"` // Caps are necessary information to register in Boruta. // // TODO(amistewicz): This field should be removed when diff --git a/dryad/conf/conf_test.go b/dryad/conf/conf_test.go index f8f9997..c220a5f 100644 --- a/dryad/conf/conf_test.go +++ b/dryad/conf/conf_test.go @@ -30,6 +30,7 @@ import ( var _ = Describe("Conf", func() { marshaled := `listen_address = ":7175" boruta_address = "" +ssh_address = ":22" sdcard = "/dev/sdX" stm_path = "/run/stm.socket" @@ -40,8 +41,9 @@ stm_path = "/run/stm.socket" groups = [] ` unmarshaled := &General{ - Address: ":7175", - Caps: boruta.Capabilities(map[string]string{}), + Address: ":7175", + SSHAdress: ":22", + Caps: boruta.Capabilities(map[string]string{}), User: &User{ Name: "boruta-user", Groups: []string{}, -- 2.7.4