Friday, 1 April 2011

ldap Configuration

check the below packages are available:

[root@usha ~]# rpm -qa | grep openldap-servers
openldap-servers-2.3.27-5

compat-openldap.i386 0:2.1.30-6.4E
openldap-clients.i386 0:2.2.13-6.4E
openldap-devel.i386 0:2.2.13-6.4E
openldap-servers.i386 0:2.2.13-6.4E
openldap-servers-sql.i386 0:2.2.13-6.4E




if packages not available install from cd

yum install *openldap* -y

on the ldap service
[root@usha ~]# chkconfig --levels 235 ldap on

update the database
[root@usha ~]# updatedb

[root@usha ~]# slappasswd
New password:
Re-enter new password:
{SSHA}fF9NKkPUrf9m9gxBMmLeUwY/bnqVgK3v

[root@usha ~]# vi /etc/openldap/slapd.conf



database    bdb
suffix        "dc=sam,dc=com"
rootdn        "cn=admin1,dc=sam,dc=com"
rootpw        {SSHA}fF9NKkPUrf9m9gxBMmLeUwY/bnqVgK3v


edit these lines in the above file

                            cn as ur connection name dc as ur domain name (if more than one ldap server in the network the domain should not be same) rootpw next to the w give two  [tab] then paste the slappasswd here



create the rhome folder in filesystem



     create an user test path as /rhome/


Migrate local user to LDAP (We assume that users test exit in our system)

[root@usha ~]# grep root /etc/passwd > /etc/openldap/passwd.root
[root@usha ~]# grep test /etc/passwd > /etc/openldap/passwd.test



Update default settings on file

