wiki.getshifting.com

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


start

SHIFT-WIKI - Sjoerd Hooft's InFormation Technology

This WIKI is my personal documentation blog. Please enjoy it and feel free to reach out through blue sky if you have a question, remark, improvement or observation. See below for the latest additions, or use the search or tags to browse for content.


Terraform - How to get started

Summary: In this post I'll show you how to prepare your Windows desktop to work with terraform for both Azure and AWS. I will also explain the most common terraform commands and terminology and show you how to apply these.
Date: Around 2019
Refactor: 11 January 2025: Checked links, formatting and split up some content to different files.
Refactor: 24 February 2025: Added another terraform import example

→ Read more...

2025/06/01 11:59

Script: Bash: TDS LDAP Restore

Summary: How to restore data into Tivoli Directory Server.
Date: Around 2010
Refactor: 29 April 2025: Checked links and formatting.

Below you'll find a script I've used to restore LDAP data which was backup with this script: Script: Bash: TDS LDAP Backup.

#!/bin/bash
#set -x
 
### Export HOME and APP Settings
export LDAP_INSTANCE=idsfop
export LDAP_HOME=/opt/IBM/ldap/V6.0
export LDAPSEARCH="${LDAP_HOME}/bin/ldapsearch"
export APPDIR=$LDAP_HOME
 
### Read LDAP Restore Instance Settings
LDAPUSER1="cn=Directory Manager"
LDAPBASE1="o=organization.nl"
 
echo
echo "Please provide Directory Admin DN [$LDAPUSER1]:"
read LDAPUSER
echo
echo "Directory Admin password:"
read LDAPPASS
echo
echo "Please provide application base DN [$LDAPBASE1]:"
read LDAPBASE
echo
echo "Please provide password of db2 user account (UNIX):"
read DB2PASS
 
### If LDAPUSER is empty then use default setting
if [ -z "$LDAPUSER" ]; then
   LDAPUSER="$LDAPUSER1"
   echo "LDAP user being used = $LDAPUSER1"
fi
 
### If LDAPBASE is empty then use default setting
if [ -z "$LDAPBASE" ]; then
   LDAPBASE="$LDAPBASE1"
   echo "LDAP base being used = $LDAPBASE1"
fi
 
### Get live DB2 Settings
getConfigValueFromLdap() {
   $LDAPSEARCH -D "$LDAPUSER" -w $LDAPPASS -h localhost -s base -b "cn=Directory,cn=RDBM Backends,cn=IBM Directory,cn=Schemas,cn=Configuration" '(objectclass=*)' $1 | grep $1 | awk -F= '{ print $2 }'
}
 
echo
DB2USER=`getConfigValueFromLdap ibm-slapdDbUserID`
echo "DB2 User being used = $DB2USER"
DB2INSTANCE=`getConfigValueFromLdap ibm-slapdDbInstance`
echo "DB2 Instance being used = $DB2INSTANCE"
LDAPDB=`getConfigValueFromLdap ibm-slapdDbName`
echo "LDAP DB being used = $LDAPDB"
DBLOCATION=`getConfigValueFromLdap ibm-slapdDbLocation`
echo "DB Location = $DBLOCATION"
 
### Check for empty variables
if [ -z "$DB2USER" -o -z "$DB2INSTANCE" -o -z "$LDAPDB" -o -z "$DBLOCATION" ]; then
   echo
   echo "`tput bold``tput smul`ERROR - Could not retreive configuration setting from LDAP, ABORTING!`tput sgr0`"
   echo
   echo "Possible causes: "
   echo " - incorrect credentials (Directory Admin)"
   echo " - incorrect application DN provided"
   echo " - Directory server not running or reachable"
   echo
   exit 1
fi
 
restoreLdap() {
   echo "INFO - Stopping LDAP"
   echo ${APPDIR}/sbin/idsslapd -I $LDAP_INSTANCE -k
 
   echo "INFO -Removing suffix $LDAPBASE"
   echo ${APPDIR}/sbin/idsucfgsuf -I $LDAP_INSTANCE -n -s $LDAPBASE
 
   echo "INFO - Dropping instance  $LDAP_INSTANCE"
   echo ${APPDIR}/sbin/idsucfgdb -I $LDAP_INSTANCE -n -r
 
   echo "INFO - Creating instance  $LDAP_INSTANCE"
   echo ${APPDIR}/sbin/idscfgdb -I $LDAP_INSTANCE -n -a $DB2USER -l $DBLOCATION -t $LDAPDB -w $DB2PASS
 
   echo "INFO -Adding suffix $LDAPBASE"
   echo ${APPDIR}/sbin/idscfgsuf -I $LDAP_INSTANCE -n -s $LDAPBASE
 
   echo "INFO - Importing LDAP data..."
   echo ${APPDIR}/sbin/bulkload -I $LDAP_INSTANCE -i $LDIFFILE -a parse_and_load
 
   echo "INFO - Starting LDAP"
   echo ${APPDIR}/sbin/idsslapd -I $LDAP_INSTANCE
}
 
