Tuesday, December 22, 2009

Centos 5.3 - LDAP Setup + PhpLdapAdmin

Installing of RPMs

## install PHP , APACHE and other nessecary RPMs using yum##

yum -y install autoconf automake automake17 bzip2 bzip2-devel bzip2-libs compat-gcc-34 compat-gcc-34-c++ compat-glibc compat-glibc-headers compat-libf2c compat-libgcc compat-libstdc++-296 compat-libsdc++-33 curl curl-devel expect expect-devel gcc gcc-c++ gdbm gdbm-devel gmp gmp-devel groff httpd httpd-devel httpd-manual krb5-auth-dialog krb5-devel krb5-libs krb5-workstation libgcc libidn libidn-devel libtool libtool-ltdl libtool-ltdl-devel ntp openssh openssh-clients openssh-askpass openssh-server openssl openssl-devel pcre pcre-devel perl-libwww-perl perl-Archive-Tar perl-Digest-HMAC perl-Digest-SHA1 perl-HTML-Parser perl-Net-DNS php php-ldap php-mysql php-pear redhat-rpm-config rpm rpm-build rpm-devel rpm-libs rpm-python sed setup setuptool stunnel system-config-date wget which zlib zlib-devel ncurses-devel

## install LDAP RPMs using yum##
yum -y install nss_ldap openldap openldap-servers openldap-devel openldap-clients perl-LDAP

#### Update the system ##
yum -y update

when done, Reboot the system

Creating of LDAP Folders

## Creating a LDAP directory instead of using the default ##
mkdir /var/lib/ldap/AL

## Copy moving the DB config file ##
cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/AL/DB_CONFIG


## change the ownership to LDAP ##
chown -R ldap:ldap /var/lib/ldap/AL/


Configuration of LDAP

## Creating Root password ##
generate new LDAP root password in SSHA encryption (Without quotes)
slappasswd -s "Your Desire LDAP root password"

Results:
Example {SSHA}GSNjXV+Vlz1h989jGayZCbVKD1yrsxgf

## Edit slapd.conf using vi ##
vi slapd.conf


## additional variable to add in before database definitions - Disable annoymous login ##
disallow bind_anon

## Other changes to be made ##

edit the database to "bdb"

edit suffix to "dc=al,dc=ldap"

edit rootdn to "cn=root,dc=al,dc=ldap"

edit rootpw to the encryption password we generated earlier
rootpw {SSHA}GSNjXV+Vlz1h989jGayZCbVKD1yrsxgf

edit directory to "/var/lib/ldap/AL" to the folder we create earlier

## additional variable to add in "" - For fast searching ##
cachesize 10000

## additional variable to add in "" - Default size limt is 100 ##
sizelimit 999


save the configuration
Start openLDAP "/etc/rc.d/init.d/ldap start"


Installation of PLA
#### Install PhpLdapAdmin (PLA) ##
PLA can be downloaded from http://sourceforge.net/projects/phpldapadmin/files/


## untar the file to /var/www/html ##
tar {phpldapadmin-version}-xvf .tgz

## change the folder name to a shorter naming convention##
mv /var/www/html/phpldapadmin /var/www/html/pla

## Start Apache Server ##
/etc/rc.d/init.d/httpd start


Point your browser to the webserver -
E.g http://123.123.123.123/pla


Login to pla as root (Without Quotes)
login: cn=root,dc=al,dc=ldap
Password:
"Your Desire LDAP root password"


Using pla, we could create the respective OU groups and accounts under dc=al,dc=ldap

For more information of PLA, please refer to
http://phpldapadmin.sourceforge.net/wiki/index.php/Main_Page

Solaris 10 - Zone Config

Error Message
============
lofiadm: /dev/lofictl: No such file or directory, Solaris non-global zone

zonecfg:plateng01p> add device
zonecfg:plateng01p:device> set match=/dev/lofictl
zonecfg:plateng01p:device> end
zonecfg:plateng01p> add device
zonecfg:plateng01p:device> set match=/dev/lofi/*
zonecfg:plateng01p:device> end
zonecfg:plateng01p> add device
zonecfg:plateng01p:device> set match=/dev/rlofi/*
zonecfg:plateng01p:device> end
zonecfg:plateng01p> verify
zonecfg:plateng01p> commit
zonecfg:plateng01p> exit

Reboot the zone

Solaris 10 - SSH problem

Unable to SSH into the server due to no common Kex alg (After patching up Solaris 10)

Error Message
==========
no common kex alg: client 'diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1', server 'gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g=='


[a] generate ssh keys
# /lib/svc/method/sshd -c


[b] Allow remote root login in /etc/ssh/sshd_config ( Only for those using root access)
PermitRootLogin no -> PermitRootLogin yes

[c] enable ssh daemon
# /usr/sbin/svcadm enable ssh

Solaris 10 - Reset root password.

Use Clt+break to enter OK prompt


# mount /dev/dsk/c0t0d0s0 /a
# cd /a/etc
# TERM=vt100
# export TERM
# vi shadow(Remove root's encrypted password string)
# cd /
# umount /a
# init 6

1st Posting

Have been thinking to post up on blog post for a long time. And today will be the day that I start.

The purpose of this blog is to document all those problems I faced during my work(Linux and Solaris) . Hopefully one day it will come handy for You or me.