maddy
maddy copied to clipboard
Specifying `tls_client` on `target.smtp` crashes at startup
Describe the bug
Specifying tls_client configuration in a target.smtp block results in a crash at startup.
Steps to reproduce
Add tls_client configuration to any target.smtp block, for example:
target.smtp upstream_smtp {
debug {env:DEBUG}
attempt_starttls yes
require_tls yes
tls_client {
cert /data/tls/tls.crt
key /data/tls/tls.key
}
targets tcp://smtp.myupstream.com:25
}
Log files
panic: reflect.Set: value of type *tls.Config is not assignable to type tls.Config
goroutine 1 [running]:
reflect.Value.assignTo({0x12b2ae0?, 0xc00036e600?, 0x2?}, {0x131c820, 0xb}, 0x12f7580, 0x0)
reflect/value.go:3145 +0x2a5
reflect.Value.Set({0x12f7580?, 0xc0003be2b8?, 0x0?}, {0x12b2ae0?, 0xc00036e600?, 0x0?})
reflect/value.go:2160 +0xeb
github.com/foxcpp/maddy/framework/config.(*matcher).assign(0x116d380?, {0x12b2ae0?, 0xc00036e600?})
github.com/foxcpp/maddy/framework/config/map.go:48 +0x113
github.com/foxcpp/maddy/framework/config.(*Map).ProcessWith(0xc0001ec400, 0x131fff0?, {{0xc00031a2f0, 0xb}, {0xc000310040, 0x1, 0x1}, {0xc0001b6000, 0x5, 0x5}, ...})
github.com/foxcpp/maddy/framework/config/map.go:678 +0x514
github.com/foxcpp/maddy/framework/config.(*Map).Process(...)
github.com/foxcpp/maddy/framework/config/map.go:640
github.com/foxcpp/maddy/internal/target/smtp.(*Downstream).Init(0xc0003be240, 0xc0001ec400)
github.com/foxcpp/maddy/internal/target/smtp/smtp_downstream.go:108 +0x2f9
github.com/foxcpp/maddy/framework/module.GetInstance({0xc00031a2a1, 0xe})
github.com/foxcpp/maddy/framework/module/instances.go:91 +0x103
github.com/foxcpp/maddy/framework/config/module.ModuleFromNode({0x13118c5?, 0xc00032e648?}, {0xc000310020, 0xc00051ba38?, 0x4a54c5?}, {{0xc00031a258, 0x6}, {0xc000310020, 0x1, 0x1}, ...}, ...)
github.com/foxcpp/maddy/framework/config/module/modconfig.go:120 +0x127
github.com/foxcpp/maddy/framework/config/module.DeliveryTarget(0x1c938e8?, {0xc000310020, 0x1, 0x1}, {{0xc00031a258, 0x6}, {0xc000310020, 0x1, 0x1}, {0x0, ...}, ...})
github.com/foxcpp/maddy/framework/config/module/interfaces.go:51 +0xb7
github.com/foxcpp/maddy/framework/config/module.DeliveryDirective(0x587dd3?, {{0xc00031a258, 0x6}, {0xc000310020, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0, ...})
github.com/foxcpp/maddy/framework/config/module/interfaces.go:46 +0x65
github.com/foxcpp/maddy/framework/config.(*Map).ProcessWith(0xc0001ec380, 0x4137d3?, {{0xc00031a120, 0xc}, {0xc000310000, 0x1, 0x1}, {0xc0004ac0c0, 0x2, 0x2}, ...})
github.com/foxcpp/maddy/framework/config/map.go:672 +0x488
github.com/foxcpp/maddy/framework/config.(*Map).Process(...)
github.com/foxcpp/maddy/framework/config/map.go:640
github.com/foxcpp/maddy/internal/target/queue.(*Queue).Init(0xc00032e5b0, 0xc0001ec380)
github.com/foxcpp/maddy/internal/target/queue/queue.go:222 +0x278
github.com/foxcpp/maddy/framework/module.GetInstance({0xc000259ba1, 0xf})
github.com/foxcpp/maddy/framework/module/instances.go:91 +0x103
github.com/foxcpp/maddy/framework/config/module.ModuleFromNode({0x13118c5?, 0xc000580000?}, {0xc000264150, 0x0?, 0x8b1997?}, {{0xc000259b50, 0xa}, {0xc000264150, 0x1, 0x1}, ...}, ...)
github.com/foxcpp/maddy/framework/config/module/modconfig.go:120 +0x127
github.com/foxcpp/maddy/framework/config/module.DeliveryTarget(0xc000300b40?, {0xc000264150, 0x1, 0x1}, {{0xc000259b50, 0xa}, {0xc000264150, 0x1, 0x1}, {0x0, ...}, ...})
github.com/foxcpp/maddy/framework/config/module/interfaces.go:51 +0xb7
github.com/foxcpp/maddy/internal/msgpipeline.parseMsgPipelineRcptCfg(0x12970e0?, {0xc000300b40, 0x1, 0xc000310a80?})
github.com/foxcpp/maddy/internal/msgpipeline/config.go:284 +0x689
github.com/foxcpp/maddy/internal/msgpipeline.parseMsgPipelineSrcCfg(0x1056094?, {0xc0002314a0, 0x1, 0x4137d3?})
github.com/foxcpp/maddy/internal/msgpipeline/config.go:243 +0x17a
github.com/foxcpp/maddy/internal/msgpipeline.parseMsgPipelineRootCfg(0x131fda7?, {0xc0000ed600, _, _})
github.com/foxcpp/maddy/internal/msgpipeline/config.go:85 +0xa05
github.com/foxcpp/maddy/internal/msgpipeline.New(0x1d62540?, {0xc0000ed600?, 0xc000433220?, 0x1?})
github.com/foxcpp/maddy/internal/msgpipeline/msgpipeline.go:89 +0x5b
github.com/foxcpp/maddy/internal/endpoint/smtp.(*Endpoint).setConfig(0xc0003d2840, 0xc0001ec600)
github.com/foxcpp/maddy/internal/endpoint/smtp/smtp.go:296 +0x718
github.com/foxcpp/maddy/internal/endpoint/smtp.(*Endpoint).Init(0xc0003d2840, 0xc000340360?)
github.com/foxcpp/maddy/internal/endpoint/smtp/smtp.go:113 +0xe9
github.com/foxcpp/maddy.initModules(0xc0003bc420, {0xc00013a2a0?, 0x2, 0x5345f9?}, {0xc0000ec2c0, 0x4, 0x7ffc1734faa0?})
github.com/foxcpp/maddy/maddy.go:409 +0x15c
github.com/foxcpp/maddy.moduleMain({0xc000262c00?, 0xc0000147f8?, 0x7ffc1734faa0?})
github.com/foxcpp/maddy/maddy.go:326 +0xa5
github.com/foxcpp/maddy.Run(0xc000101b80?)
github.com/foxcpp/maddy/maddy.go:207 +0x357
github.com/urfave/cli/v2.(*Command).Run(0xc000101b80, 0xc000226ac0, {0xc0001f15f0, 0x1, 0x1})
github.com/urfave/cli/[email protected]/command.go:279 +0xa8f
github.com/urfave/cli/v2.(*Command).Run(0xc000256420, 0xc000226880, {0xc000040080, 0x4, 0x4})
github.com/urfave/cli/[email protected]/command.go:272 +0xced
github.com/urfave/cli/v2.(*App).RunContext(0xc00016e000, {0x14f7250?, 0xc00004a090}, {0xc000040080, 0x4, 0x4})
github.com/urfave/cli/[email protected]/app.go:337 +0x63a
github.com/urfave/cli/v2.(*App).Run(...)
github.com/urfave/cli/[email protected]/app.go:311
github.com/foxcpp/maddy/internal/cli.Run()
github.com/foxcpp/maddy/internal/cli/app.go:106 +0x17e
main.main()
github.com/foxcpp/maddy/cmd/maddy/main.go:28 +0x17
Environment information
- maddy version: 0.7.1
Same here, running Maddy 0.7.1 on FreeBSD 14.1 with go 1.21. My LDAP-related TLS stanza:
ldap authentication settings
auth.ldap ldap { urls ldaps://ldap.jail.vlan:389 bind plain "cn=LDAPReader,ou=Roles,o=Consulting4Change" "LDAPReader_password" base_dn "ou=People,o=Company" filter "(&(mail={username})(objectclass=inetOrgPerson)(memberOf=cn=Mail,ou=Groups,o=Company))" starttls on tls_client { #protocols tls1.0 tls1.3 protocols tls1.2 tls1.3 root_ca /etc/ssl/cacerts/ca.jail.vlan.cacert.pem } } Thank you for your help!