Don't log passwords on start (#463)

* Don't log passwords on start

The two passwords configurable as flags (for infoblox and dyn) are
masked now and not logged.

* docs: add masking sensitive data in logs to changelog
This commit is contained in:
jvassev 2018-02-19 14:03:22 +02:00 committed by Martin Linkhorst
parent bd1aef2667
commit 02f833975d
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
- Don't log sensitive data on start (#463) @jvassev
- Google: Improve logging to help trace misconfigurations (#388) @stealthybox - Google: Improve logging to help trace misconfigurations (#388) @stealthybox
- AWS: In addition to the one best public hosted zone, records will be added to all matching private hosted zones (#356) @coreypobrien - AWS: In addition to the one best public hosted zone, records will be added to all matching private hosted zones (#356) @coreypobrien
- Every record managed by External DNS is now mapped to a kubernetes resource (service/ingress) @ideahitme - Every record managed by External DNS is now mapped to a kubernetes resource (service/ingress) @ideahitme

View File

@ -41,7 +41,7 @@ func main() {
if err := cfg.ParseFlags(os.Args[1:]); err != nil { if err := cfg.ParseFlags(os.Args[1:]); err != nil {
log.Fatalf("flag parsing error: %v", err) log.Fatalf("flag parsing error: %v", err)
} }
log.Infof("config: %+v", cfg) log.Infof("config: %s", cfg)
if err := validation.ValidateConfig(cfg); err != nil { if err := validation.ValidateConfig(cfg); err != nil {
log.Fatalf("config validation failed: %v", err) log.Fatalf("config validation failed: %v", err)

View File

@ -17,6 +17,7 @@ limitations under the License.
package externaldns package externaldns
import ( import (
"fmt"
"strconv" "strconv"
"time" "time"
@ -24,6 +25,10 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
const (
passwordMask = "******"
)
var ( var (
// Version is the current version of the app, generated at build time // Version is the current version of the app, generated at build time
Version = "unknown" Version = "unknown"
@ -109,6 +114,19 @@ func NewConfig() *Config {
return &Config{} return &Config{}
} }
func (cfg *Config) String() string {
// prevent logging of sensitive information
temp := *cfg
if temp.DynPassword != "" {
temp.DynPassword = passwordMask
}
if temp.InfobloxWapiPassword != "" {
temp.InfobloxWapiPassword = passwordMask
}
return fmt.Sprintf("%+v", temp)
}
// allLogLevelsAsStrings returns all logrus levels as a list of strings // allLogLevelsAsStrings returns all logrus levels as a list of strings
func allLogLevelsAsStrings() []string { func allLogLevelsAsStrings() []string {
var levels []string var levels []string