Chore: Add WARN log if grafana server process is running with elevated privileges (#35205)
* warn on linux * add warning for grpc plugins * add windows support * update go.mod * reorganize imports * update naming * remove Windows logic * simplify and add check for when UID and EUID don't match * fix build * tidy go.mod * feedback * cleanup + migrate
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/extensions"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/infra/process"
|
||||
"github.com/grafana/grafana/pkg/server"
|
||||
_ "github.com/grafana/grafana/pkg/services/alerting/conditions"
|
||||
_ "github.com/grafana/grafana/pkg/services/alerting/notifiers"
|
||||
@@ -151,6 +152,14 @@ func executeServer(configFile, homePath, pidFile, packaging string, traceDiagnos
|
||||
|
||||
metrics.SetBuildInformation(opt.Version, opt.Commit, opt.BuildBranch)
|
||||
|
||||
elevated, err := process.IsRunningWithElevatedPrivileges()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error checking server process execution privilege. error: %s\n", err.Error())
|
||||
}
|
||||
if elevated {
|
||||
fmt.Println("Grafana server is running with elevated privileges. This is not recommended")
|
||||
}
|
||||
|
||||
s, err := server.Initialize(setting.CommandLineArgs{
|
||||
Config: configFile, HomePath: homePath, Args: flag.Args(),
|
||||
}, server.Options{
|
||||
|
||||
Reference in New Issue
Block a user