config: Remove erronous yaml entries

This commit is contained in:
Tom Wiesing 2023-03-08 12:25:32 +01:00
parent 7371cc2163
commit 840efd5c03
No known key found for this signature in database
8 changed files with 13 additions and 14 deletions

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=

View file

@ -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.

View file

@ -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

View file

@ -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)

View file

@ -81,7 +81,7 @@ func (tpl Template) Generate() Config {
return Config{
Listen: ListenConfig{
Ports: []uint16{80},
AdvertisedSSHPort: 80,
SSHPort: 80,
},
Paths: PathsConfig{
Root: tpl.RootPath,

View file

@ -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)

View file

@ -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])
}