Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PrivateStorageio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
PrivateStorageio
Commits
3e12bb84
Commit
3e12bb84
authored
3 years ago
by
Florian Sesser
Browse files
Options
Downloads
Patches
Plain Diff
Add Google OAuth2 authentication
parent
487f1418
No related branches found
Branches containing commit
No related tags found
3 merge requests
!140
Merge staging into production
,
!122
Merge develop into staging
,
!120
Add GSuite SSO to Grafana
Pipeline
#832
passed
3 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
morph/grid/local/grid.nix
+2
-0
2 additions, 0 deletions
morph/grid/local/grid.nix
nixos/modules/monitoring/server/grafana.nix
+25
-5
25 additions, 5 deletions
nixos/modules/monitoring/server/grafana.nix
with
27 additions
and
5 deletions
morph/grid/local/grid.nix
+
2
−
0
View file @
3e12bb84
...
...
@@ -55,6 +55,8 @@ let
stateVersion
=
"19.09"
;
})
];
# Allow anonymous access to Grafana in local development environment:
services
.
private-storage
.
monitoring
.
grafana
.
googleOAuthClientID
=
""
;
};
# TBD: derive these automatically:
...
...
This diff is collapsed.
Click to expand it.
nixos/modules/monitoring/server/grafana.nix
+
25
−
5
View file @
3e12bb84
...
...
@@ -7,6 +7,14 @@
let
cfg
=
config
.
services
.
private-storage
.
monitoring
.
grafana
;
grafanaAuth
=
if
(
cfg
.
googleOAuthClientID
==
""
)
then
{
anonymous
.
enable
=
true
;
}
else
{
# Google OAuth2 SSO:
google
.
enable
=
true
;
google
.
clientSecretFile
=
cfg
.
googleOAuthClientID
;
google
.
clientId
=
cfg
.
googleOAuthClientSecretFile
;
};
in
{
options
.
services
.
private-storage
.
monitoring
.
grafana
=
{
...
...
@@ -27,6 +35,18 @@ in {
default
=
"http://localhost:3100/"
;
description
=
"The URL of the Loki host to access"
;
};
googleOAuthClientID
=
lib
.
mkOption
{
type
=
lib
.
types
.
str
;
example
=
lib
.
literalExample
"grafana-staging-345678"
;
default
=
"replace-by-your-client-id-or-set-empty-string-for-anonymous-access"
;
description
=
"The GSuite OAuth2 SSO Client ID. Empty string turns SSO auth off and anonymous (free for all) access on."
;
};
googleOAuthClientSecretFile
=
lib
.
mkOption
{
type
=
lib
.
types
.
path
;
example
=
lib
.
literalExample
"
\$
{privKeyPath}/grafana-gsuite-client-secret"
;
default
=
null
;
description
=
"The path to the GSuite SSO secret file."
;
};
};
config
=
{
...
...
@@ -38,13 +58,13 @@ in {
domain
=
cfg
.
domain
;
port
=
2342
;
addr
=
"127.0.0.1"
;
# All three are required to forego the user/pass prompt:
auth
.
anonymous
.
enable
=
true
;
auth
.
anonymous
.
org_role
=
"Admin"
;
auth
.
anonymous
.
org_name
=
"Main Org."
;
};
services
.
grafana
.
auth
=
{
anonymous
.
org_role
=
"Admin"
;
anonymous
.
org_name
=
"Main Org."
;
}
//
grafanaAuth
;
services
.
grafana
.
provision
=
{
enable
=
true
;
# See https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment