From 2b02ea6530eff56172cbf14338b5e86b4522d273 Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Wed, 15 Feb 2017 12:29:27 -0700 Subject: [PATCH] Add chmod up directory tree for world read/execute on directories --- core/pkg/ingress/annotations/auth/main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/pkg/ingress/annotations/auth/main.go b/core/pkg/ingress/annotations/auth/main.go index 2921a550c..fe2167f03 100644 --- a/core/pkg/ingress/annotations/auth/main.go +++ b/core/pkg/ingress/annotations/auth/main.go @@ -20,6 +20,7 @@ import ( "fmt" "io/ioutil" "os" + "path" "regexp" "github.com/pkg/errors" @@ -59,8 +60,17 @@ type auth struct { // NewParser creates a new authentication annotation parser func NewParser(authDirectory string, sr resolver.Secret) parser.IngressAnnotation { - // TODO: check permissions required - os.MkdirAll(authDirectory, 0655) + os.MkdirAll(authDirectory, 0755) + + currPath := authDirectory + for currPath != "/" { + currPath = path.Dir(currPath) + err := os.Chmod(currPath, 0755) + if err != nil { + break + } + } + return auth{sr, authDirectory} }