[root@usha ~]# vi /usr/share/openldap/migration/migrate_common.ph




 [root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.root  /etc/openldap/root.ldif
[root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.test  /etc/openldap/test.ldif



Update root.ldif file for the "admin" of LDAP Server

[root@usha ~]# vi /etc/openldap/root.ldif

 dn: uid=root,ou=People, dc=sam,dc=com
uid: root
cn: admin
objectClass: account

Create a domain ldif file

[root@usha ~]# cat > /etc/openldap/sam.com.ldif
dn:dc=sam,dc=com
dc: sam
description: LDAP Admin
objectClass: dcObject
objectClass: organizationalUnit
ou: rootobject

dn: ou=People, dc=sam,dc=com
ou: People
description: Users of sam
objectClass: organizationalUnit




Import all users in to the LDAP



[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
adding new entry "dc=sam,dc=com"

adding new entry "ou=People, dc=sam,dc=com"


[root@usha openldap]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dapuser.ldif
Enter LDAP Password:
adding new entry "uid=dapuser,ou=People,dc=sam,dc=com"

[root@usha openldap]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/root.ldif
Enter LDAP Password:
adding new entry "uid=root,ou=People,dc=sam,dc=com"

adding new entry "uid=operator,ou=People,dc=sam,dc=com"


restart the ldap service

[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                                    [  OK  ]
Starting slapd:                                             [  OK  ]





TEST LDAP SERVER 


ldapsearch -x -b 'dc=sam,dc=com' '(objectclass=*)'



TEST LDAP SERVER  FROM THE CLIENT


Client Configuration


[root@usha ~]# authconfig-tui





Select Use LDAP

Server: ldap.sam.com
Base DN: dc=sam,dc=com



edit     /etc/auto.master   and   this   entry

/rhome    /etc /auto.rhome



Create the file /etc/auto.rhome  if it is not created previously and make this entry

*    -rw,soft,intr            192.168.1.254:/rhome/&
The ip number of server is considered as 192.168.1.254


/etc/init.d/autofs restart




References
[root@usha ~]# ifconfig eth0 192.168.20.39
[root@usha ~]# ifup eth0
[root@usha ~]# ping 192.168.20.1
PING 192.168.20.1 (192.168.20.1) 56(84) bytes of data.
64 bytes from 192.168.20.1: icmp_seq=1 ttl=64 time=0.341 ms
64 bytes from 192.168.20.1: icmp_seq=2 ttl=64 time=0.170 ms

[1]+  Stopped                 ping 192.168.20.1
[root@usha ~]# rpm -qa | grep openldap-servers
openldap-servers-2.3.27-5
[root@usha ~]# chkconfig --levels 235 ldap 0n
chkconfig version 1.3.30.1 - Copyright (C) 1997-2000 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage:   chkconfig --list [name]
         chkconfig --add <name>
         chkconfig --del <name>
         chkconfig [--level <levels>] <name> <on|off|reset|resetpriorities>
[root@usha ~]# chkconfig --levels 235 ldap on
[root@usha ~]# service ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]#
[root@usha ~]#
[root@usha ~]# ssword:
[root@usha ~]# qgDD3Y7lRRkQhslhAd+D1Bi
[root@usha ~]# gedit /etc/openldap/slapd.conf
[root@usha ~]# gedit /etc/openldap/slapd.conf
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]# gedit /etc/openldap/slapd.conf
[root@usha ~]# gedit /etc/openldap/slapd.conf
[root@usha ~]# grep root /etc/passwd > /etc/openldap/passwd.root
[root@usha ~]# grep dapuser /etc/passwd > /etc/openldap/passwd.dapuser
[root@usha ~]# vi /usr/share/openldap/migration/migrat_common.ph
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]# vi /usr/share/openldap/migration/migrate_common.ph
[root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.root  /etc/op
openldap/                 openmpi-default-hostfile  openmpi-mca-params.conf   openmpi-totalview.tcl     opt/                     
[root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.root  /etc/openldap/root/ldif
[root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.dapuser  /etc/openldap/dapuser/ldif
[root@usha ~]# vi /etc/openldap/root.ldif'
>
.adobe/                Desktop/               .gconfd/               install.log.syslog     .mysql_history         .tcshrc
anaconda-ks.cfg        .dmrc                  .gimp-2.2/             .kde/                  .nautilus/             .thumbnails/
.bash_history          .eggcups/              .gnome/                .lesshst               .qt/                   .Trash/
.bash_logout           .esd_auth              .gnome2/               .local/                .recently-used         .tsclient/
.bash_profile          ex.pl                  .gnome2_private/       .macromedia/           .recently-used.xbel    .viminfo
.bashrc                ex.pl~                 .gstreamer-0.10/       .mcop/                 .redhat/               .vnc/
.config/               .ex.pl.swp             .gtkrc-1.2-gnome2      .mcoprc                .sane/                 .Xauthority
.cshrc                 Firefox_wallpaper.png  .ICEauthority          .metacity/             .serverauth.3646       .xsession-errors
.dbus/                 .gconf/                install.log            .mozilla/              .ssh/                 
>
[root@usha ~]# vi /etc/openldap/root.ldif
[root@usha ~]# cat vi /etc/openldap/sam.com.ldif
cat: vi: No such file or directory
cat: /etc/openldap/sam.com.ldif: No such file or directory
[root@usha ~]# cat  /etc/openldap/sam.com.ldif
cat: /etc/openldap/sam.com.ldif: No such file or directory
[root@usha ~]# cat /etc/openldap/sam.com.ldif
cat: /etc/openldap/sam.com.ldif: No such file or directory
[root@usha ~]# cat /etc/openldap/sam.com.ldif
cat: /etc/openldap/sam.com.ldif: No such file or directory
[root@usha ~]# cat > /etc/openldap/sam.com.ldif
dn:dc=sam,dc=com
dc: sam
description: LDAP Admin

[root@usha ~]# vi /etc/openldap/sam.com.ldif
[root@usha ~]# vi /etc/openldap/sam.com.ldif
[root@usha ~]# ldapadd -x -D "cn=admin1".dc=sam,dc=com" -W -f /etc/openlad/sam.com.ldif
>
[root@usha ~]# ldapadd -x -D "cn=admin1",dc=sam,dc=com" -W -f /etc/openlad/sam.com.ldif
>
[root@usha ~]# ldapadd -x -D "cn=admin1",dc=sam,dc=com" -W -f /etc/openlad/sam.com.ldif
> slapd -d 256 -f /etc/openldap/slapd.conf
>
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Server is unwilling to perform (53)
        additional info: unauthenticated bind (DN with no password) disallowed
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=sam,dc=com.
config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# rm -f /var/lib/ldap/*
[root@usha ~]# updatedb
[root@usha ~]# locate DB_CONFIG.example
/etc/openldap/DB_CONFIG.example
[root@usha ~]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# slappasswd
New password:
Re-enter new password:
{SSHA}fF9NKkPUrf9m9gxBMmLeUwY/bnqVgK3v
[root@usha ~]# vi /etc/openldap/slapd.conf
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/sam.com.ldif
Enter LDAP Password:
adding new entry "dc=sam,dc=com"

adding new entry "ou=People, dc=sam,dc=com"

[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/root.ldif
Enter LDAP Password:
adding new entry "uid=root,ou=people, dc=sam,dc=com"
ldap_add: Object class violation (65)
        additional info: attribute 'cn' not allowed

[root@usha ~]# vi /etc/openldap/sam.com.ldif
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dap.ldif
/etc/openldap/dap.ldif: No such file or directory
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dapuser.ldif
/etc/openldap/dapuser.ldif: No such file or directory
[root@usha ~]# vi /etc/openldap/root.ldif
[root@usha ~]# cd /etc/openldap/
[root@usha openldap]# ls
cacerts  DB_CONFIG.example  ldap.conf  passwd.dapuser  passwd.root  root.ldif  sam.com.ldif  schema  slapd.conf  slapd.conf~
[root@usha openldap]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.root  /etc/openldap/root.ldif
[root@usha openldap]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.dapuser  /etc/openldap/dapuser.ldif
[root@usha openldap]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha openldap]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dapuser.ldif
Enter LDAP Password:
adding new entry "uid=dapuser,ou=People,dc=sam,dc=com"

[root@usha openldap]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/root.ldif
Enter LDAP Password:
adding new entry "uid=root,ou=People,dc=sam,dc=com"

adding new entry "uid=operator,ou=People,dc=sam,dc=com"

[root@usha openldap]#
Display all 3984 possibilities? (y or n)
[root@usha openldap]# cd
[root@usha ~]# vi /etc/exports
[root@usha ~]# iptables -F
[root@usha ~]# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
[root@usha ~]# service portmap start
Starting portmap:                                          [  OK  ]
[root@usha ~]# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@usha ~]#
[root@usha ~]# grep dapuser1 /etc/passwd > /etc/openldap/passwd.dapuser1
[root@usha ~]# chown dapuser:dapuser /rhome/dapuser
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# service portmap start
Starting portmap:                                          [  OK  ]
[root@usha ~]# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# iptables -F
[root@usha ~]# /usr/share/openldap/migration/migrate_passwd.pl  /etc/openldap/passwd.dapuser1  /etc/openldap/dapuser1.ldif
[root@usha ~]# ladpadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dapuser1.ldif
bash: ladpadd: command not found
[root@usha ~]# ldapadd -x -D "cn=admin1,dc=sam,dc=com" -W -f /etc/openldap/dapuser1.ldif
Enter LDAP Password:
adding new entry "uid=dapuser1,ou=People,dc=sam,dc=com"

[root@usha ~]# cd /etc/openldap/
[root@usha openldap]# ls
cacerts        dapuser.ldif       ldap.conf       passwd.dapuser1  root.ldif     schema      slapd.conf~
dapuser1.ldif  DB_CONFIG.example  passwd.dapuser  passwd.root      sam.com.ldif  slapd.conf
[root@usha openldap]# cd
[root@usha ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@usha ~]# ls
anaconda-ks.cfg  Desktop  ex.pl  ex.pl~  Firefox_wallpaper.png  install.log  install.log.syslog
[root@usha ~]# name
bash: name: command not found
[root@usha ~]# man domain

[2]+  Stopped                 man domain
[root@usha ~]# name kokila
bash: name: command not found
[root@usha ~]# man domain

[3]+  Stopped                 man domain
[root@usha ~]# domain jdfgj
bash: domain: command not found
[root@usha ~]# vi /etc/exports
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]#
[root@usha ~]# ifconfig eth0 192.168.20.39
[root@usha ~]# ifup eth0
[root@usha ~]# service vncserver restart
Shutting down VNC server: 2:root                           [FAILED]
Starting VNC server: 2:root xauth: (stdin):1:  bad display name "usha.com:2" in "add" command

New 'usha.com:2 (root)' desktop is usha.com:2

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/usha.com:2.log

                                                           [  OK  ]
[root@usha ~]# mount -t nfs 192.168.20.1:/rhome /home
mount: 192.168.20.1:/rhome failed, reason given by server: Permission denied
[root@usha ~]# mount -t nfs 192.168.20.1:/rhome /home
mount: 192.168.20.1:/rhome failed, reason given by server: Permission denied
[root@usha ~]# mount -t nfs 192.168.20.1:/rhome /mnt
mount: 192.168.20.1:/rhome failed, reason given by server: Permission denied
[root@usha ~]# rpcinfo -p 192.168.20.1
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100011    1   udp    813  rquotad
    100011    2   udp    813  rquotad
    100011    1   tcp    816  rquotad
    100011    2   tcp    816  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   udp  32862  nlockmgr
    100021    3   udp  32862  nlockmgr
    100021    4   udp  32862  nlockmgr
    100021    1   tcp  34738  nlockmgr
    100021    3   tcp  34738  nlockmgr
    100021    4   tcp  34738  nlockmgr
    100005    1   udp    829  mountd
    100005    1   tcp    832  mountd
    100005    2   udp    829  mountd
    100005    2   tcp    832  mountd
    100005    3   udp    829  mountd
    100005    3   tcp    832  mountd
[root@usha ~]# service nfslock stop
Stopping NFS locking:                                      [  OK  ]
Stopping NFS statd:                                        [  OK  ]
[root@usha ~]# service portmap restart
Stopping portmap:                                          [  OK  ]
Starting portmap:                                          [  OK  ]
 












































































































No comments:

Post a Comment