mirror of
https://github.com/coredns/coredns.git
synced 2026-07-24 08:30:11 -04:00
test(tls): make keylog path test portable (#8311)
Directory permission checks can be bypassed by privileged users and may behave differently on filesystems with nonstandard permission semantics. Make the bad-path case deterministic so TLS keylog tests remain portable across supported environments. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -2,7 +2,6 @@ package tls
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -102,8 +101,7 @@ func TestTLSKeyLog(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("Bad Path", func(t *testing.T) {
|
t.Run("Bad Path", func(t *testing.T) {
|
||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
os.Chmod(tmpDir, 0000)
|
input := "tls test_cert.pem test_key.pem test_ca.pem {\nkeylog " + filepath.Join(tmpDir, "missing", "tls.log") + "\n}"
|
||||||
input := "tls test_cert.pem test_key.pem test_ca.pem {\nkeylog " + filepath.Join(tmpDir, "tls.log") + "\n}"
|
|
||||||
c := caddy.NewTestController("dns", input)
|
c := caddy.NewTestController("dns", input)
|
||||||
err := setup(c)
|
err := setup(c)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user