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

@@ -3,6 +3,7 @@ package grpc
import (
"crypto/tls"
"fmt"
"path/filepath"
"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
@@ -110,7 +111,11 @@ func parseBlock(c *caddy.Controller, g *GRPC) error {
if len(args) > 3 {
return c.ArgErr()
}
for i := range args {
if !filepath.IsAbs(args[i]) && dnsserver.GetConfig(c).Root != "" {
args[i] = filepath.Join(dnsserver.GetConfig(c).Root, args[i])
}
}
tlsConfig, err := pkgtls.NewTLSConfigFromArgs(args...)
if err != nil {
return err