From 89178c395b4b77cd3e3820dfe6d11955ccc5a327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Tue, 22 May 2018 12:43:37 +0200 Subject: [PATCH] Fix permissions of generated Filebeat filesets (#7140) * fix generated files' permission Closes #6856 --- CHANGELOG-developer.asciidoc | 3 +++ filebeat/scripts/generator/generator.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-developer.asciidoc b/CHANGELOG-developer.asciidoc index b30d1cecbd5f..8a670158777c 100644 --- a/CHANGELOG-developer.asciidoc +++ b/CHANGELOG-developer.asciidoc @@ -22,5 +22,8 @@ The list below covers the major changes between 6.3.0 and master only. - The beat.Pipeline is now passed to cfgfile.RunnerFactory. Beats using libbeat for module reloading or autodiscovery need to be adapted. {pull}7018[7017] - Moving of TLS helper functions and structs from `output/tls` to `tlscommon`. {pull}7054[7054] +==== Bugfixes + +- Fix permissions of generated Filebeat filesets. {pull}7140[7140] ==== Added diff --git a/filebeat/scripts/generator/generator.go b/filebeat/scripts/generator/generator.go index d12f491e8bd2..f9be861c8f52 100644 --- a/filebeat/scripts/generator/generator.go +++ b/filebeat/scripts/generator/generator.go @@ -49,7 +49,7 @@ func AppendTemplate(template, dest string, replace map[string]string) error { return err } - f, err := os.OpenFile(dest, os.O_WRONLY|os.O_APPEND, os.ModePerm) + f, err := os.OpenFile(dest, os.O_WRONLY|os.O_APPEND, 0644) if err == nil { _, err = f.Write(c) } @@ -66,10 +66,11 @@ func copyTemplate(template, dest string, replace map[string]string) error { return err } - err = ioutil.WriteFile(dest, c, os.ModePerm) + err = ioutil.WriteFile(dest, c, 0644) if err != nil { return fmt.Errorf("cannot copy template: %v", err) } + return nil }