usageCommand() {
   echo
   echo "Usage $0 COMMAND:"
   echo "--------------------------------------"
   echo "`tput bold``tput smul`$0 restore "restorefile"`tput sgr0`"
   echo "--------------------------------------"
   echo
}
 
case "$1" in
 
restore )
   if [ ! -z "$2" ]; then
      if [ -f "$2" ]; then
         LDIFFILE=$2
         echo "LDAP file being used = $LDIFFILE"
         restoreLdap
      else
         echo
         echo "The restorefile provided does not exist"
         echo "Please provide the full path to the restore file"
         echo
         usageCommand
         exit 1
      fi
   else
      echo
      echo "Please provide the full path to the restore file"
      echo
      usageCommand
      exit 1
   fi
;;
 
* )
   usageCommand
   exit 1
;;
 
esac
 
echo
echo "INFO - LDAP restore finished"
echo
2025/06/01 11:59

Script: Bash: TDS LDAP Backup

Summary: How to backup Tivoli Directory Server with a bash script.
Date: Around 2010
Refactor: 29 April 2025: Checked links and formatting.

Below you'll find a script I've used to backup TDS LDAP data which can be restored using this script into openDS or into Tivoli Directory Server with this script.

#!/bin/bash
# set -x
 
### Script Variables
WHATAMI=`basename $0`
 
### LDAP Variables
DUMPDIR=/var/backup/ldif
APPDIR=/opt/IBM/ldap/V6.0
LDAPSEARCH=/opt/IBM/ldap/V6.0/bin/ldapsearch
MANAGER=cn=manager
PASSWD=<password>
HOSTNAME=`hostname`
LDAPBASE="o=company.local"
LDAPPORT=389
 
### OLD LDAP Variables
#INSTANCE=idsldap
 
### Offsitecopy Variables
GZIP=/usr/bin/gzip
. "/opt/ITS_Tools/Scripts/mail.txt"
. "/opt/ITS_Tools/Scripts/offsitecopy.func"
TOUSER="repluser"
TOHOST="replicationserver.company.local"
TODIR="/srv/syncdata/LDAP"
LDIFFILE=${DUMPDIR}/${HOSTNAME}_${LDAPBASE}_`date +%Y%m%d%H%M`.ldif
BACKUPFILE="$LDIFFILE.gz"
LOGFILE=${DUMPDIR}/logfile_`date +%Y%m%d%H%M`.txt
DOCOPY="0"
 
usageCommand() {
   echo
   echo "Usage $0 COMMAND:"
   echo "--------------------------------------"
   echo "`tput bold``tput smul`$0 ldifbackup`tput sgr0`"
   echo "--------------------------------------"
   echo
}
 
ldifBackup() {
   echo "Creating ldif backup $LDIFFILE .. using $MANAGER"
   $LDAPSEARCH -L -D "$MANAGER" -w "$PASSWD" -h "$HOSTNAME" -p "$LDAPPORT" -b "$LDAPBASE" '(objectclass=*)' > $LDIFFILE
   $GZIP $LDIFFILE
   if [ -f $BACKUPFILE ]; then
      echo "Finished dump, output in $BACKUPFILE"
      if [ "$DOCOPY" == "1" ]; then
         offsitecopy "${BACKUPFILE}" "$TOUSER" "$TOHOST" "$TODIR" "$LOGFILE" "$WHATAMI" "$HOSTNAME" "$MAILTOSUCCESS" "$MAILTOFAIL"
      else
         echo
         echo "Copy to offsite location is not enabled."
         echo "Modify the script under Offsitecopy Variables to enable offsitecopy"
         echo
      fi
   else
      echo
      echo "$BACKUPFILE was not created."
      echo Exiting...
      echo
      exit 1
   fi
}
 
case "$1" in
 
ldifbackup )
   echo "Checking if the LDAP server is running... "
   pid=`ps -ef|grep ibmslapd|grep -v grep|awk '{ print $2 }'`
   if [ -z "$pid" ]; then
      echo
      echo "Ldap server is stopped..."
      echo "Exiting... "
      exit 1
   else
      echo "Ldap server is running..."
      ldifBackup
   fi
;;
 
* )
   usageCommand
   exit 1
;;
 
esac
 
echo
echo "INFO - LDIF backup finished"
echo

As you can see, there is an external reference to offsitecopy and mail.txt. Both are described in Bash: Function: Offsitecopy.

2025/06/01 11:59

Tivoli Directory Server Installation AIX

Summary: How to install and configure Tivoli Directory Server in AIX.
Date: 17 September 2010
Refactor: 29 April 2025: Checked links and formatting.

→ Read more...

2025/06/01 11:59

<< Newer entries | Older entries >>

This wiki has been made possible by:

start.txt · Last modified: by sjoerd