diff --git a/cmd/dockerregistry/main.go b/cmd/dockerregistry/main.go index 03ec792caaf8..f14f0858264f 100644 --- a/cmd/dockerregistry/main.go +++ b/cmd/dockerregistry/main.go @@ -3,10 +3,12 @@ package main import ( "flag" "fmt" + "math/rand" "net/http" _ "net/http/pprof" "os" "runtime" + "time" log "github.com/Sirupsen/logrus" "k8s.io/kubernetes/pkg/util/logs" @@ -28,6 +30,7 @@ func main() { defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() startProfiler() + rand.Seed(time.Now().UTC().UnixNano()) runtime.GOMAXPROCS(runtime.NumCPU()) flag.Parse() diff --git a/cmd/gitserver/gitserver.go b/cmd/gitserver/gitserver.go index 7384a75f1d87..13b59b7f38e2 100644 --- a/cmd/gitserver/gitserver.go +++ b/cmd/gitserver/gitserver.go @@ -1,9 +1,11 @@ package main import ( + "math/rand" "os" "path/filepath" "runtime" + "time" "k8s.io/kubernetes/pkg/util/logs" @@ -22,6 +24,7 @@ func main() { defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() + rand.Seed(time.Now().UTC().UnixNano()) if len(os.Getenv("GOMAXPROCS")) == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } diff --git a/cmd/oc/oc.go b/cmd/oc/oc.go index 42301c167dc1..07f0ca6e53a8 100644 --- a/cmd/oc/oc.go +++ b/cmd/oc/oc.go @@ -1,9 +1,11 @@ package main import ( + "math/rand" "os" "path/filepath" "runtime" + "time" "k8s.io/kubernetes/pkg/util/logs" @@ -24,6 +26,7 @@ func main() { defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() + rand.Seed(time.Now().UTC().UnixNano()) if len(os.Getenv("GOMAXPROCS")) == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } diff --git a/cmd/openshift/openshift.go b/cmd/openshift/openshift.go index ec8b4de7cddf..9766075ef230 100644 --- a/cmd/openshift/openshift.go +++ b/cmd/openshift/openshift.go @@ -1,9 +1,11 @@ package main import ( + "math/rand" "os" "path/filepath" "runtime" + "time" "k8s.io/kubernetes/pkg/util/logs" @@ -24,6 +26,7 @@ func main() { defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() + rand.Seed(time.Now().UTC().UnixNano()) if len(os.Getenv("GOMAXPROCS")) == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } diff --git a/pkg/cmd/admin/router/router.go b/pkg/cmd/admin/router/router.go index 8faa76ff60b6..2d6baa8dfcbc 100644 --- a/pkg/cmd/admin/router/router.go +++ b/pkg/cmd/admin/router/router.go @@ -8,6 +8,7 @@ import ( "path" "strconv" "strings" + "time" "github.com/golang/glog" "github.com/spf13/cobra" @@ -846,6 +847,7 @@ func generateRoleBindingName(name string) string { // generateStatsPassword creates a random password. func generateStatsPassword() string { + rand := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) allowableChars := []rune("abcdefghijlkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") allowableCharLength := len(allowableChars) password := []string{} diff --git a/pkg/cmd/server/crypto/crypto.go b/pkg/cmd/server/crypto/crypto.go index 59e359549d3b..f0aa5cb4ae78 100644 --- a/pkg/cmd/server/crypto/crypto.go +++ b/pkg/cmd/server/crypto/crypto.go @@ -256,7 +256,8 @@ type RandomSerialGenerator struct { } func (s *RandomSerialGenerator) Next(template *x509.Certificate) (int64, error) { - return mathrand.Int63(), nil + r := mathrand.New(mathrand.NewSource(time.Now().UTC().UnixNano())) + return r.Int63(), nil } // EnsureCA returns a CA, whether it was created (as opposed to pre-existing), and any error diff --git a/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go b/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go index e1e013027171..ea18ff4b8e22 100644 --- a/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go +++ b/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go @@ -7,10 +7,12 @@ import ( "encoding/json" "fmt" "io/ioutil" + "math/rand" "net" "net/http" "os" "strings" + "time" "github.com/openshift/origin/pkg/sdn/plugin/cniserver" @@ -111,6 +113,7 @@ func (p *cniPlugin) CmdDel(args *skel.CmdArgs) error { } func main() { + rand.Seed(time.Now().UTC().UnixNano()) p := NewCNIPlugin(cniserver.CNIServerSocketPath) skel.PluginMain(p.skelCmdAdd, p.CmdDel, version.Legacy) }