Skip to content

Error setting tls_config for LDAP #824

@mheppner

Description

@mheppner

Describe the bug

Similar to #688, setting tls_config for auth.ldap results in a crash:

panic: reflect.Set: value of type *tls.Config is not assignable to type tls.Config

Steps to reproduce

I have a self-signed certificated used by LDAP, and the corresponding CA certificate. Setting the root_ca for LDAP results in a crash. #709 could also help with this setup.

Log file

panic: reflect.Set: value of type *tls.Config is not assignable to type tls.Config

goroutine 1 [running]:
reflect.Value.assignTo({0x4cb4c0?, 0x8701bad20?, 0x870297410?}, {0x51e336, 0xb}, 0x4fd660, 0x0)
	reflect/value.go:3072 +0x28b
reflect.Value.Set({0x4fd660?, 0x8703970c0?, 0x8700138a8?}, {0x4cb4c0?, 0x8701bad20?, 0x87028a860?})
	reflect/value.go:2057 +0xe6
github.com/foxcpp/maddy/framework/config.(*matcher).assign(0x37e1e0?, {0x4cb4c0?, 0x8701bad20?})
	github.com/foxcpp/maddy/framework/config/map.go:49 +0xe5
github.com/foxcpp/maddy/framework/config.(*Map).ProcessWith(0x8700eac80, 0x8703a7cb0, {{0x8703bd540, 0x9}, {0x8703ca0e0, 0x1, 0x1}, {0x8703a2c88, 0x6, 0x6}, ...})
	github.com/foxcpp/maddy/framework/config/map.go:687 +0x4f9
github.com/foxcpp/maddy/framework/config.(*Map).Process(...)
	github.com/foxcpp/maddy/framework/config/map.go:649
github.com/foxcpp/maddy/internal/auth/ldap.(*Auth).Init(0x870397088, 0x8700eac80)
	github.com/foxcpp/maddy/internal/auth/ldap/ldap.go:73 +0x498
github.com/foxcpp/maddy/framework/module.GetInstance({0x8703d96f1, 0xa})
	github.com/foxcpp/maddy/framework/module/instances.go:91 +0xea
github.com/foxcpp/maddy/framework/config/module.ModuleFromNode({0x50f718?, 0xf2abc5?}, {0x8703ca230, 0xfd8e06?, 0x441320?}, {{0x8703d96a8, 0x4}, {0x8703ca230, 0x1, 0x1}, ...}, ...)
	github.com/foxcpp/maddy/framework/config/module/modconfig.go:120 +0x118
github.com/foxcpp/maddy/internal/auth.(*SASLAuth).AddProvider(0x8704029a0, 0x870322200, {{0x8703d96a8, 0x4}, {0x8703ca230, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...})
	github.com/foxcpp/maddy/internal/auth/sasl.go:187 +0xb4
github.com/foxcpp/maddy/internal/endpoint/smtp.(*Endpoint).setConfig.func1(0x870322200?, {{0x8703d96a8, 0x4}, {0x8703ca230, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0, ...})
	github.com/foxcpp/maddy/internal/endpoint/smtp/smtp.go:246 +0x3e
github.com/foxcpp/maddy/framework/config.(*Map).ProcessWith(0x870322200, 0x8703a7cb0, {{0x8703d9410, 0xa}, {0x8703cfbe0, 0x2, 0x2}, {0x8703b7080, 0x4, 0x4}, ...})
	github.com/foxcpp/maddy/framework/config/map.go:669 +0x37d
github.com/foxcpp/maddy/framework/config.(*Map).Process(...)
	github.com/foxcpp/maddy/framework/config/map.go:649
github.com/foxcpp/maddy/internal/endpoint/smtp.(*Endpoint).setConfig(0x8704029a0, 0x870322200)
	github.com/foxcpp/maddy/internal/endpoint/smtp/smtp.go:284 +0x6f8
github.com/foxcpp/maddy/internal/endpoint/smtp.(*Endpoint).Init(0x8704029a0, 0x870322200)
	github.com/foxcpp/maddy/internal/endpoint/smtp/smtp.go:110 +0x1bf
github.com/foxcpp/maddy.initModules(0x8703a7cb0, {0x87040a380?, 0x9?, 0x10777d4?}, {0x870401c08, 0x6, 0x82225a2d7?})
	github.com/foxcpp/maddy/maddy.go:409 +0x156
github.com/foxcpp/maddy.moduleMain({0x8703cc608?, 0x87006a438?, 0x82225a2d7?})
	github.com/foxcpp/maddy/maddy.go:327 +0x95
github.com/foxcpp/maddy.Run(0x870094980)
	github.com/foxcpp/maddy/maddy.go:207 +0x3e5
github.com/urfave/cli/v2.(*Command).Run(0x8700ec420, 0x870094980, {0x870047190, 0x1, 0x1})
	github.com/urfave/cli/v2@v2.27.5/command.go:276 +0x7be
github.com/urfave/cli/v2.(*Command).Run(0x8703badc0, 0x870094740, {0x870148120, 0x6, 0x6})
	github.com/urfave/cli/v2@v2.27.5/command.go:269 +0xa45
github.com/urfave/cli/v2.(*App).RunContext(0x8700d6200, {0x7088e0, 0x1de9ee0}, {0x870148120, 0x6, 0x6})
	github.com/urfave/cli/v2@v2.27.5/app.go:333 +0x5a5
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/v2@v2.27.5/app.go:307
github.com/foxcpp/maddy/internal/cli.Run()
	github.com/foxcpp/maddy/internal/cli/app.go:110 +0x1a5
main.main()
	github.com/foxcpp/maddy/cmd/maddy/main.go:28 +0x

Configuration file

auth.ldap lldap_auth {
    urls ldaps://127.0.0.1:6360
    tls_client {
        root_ca /usr/local/etc/ca.crt
    }
}

Environment information

  • maddy version: v0.8.2 freebsd/amd64 go1.24.13

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.ready-for-releaseFeature is implemented and available for testing in dev branch. It will be included in the next rele

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions