Allow SSH server port to be configured at runtime

This commit is contained in:
Anders Pitman 2020-11-26 20:13:50 -07:00
parent 95f961ba58
commit 05aeec0e9b
2 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,8 @@ import (
)
type BoringProxyConfig struct {
WebUiDomain string `json:"webui_domain"`
WebUiDomain string `json:"webui_domain"`
SshServerPort int `json:"ssh_server_port"`
}
type SmtpConfig struct {
@ -36,6 +37,7 @@ type BoringProxy struct {
func Listen() {
flagSet := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
adminDomain := flagSet.String("admin-domain", "", "Admin Domain")
sshServerPort := flagSet.Int("ssh-server-port", 22, "SSH Server Port")
flagSet.Parse(os.Args[2:])
webUiDomain := *adminDomain
@ -47,7 +49,10 @@ func Listen() {
webUiDomain = strings.TrimSpace(text)
}
config := &BoringProxyConfig{WebUiDomain: webUiDomain}
config := &BoringProxyConfig{
WebUiDomain: webUiDomain,
SshServerPort: *sshServerPort,
}
certmagic.DefaultACME.DisableHTTPChallenge = true
//certmagic.DefaultACME.DisableTLSALPNChallenge = true

View File

@ -83,7 +83,7 @@ func (m *TunnelManager) RequestCreateTunnel(tunReq Tunnel) (Tunnel, error) {
}
tunReq.ServerAddress = m.config.WebUiDomain
tunReq.ServerPort = 22
tunReq.ServerPort = m.config.SshServerPort
tunReq.ServerPublicKey = ""
tunReq.Username = m.user.Username
tunReq.TunnelPort = port