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

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"errors"
"fmt"
"path/filepath"
"strconv"
"time"
@@ -165,6 +166,7 @@ func parseStanza(c *caddy.Controller) (*Forward, error) {
}
func parseBlock(c *caddy.Controller, f *Forward) error {
config := dnsserver.GetConfig(c)
switch c.Val() {
case "except":
ignore := c.RemainingArgs()
@@ -230,7 +232,11 @@ func parseBlock(c *caddy.Controller, f *Forward) error {
if len(args) > 3 {
return c.ArgErr()
}
for i := range args {
if !filepath.IsAbs(args[i]) && config.Root != "" {
args[i] = filepath.Join(config.Root, args[i])
}
}
tlsConfig, err := pkgtls.NewTLSConfigFromArgs(args...)
if err != nil {
return err