plugin/tls: respect the path specified by root plugin (#5944)

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>
This commit is contained in:
Marius Kimmina
2023-06-01 14:56:57 +02:00
committed by GitHub
parent cf87aa92bd
commit d0375bc026
5 changed files with 27 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package tls
import (
ctls "crypto/tls"
"path/filepath"
"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
@@ -57,6 +58,11 @@ func parseTLS(c *caddy.Controller) error {
return c.Errf("unknown option '%s'", c.Val())
}
}
for i := range args {
if !filepath.IsAbs(args[i]) && config.Root != "" {
args[i] = filepath.Join(config.Root, args[i])
}
}
tls, err := tls.NewTLSConfigFromArgs(args...)
if err != nil {
return err