Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
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
Container registry
Model registry
Operate
Environments
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
IML Open Source
iml-backup
Commits
01c17f74
Commit
01c17f74
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Plain Diff
Merge branch 'version-2' into 'master'
add ldap backup with mdb backend See merge request
!19
parents
97d6b672
11011f7c
Branches
Branches containing commit
No related tags found
1 merge request
!19
add ldap backup with mdb backend
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/localdump/ldap.sh
+16
-6
16 additions, 6 deletions
plugins/localdump/ldap.sh
with
16 additions
and
6 deletions
plugins/localdump/ldap.sh
+
16
−
6
View file @
01c17f74
...
@@ -8,8 +8,9 @@
...
@@ -8,8 +8,9 @@
# Author: daniel.schueler@iml.unibe.ch
# Author: daniel.schueler@iml.unibe.ch
# Location: /root/bin/backup_ldap.sh
# Location: /root/bin/backup_ldap.sh
#
#
# This script is called by Cron and controlled by Puppet.
# --------------------------------------------------------------------------------
# --> Do not edit manualy!
# 2021-12-13 ..... v1.0 detect config path
# 2021-12-13 ah v1.0 detect config path
# ================================================================================
# ================================================================================
...
@@ -25,7 +26,13 @@ fi
...
@@ -25,7 +26,13 @@ fi
SLAPCAT
=
'/sbin/slapcat'
SLAPCAT
=
'/sbin/slapcat'
LDAP_CONF_DIR_PATH
=
'/etc/openldap/slapd.d'
# detect config path
LDAP_CONF_DIR_PATH
=
/something/unknown
for
mydir
in
/etc/openldap/slapd.d /etc/ldap/slapd.d
do
test
-d
$mydir
&&
LDAP_CONF_DIR_PATH
=
$mydir
done
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
...
@@ -45,7 +52,7 @@ function dump_ldap(){
...
@@ -45,7 +52,7 @@ function dump_ldap(){
fetchrc
fetchrc
if
[
$rc
-ne
0
]
;
then
if
[
$rc
-ne
0
]
;
then
echo
ERROR during backup
$LDAP_CONF_DIR_PATH
echo
ERROR during backup
$LDAP_CONF_DIR_PATH
with DN
$DN
else
else
echo
Dump OK
echo
Dump OK
compress_file
$DUMPFILE
compress_file
$DUMPFILE
...
@@ -60,7 +67,8 @@ function doLdapBackup(){
...
@@ -60,7 +67,8 @@ function doLdapBackup(){
create_targetdir
create_targetdir
echo
-----
LDAP BACKUP CONFIG
echo
-----
LDAP BACKUP CONFIG
for
cfgname
in
`
ldapsearch
-H
ldap://
-x
-s
base
-b
""
-LLL
"configContext"
|
grep
"configContext"
|
cut
-f
2
-d
":"
`
# for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "configContext" | grep "configContext" | cut -f 2 -d ":"`
for
cfgname
in
`
ldapsearch
-Y
EXTERNAL
-H
ldapi:///
-s
base
-b
''
-LLL
configContext |
grep
"configContext"
|
cut
-f
2
-d
":"
`
do
do
echo
DN
$cfgname
echo
DN
$cfgname
cfg2
=
`
echo
$cfgname
|
sed
"s#[
\
=,]#_#g"
`
cfg2
=
`
echo
$cfgname
|
sed
"s#[
\
=,]#_#g"
`
...
@@ -71,7 +79,8 @@ function doLdapBackup(){
...
@@ -71,7 +79,8 @@ function doLdapBackup(){
echo
-----
LDAP DATA
echo
-----
LDAP DATA
for
cfgname
in
`
ldapsearch
-H
ldap://
-x
-s
base
-b
""
-LLL
"namingContexts"
|
grep
"namingContexts"
|
cut
-f
2
-d
":"
`
#for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"`
for
cfgname
in
`
ldapsearch
-Y
EXTERNAL
-H
ldapi:///
-s
base
-b
""
-LLL
"namingContexts"
|
grep
"namingContexts"
|
cut
-f
2
-d
":"
`
do
do
echo
DN
$cfgname
echo
DN
$cfgname
cfg2
=
`
echo
$cfgname
|
sed
"s#[
\
=,]#_#g"
`
cfg2
=
`
echo
$cfgname
|
sed
"s#[
\
=,]#_#g"
`
...
@@ -103,6 +112,7 @@ j_requireBinary "slapcat" 1
...
@@ -103,6 +112,7 @@ j_requireBinary "slapcat" 1
j_requireProcess
"slapd"
1
j_requireProcess
"slapd"
1
ls
$LDAP_CONF_DIR_PATH
>
/dev/null
if
[
$rc
-ne
0
]
;
then
if
[
$rc
-ne
0
]
;
then
rc
=
0
rc
=
0
...
...
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