Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
dcc48860
Commit
dcc48860
authored
Nov 14, 2018
by
Bob Shannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting and remove enabled toggle
parent
362b3740
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
13 deletions
+8
-13
docs/sources/installation/configuration.md
+2
-5
pkg/api/http_server.go
+5
-5
pkg/setting/setting.go
+0
-2
pkg/util/auth.go
+1
-1
No files found.
docs/sources/installation/configuration.md
View file @
dcc48860
...
...
@@ -454,14 +454,11 @@ Ex `filters = sqlstore:debug`
### enabled
Enable metrics reporting. defaults true. Available via HTTP API
`/metrics`
.
### basic_auth_enabled
Enables basic authentication on the metrics endpoint. Defaults to false.
### basic_auth_username
U
sername to use for basic authentication on the metrics endpoint.
If set configures the u
sername to use for basic authentication on the metrics endpoint.
### basic_auth_password
P
assword to use for basic authentication on the metrics endpoint.
If set configures the p
assword to use for basic authentication on the metrics endpoint.
### interval_seconds
...
...
pkg/api/http_server.go
View file @
dcc48860
...
...
@@ -246,11 +246,11 @@ func (hs *HTTPServer) metricsEndpoint(ctx *macaron.Context) {
return
}
if
hs
.
Cfg
.
MetricsEndpointBasicAuth
Enabled
{
if
!
util
.
BasicAuthenticatedRequest
(
ctx
.
Req
,
hs
.
Cfg
.
MetricsEndpointBasicAuthUsername
,
hs
.
Cfg
.
MetricsEndpointBasicAuthPassword
)
{
ctx
.
Resp
.
WriteHeader
(
http
.
StatusUnauthorized
)
return
}
if
hs
.
Cfg
.
MetricsEndpointBasicAuth
Username
!=
""
&&
hs
.
Cfg
.
MetricsEndpointBasicAuthPassword
!=
""
&&
!
util
.
BasicAuthenticatedRequest
(
ctx
.
Req
,
hs
.
Cfg
.
MetricsEndpointBasicAuthUsername
,
hs
.
Cfg
.
MetricsEndpointBasicAuthPassword
)
{
ctx
.
Resp
.
WriteHeader
(
http
.
StatusUnauthorized
)
return
}
promhttp
.
HandlerFor
(
prometheus
.
DefaultGatherer
,
promhttp
.
HandlerOpts
{})
.
...
...
pkg/setting/setting.go
View file @
dcc48860
...
...
@@ -215,7 +215,6 @@ type Cfg struct {
DisableBruteForceLoginProtection
bool
TempDataLifetime
time
.
Duration
MetricsEndpointEnabled
bool
MetricsEndpointBasicAuthEnabled
bool
MetricsEndpointBasicAuthUsername
string
MetricsEndpointBasicAuthPassword
string
EnableAlphaPanels
bool
...
...
@@ -679,7 +678,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
cfg
.
PhantomDir
=
filepath
.
Join
(
HomePath
,
"tools/phantomjs"
)
cfg
.
TempDataLifetime
=
iniFile
.
Section
(
"paths"
)
.
Key
(
"temp_data_lifetime"
)
.
MustDuration
(
time
.
Second
*
3600
*
24
)
cfg
.
MetricsEndpointEnabled
=
iniFile
.
Section
(
"metrics"
)
.
Key
(
"enabled"
)
.
MustBool
(
true
)
cfg
.
MetricsEndpointBasicAuthEnabled
=
iniFile
.
Section
(
"metrics"
)
.
Key
(
"basic_auth_enabled"
)
.
MustBool
(
true
)
cfg
.
MetricsEndpointBasicAuthUsername
=
iniFile
.
Section
(
"metrics"
)
.
Key
(
"basic_auth_username"
)
.
String
()
cfg
.
MetricsEndpointBasicAuthPassword
=
iniFile
.
Section
(
"metrics"
)
.
Key
(
"basic_auth_password"
)
.
String
()
...
...
pkg/util/auth.go
View file @
dcc48860
...
...
@@ -11,7 +11,7 @@ import (
// Uses constant-time comparison in order to mitigate timing attacks.
func
BasicAuthenticatedRequest
(
req
macaron
.
Request
,
expectedUser
,
expectedPass
string
)
bool
{
user
,
pass
,
ok
:=
req
.
BasicAuth
()
if
!
ok
||
subtle
.
ConstantTimeCompare
([]
byte
(
user
),
[]
byte
(
expectedUser
))
!=
1
||
subtle
.
ConstantTimeCompare
([]
byte
(
pass
),
[]
byte
(
expectedPass
))
!=
1
{
if
!
ok
||
subtle
.
ConstantTimeCompare
([]
byte
(
user
),
[]
byte
(
expectedUser
))
!=
1
||
subtle
.
ConstantTimeCompare
([]
byte
(
pass
),
[]
byte
(
expectedPass
))
!=
1
{
return
false
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment