diff --git a/go.mod b/go.mod index 220f53f..07b49fa 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/pquerna/otp v1.4.0 github.com/rs/zerolog v1.29.0 github.com/tkw1536/goprogram v0.3.0 - github.com/tkw1536/pkglib v0.0.0-20230306213020-a931cd9a13bb + github.com/tkw1536/pkglib v0.0.0-20230308112329-3b08d9c8a573 github.com/yuin/goldmark v1.5.4 github.com/yuin/goldmark-meta v1.1.0 golang.org/x/crypto v0.3.0 diff --git a/go.sum b/go.sum index 9a903c8..0db308d 100644 --- a/go.sum +++ b/go.sum @@ -116,8 +116,8 @@ github.com/tdewolff/parse v2.3.4+incompatible/go.mod h1:8oBwCsVmUkgHO8M5iCzSIDtp github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM= github.com/tkw1536/goprogram v0.3.0 h1:bMnr+PMZHRaaw3atIHz2I0/vCdwl2Bx8KaNutTD7psg= github.com/tkw1536/goprogram v0.3.0/go.mod h1:lIWTpzLCbji7b9mSU+iPrQYTJOa0DgOE5is8UyW9/n0= -github.com/tkw1536/pkglib v0.0.0-20230306213020-a931cd9a13bb h1:orx6ZmvfGXclVAwc0nsHlWgyEuhDxLlN+ap6zNSSWA4= -github.com/tkw1536/pkglib v0.0.0-20230306213020-a931cd9a13bb/go.mod h1:R+8tKMAkSXC1+XGzxNUKx2DnPJqObycYeo4PKjWYkMg= +github.com/tkw1536/pkglib v0.0.0-20230308112329-3b08d9c8a573 h1:AuX4RmKQVhjgHaSkezS9cH46y9myEQ6QwjWwdEm9ChQ= +github.com/tkw1536/pkglib v0.0.0-20230308112329-3b08d9c8a573/go.mod h1:R+8tKMAkSXC1+XGzxNUKx2DnPJqObycYeo4PKjWYkMg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/internal/config/config.yml b/internal/config/config.yml index 6e929b9..458cda3 100644 --- a/internal/config/config.yml +++ b/internal/config/config.yml @@ -4,8 +4,8 @@ listen: ports: null # The ssh port that is shown to the user in various interfaces. - # This port is not automatically included in the ports to listen to. - advertise_ssh: null + # This port is automatically included in the ports to listen to. + ssh: null paths: # A WissKI Distillery needs to store a lot of data on disk. @@ -79,7 +79,6 @@ triplestore: # The default here is 720hours (== 30 days) age: null - # Various components use password-based-authentication. # These passwords are generated automatically. # This variable can be used to determine their length. diff --git a/internal/config/legacy/legacy.go b/internal/config/legacy/legacy.go index 8ebd165..eb34ade 100644 --- a/internal/config/legacy/legacy.go +++ b/internal/config/legacy/legacy.go @@ -88,7 +88,7 @@ func (legacy *Legacy) Migrate(cfg *config.Config) error { if legacy.CertbotEmail != "" { cfg.Listen.Ports = append(cfg.Listen.Ports, 443) } - cfg.Listen.AdvertisedSSHPort = legacy.PublicSSHPort + cfg.Listen.SSHPort = legacy.PublicSSHPort cfg.TS.AdminUsername = legacy.TriplestoreAdminUser cfg.TS.AdminPassword = legacy.TriplestoreAdminPassword cfg.SQL.AdminUsername = legacy.MysqlAdminUser diff --git a/internal/config/ports.go b/internal/config/ports.go index c08f7ce..d049934 100644 --- a/internal/config/ports.go +++ b/internal/config/ports.go @@ -12,16 +12,16 @@ type ListenConfig struct { // This should typically be port 80 and port 443. Ports []uint16 `yaml:"ports" default:"80" validate:"ports"` - // AdvertisedSSHPort is the port that shows up as the ssh port in various places in the interface. + // SSHPort is the port that shows up as the ssh port in various places in the interface. // It is automaticalled added to the ports to listen to. - AdvertisedSSHPort uint16 `yaml:"advertise_ssh" default:"80" validate:"port"` + SSHPort uint16 `yaml:"ssh" default:"80" validate:"port"` } // ComposePorts returns a list of ports to be used within a docker-compose.yml file. // These can be used to forward all ports to the internal port. func (lc ListenConfig) ComposePorts(internal string) []string { // sort and uniquify ports - ports := append([]uint16{lc.AdvertisedSSHPort}, lc.Ports...) + ports := append([]uint16{lc.SSHPort}, lc.Ports...) slices.Sort(ports) ports = slices.Compact(ports) diff --git a/internal/config/template.go b/internal/config/template.go index ade9638..72b7f92 100644 --- a/internal/config/template.go +++ b/internal/config/template.go @@ -80,8 +80,8 @@ func (tpl *Template) SetDefaults() (err error) { func (tpl Template) Generate() Config { return Config{ Listen: ListenConfig{ - Ports: []uint16{80}, - AdvertisedSSHPort: 80, + Ports: []uint16{80}, + SSHPort: 80, }, Paths: PathsConfig{ Root: tpl.RootPath, diff --git a/internal/dis/component/auth/panel/ssh.go b/internal/dis/component/auth/panel/ssh.go index 034565e..6f5ffc0 100644 --- a/internal/dis/component/auth/panel/ssh.go +++ b/internal/dis/component/auth/panel/ssh.go @@ -59,7 +59,7 @@ func (panel *UserPanel) sshRoute(ctx context.Context) http.Handler { } sc.Domain = panel.Config.HTTP.PrimaryDomain - sc.Port = panel.Config.Listen.AdvertisedSSHPort + sc.Port = panel.Config.Listen.SSHPort // pick the first domain that the user has access to as an example grants, err := panel.Dependencies.Policy.User(r.Context(), user.User.User) diff --git a/internal/dis/component/ssh2/server_handler.go b/internal/dis/component/ssh2/server_handler.go index 7e52804..8ed7d27 100644 --- a/internal/dis/component/ssh2/server_handler.go +++ b/internal/dis/component/ssh2/server_handler.go @@ -82,7 +82,7 @@ func (ssh2 *SSH2) handleConnection(session ssh.Session) { {"${SLUG}", slug}, {"${DOMAIN}", ssh2.Config.HTTP.PrimaryDomain}, {"${HOSTNAME}", slug + "." + ssh2.Config.HTTP.PrimaryDomain}, - {"${PORT}", strconv.FormatUint(uint64(ssh2.Config.Listen.AdvertisedSSHPort), 10)}, + {"${PORT}", strconv.FormatUint(uint64(ssh2.Config.Listen.SSHPort), 10)}, } { banner = strings.ReplaceAll(banner, oldnew[0], oldnew[1]) }