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
1f97df46
Commit
1f97df46
authored
Jul 03, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
devenv: open ldap docker block now prepopulating data with correct member groups
parent
1586a42a
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
158 additions
and
75 deletions
+158
-75
docker/blocks/openldap/Dockerfile
+3
-1
docker/blocks/openldap/entrypoint.sh
+4
-11
docker/blocks/openldap/notes.md
+24
-0
docker/blocks/openldap/prepopulate.sh
+14
-0
docker/blocks/openldap/prepopulate/1_units.ldif
+6
-0
docker/blocks/openldap/prepopulate/2_users.ldif
+80
-0
docker/blocks/openldap/prepopulate/3_groups.ldif
+25
-0
docker/blocks/openldap/prepopulate/groups/admins.ldif
+0
-5
docker/blocks/openldap/prepopulate/groups/backend.ldif
+0
-5
docker/blocks/openldap/prepopulate/groups/editor.ldif
+0
-5
docker/blocks/openldap/prepopulate/groups/frontend.ldif
+0
-5
docker/blocks/openldap/prepopulate/units/users.ldif
+0
-3
docker/blocks/openldap/prepopulate/users/ldap-admin.ldif
+0
-11
docker/blocks/openldap/prepopulate/users/ldap-editor.ldif
+0
-10
docker/blocks/openldap/prepopulate/users/ldap-frontend-1.ldif
+0
-10
docker/blocks/openldap/prepopulate/users/ldap-viewer.ldif
+0
-9
pkg/login/ext_user.go
+2
-0
No files found.
docker/blocks/openldap/Dockerfile
View file @
1f97df46
...
...
@@ -8,7 +8,8 @@ ENV OPENLDAP_VERSION 2.4.40
RUN
apt-get update
&&
\
DEBIAN_FRONTEND
=
noninteractive apt-get install
--no-install-recommends
-y
\
slapd
=
${
OPENLDAP_VERSION
}*
&&
\
slapd
=
${
OPENLDAP_VERSION
}*
\
ldap-utils
&&
\
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
...
...
@@ -22,6 +23,7 @@ COPY modules/ /etc/ldap.dist/modules
COPY
prepopulate/ /etc/ldap.dist/prepopulate
COPY
entrypoint.sh /entrypoint.sh
COPY
prepopulate.sh /prepopulate.sh
ENTRYPOINT
["/entrypoint.sh"]
...
...
docker/blocks/openldap/entrypoint.sh
View file @
1f97df46
...
...
@@ -76,21 +76,14 @@ EOF
IFS
=
","
;
declare
-a
modules
=(
$SLAPD_ADDITIONAL_MODULES
)
;
unset
IFS
for
module
in
"
${
modules
[@]
}
"
;
do
echo
"Adding module
${
module
}
"
slapadd
-n0
-F
/etc/ldap/slapd.d
-l
"/etc/ldap/modules/
${
module
}
.ldif"
>
/dev/null 2>&1
done
fi
for
file
in
`
ls
/etc/ldap/prepopulate/units/
*
.ldif
`
;
do
slapadd
-F
/etc/ldap/slapd.d
-l
"
$file
"
done
for
file
in
`
ls
/etc/ldap/prepopulate/groups/
*
.ldif
`
;
do
slapadd
-F
/etc/ldap/slapd.d
-l
"
$file
"
done
for
file
in
`
ls
/etc/ldap/prepopulate/users/
*
.ldif
`
;
do
slapadd
-F
/etc/ldap/slapd.d
-l
"
$file
"
done
# This needs to run in background
# Will prepopulate entries after ldap daemon has started
./prepopulate.sh &
chown
-R
openldap:openldap /etc/ldap/slapd.d/ /var/lib/ldap/ /var/run/slapd/
else
...
...
docker/blocks/openldap/notes.md
View file @
1f97df46
...
...
@@ -22,3 +22,27 @@ enabled = true
config_file
=
conf/ldap.toml
; allow_sign_up = true
```
Test groups & users
admins
ldap-admin
ldap-torkel
ldap-daniel
backend
ldap-carl
ldap-torkel
ldap-leo
frontend
ldap-torkel
ldap-tobias
ldap-daniel
editors
ldap-editors
no groups
ldap-viewer
docker/blocks/openldap/prepopulate.sh
0 → 100755
View file @
1f97df46
#!/bin/bash
echo
"Pre-populating ldap entries, first waiting for ldap to start"
sleep 3
adminUserDn
=
"cn=admin,dc=grafana,dc=org"
adminPassword
=
"grafana"
for
file
in
`
ls
/etc/ldap/prepopulate/
*
.ldif
`
;
do
ldapadd
-x
-D
$adminUserDn
-w
$adminPassword
-f
"
$file
"
done
docker/blocks/openldap/prepopulate/
units/group
s.ldif
→
docker/blocks/openldap/prepopulate/
1_unit
s.ldif
View file @
1f97df46
dn: ou=groups,dc=grafana,dc=org
ou: Groups
objectclass: top
objectclass: organizationalUnit
dn: ou=users,dc=grafana,dc=org
ou: Users
objectclass: top
objectclass: organizationalUnit
docker/blocks/openldap/prepopulate/2_users.ldif
0 → 100644
View file @
1f97df46
# ldap-admin
dn: cn=ldap-admin,ou=users,dc=grafana,dc=org
mail: ldap-admin@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-admin
cn: ldap-admin
dn: cn=ldap-editor,ou=users,dc=grafana,dc=org
mail: ldap-editor@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-editor
cn: ldap-editor
dn: cn=ldap-viewer,ou=users,dc=grafana,dc=org
mail: ldap-viewer@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-viewer
cn: ldap-viewer
dn: cn=ldap-carl,ou=users,dc=grafana,dc=org
mail: ldap-carl@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-carl
cn: ldap-carl
dn: cn=ldap-daniel,ou=users,dc=grafana,dc=org
mail: ldap-daniel@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-daniel
cn: ldap-daniel
dn: cn=ldap-leo,ou=users,dc=grafana,dc=org
mail: ldap-leo@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-leo
cn: ldap-leo
dn: cn=ldap-tobias,ou=users,dc=grafana,dc=org
mail: ldap-tobias@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-tobias
cn: ldap-tobias
dn: cn=ldap-torkel,ou=users,dc=grafana,dc=org
mail: ldap-torkel@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-torkel
cn: ldap-torkel
docker/blocks/openldap/prepopulate/3_groups.ldif
0 → 100644
View file @
1f97df46
dn: cn=admins,ou=groups,dc=grafana,dc=org
cn: admins
objectClass: groupOfNames
objectClass: top
member: cn=ldap-admin,ou=users,dc=grafana,dc=org
member: cn=ldap-torkel,ou=users,dc=grafana,dc=org
dn: cn=editors,ou=groups,dc=grafana,dc=org
cn: editors
objectClass: groupOfNames
member: cn=ldap-editor,ou=users,dc=grafana,dc=org
dn: cn=backend,ou=groups,dc=grafana,dc=org
cn: backend
objectClass: groupOfNames
member: cn=ldap-carl,ou=users,dc=grafana,dc=org
member: cn=ldap-leo,ou=users,dc=grafana,dc=org
member: cn=ldap-torkel,ou=users,dc=grafana,dc=org
dn: cn=frontend,ou=groups,dc=grafana,dc=org
cn: frontend
objectClass: groupOfNames
member: cn=ldap-torkel,ou=users,dc=grafana,dc=org
member: cn=ldap-daniel,ou=users,dc=grafana,dc=org
member: cn=ldap-leo,ou=users,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/groups/admins.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=admins,ou=groups,dc=grafana,dc=org
cn: admins
objectClass: groupOfNames
objectClass: top
member: cn=ldap-admin,ou=users,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/groups/backend.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=backend,ou=groups,dc=grafana,dc=org
cn: backend
objectClass: groupOfNames
objectClass: top
member: cn=ldap-editor,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/groups/editor.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=editors,ou=groups,dc=grafana,dc=org
cn: editors
objectClass: groupOfNames
objectClass: top
member: cn=ldap-editor,ou=users,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/groups/frontend.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=frontend,ou=groups,dc=grafana,dc=org
cn: frontend
objectClass: groupOfNames
objectClass: top
member: cn=ldap-frontend-1,ou=users,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/units/users.ldif
deleted
100644 → 0
View file @
1586a42a
dn: ou=users,dc=grafana,dc=org
objectclass: top
objectclass: organizationalUnit
docker/blocks/openldap/prepopulate/users/ldap-admin.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=ldap-admin,ou=users,dc=grafana,dc=org
mail: ldap-admin@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-admin
cn: ldap-admin
memberOf: cn=admins,ou=groups,dc=grafana,dc=org
memberOf: cn=editors,ou=groups,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/users/ldap-editor.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=ldap-editor,ou=users,dc=grafana,dc=org
mail: ldap-editor@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-editor
cn: ldap-editor
memberOf: cn=editors,ou=groups,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/users/ldap-frontend-1.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=ldap-frontend-1,ou=users,dc=grafana,dc=org
mail: ldap-frontend-1@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-frontend-1
cn: ldap-frontend-1
memberOf: cn=frontend,ou=groups,dc=grafana,dc=org
docker/blocks/openldap/prepopulate/users/ldap-viewer.ldif
deleted
100644 → 0
View file @
1586a42a
dn: cn=ldap-viewer,ou=users,dc=grafana,dc=org
mail: ldap-viewer@grafana.com
userPassword: grafana
objectClass: person
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
sn: ldap-viewer
cn: ldap-viewer
pkg/login/ext_user.go
View file @
1f97df46
...
...
@@ -21,6 +21,7 @@ func UpsertUser(cmd *m.UpsertUserCommand) error {
Email
:
extUser
.
Email
,
Login
:
extUser
.
Login
,
}
err
:=
bus
.
Dispatch
(
userQuery
)
if
err
!=
m
.
ErrUserNotFound
&&
err
!=
nil
{
return
err
...
...
@@ -90,6 +91,7 @@ func createUser(extUser *m.ExternalUserInfo) (*m.User, error) {
Name
:
extUser
.
Name
,
SkipOrgSetup
:
len
(
extUser
.
OrgRoles
)
>
0
,
}
if
err
:=
bus
.
Dispatch
(
cmd
);
err
!=
nil
{
return
nil
,
err
}
...
...
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