LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2012, 10:21 AM   #1
amadu84
LQ Newbie
 
Registered: Oct 2012
Posts: 2

Rep: Reputation: Disabled
Configuration ldap-asterisk


Hello everybody i have some error when try to add a user in my LDAP who will ues asterisk
this is my ldif file :
#OU asterisk
###
dn: ou=asterisk,dc=asterisk,dc=local
objectClass: top
objectClass: organizationalUnit
ou: asterisk
###
# OU users
###
dn: ou=users,ou=asterisk,dc=asterisk,dc=local
objectClass: top
objectClass: organizationalUnit
ou: users
###
# OU extensions
###
dn: ou=extensions,ou=asterisk,dc=asterisk,dc=local
objectClass: top
objectClass: organizationalUnit
ou: extensions

this is my slapd.conf

# more /etc/ldap/slapd.conf

# Les schémas à inclure à l'annuaire
include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/asterisk.schema

# le fichier contenant le PID du processus
pidfile /var/run/slapd/slapd.pid
# Le fichier contenant les arguments
argsfile /var/run/slapd/slapd.args
# La facilité utilisée avec syslog
loglevel none

# Emplacement des modules
modulepath /usr/lib/ldap

# Chargment de modules permettant d'étendre les fonctionnalités de OpenLDAP
moduleload back_hdb

# Limites concernant les recherches
sizelimit 500
tool-threads 1

##################################
# Définition du premier annuaire #
##################################
# On utilise un stockage basé sur le format de fichier HDB
backend hdb
database hdb

# On définit la racine de l'arbre (on parle de suffixe ou de basedn)
suffix "dc=asterisk,dc=local"

# Répertoire stockant les données de l'annuaire, dans notre cas, des fichiers au format HDB
directory "/var/lib/ldap"

# L'administrateur de l'annuaire
rootdn "cn=admin,dc=asterisk,dc=local"
rootpw passer
#{SSHA}5PVllmX/nRxWiE0SEtSHfYFdbbCmYYDz # en clair ou généré via la commande slappasswd

# Des paramêtres d'optimisation du format HDB
dbconfig set_cachesize 0 2097152 0
dbconfig set_lk_max_objects 1500
dbconfig set_lk_max_locks 1500
dbconfig set_lk_max_lockers 1500

# Les attributs à indexer en vue d'améliorer drastiquement les recherches
index objectClass eq

# à commenter ...
lastmod on
checkpoint 512 30

# contrôle d'accès aux attributs sensibles
access to attrs=userPassword,shadowLastChange
by dn="cn=admin,dc=asterisk,dc=local" write
by anonymous auth
by self write
by * none

# Annuaire avec accès anonyme en lecture seule
access to dn.base=""
by * read
access to *
by dn="cn=admin,dc=asterisk,dc=local" write
by * read

AND i have create a script to add the user his name is "adduser.sh"
#!/bin/sh

#######################
# Ajout user LDAP + Asterisk #
# #
# ced-info.com 10/08/2010 #
#######################

#Ajout de l'user dans Asterisk
#création du fichier temp pour le ldif
mkdir -p ~/tmp
touch ~/tmp/user.ldif
ldif=~/tmp/user.ldif

#Ajout de l'user
echo "Entrez le nom du nouvel utilisateur :"
read user

echo "Quel numéro voulez vous attribuer pour $user ?"
read num

echo "Mot de passe Asterisk pour $user :"
#on désactive l'affichage pour ne pas voir le mot de passe
stty -echo
read pass

#on réactive l'affichage
stty echo
echo ""

#on crypte le mot de passe en md5
md5pwd=`echo -n "$user:asterisk.local:$pass" | md5sum | cut -c1-32`

#On génère le ldif pour le user
echo "dn:uid=$user,ou=users,ou=asterisk,dc=asterisk,dc=local">>$ldif
echo "objectClass: top">>$ldif
echo "objectClass: inetOrgPerson">>$ldif
echo "objectClass: AsteriskSIPUser">>$ldif
echo "cn: $user">>$ldif
echo "sn: $user">>$ldif
echo "uid: $user">>$ldif
echo "AstAccountContext: internal">>$ldif
echo "AstAccountCallerID: $user <$num>">>$ldif
echo "AstAccountRealmedPassword: $md5pwd">>$ldif
echo "AstAccountQualify: yes">>$ldif
echo "AstAccountNAT: yes">>$ldif
echo "AstAccountType: friend">>$ldif
echo "AstAccountHost: dynamic">>$ldif
echo "AstAccountMailbox: $num@default">>$ldif
echo "AstAccountCanReinvite: yes">>$ldif
echo "AstAccountAllowedCodec: alaw">>$ldif
echo "AstAccountLastQualifyMilliseconds: 500">>$ldif

#on génére le ldif pour le dialplan
echo "dn:cn=$num-1,ou=extensions,ou=asterisk,dc=asterisk,dc=local">>$ldif
echo "objectClass: top">>$ldif
echo "objectClass: inetOrgPerson">>$ldif
echo "objectClass: AsteriskExtension">>$ldif
echo "cn: $num-1">>$ldif
echo "sn: $num-1">>$ldif
echo "AstContext: internal">>$ldif
echo "AstExtension: $num">>$ldif
echo "AstPriority: 1">>$ldif
echo "AstApplication: Answer">>$ldif
echo "">>$ldif

echo "dn:cn=$num-2,ou=extensions,ou=asterisk,dc=asterisk,dc=local">>$ldif
echo "objectClass: top">>$ldif
echo "objectClass: inetOrgPerson">>$ldif
echo "objectClass: AsteriskExtension">>$ldif
echo "cn: $num-2">>$ldif
echo "sn: $num-2">>$ldif
echo "AstContext: internal">>$ldif
echo "AstExtension: $num">>$ldif
echo "AstPriority: 2">>$ldif
echo "AstApplication: Dial">>$ldif
echo "AstApplicationData: SIP/$user">>$ldif
echo "">>$ldif

echo "dn:cn=$num-3,ou=extensions,ou=asterisk,dc=asterisk,dc=local">>$ldif
echo "objectClass: top">>$ldif
echo "objectClass: inetOrgPerson">>$ldif
echo "objectClass: AsteriskExtension">>$ldif
echo "cn: $num-3">>$ldif
echo "sn: $num-3">>$ldif
echo "AstContext: internal">>$ldif
echo "AstExtension: $num">>$ldif
echo "AstPriority: 3">>$ldif
echo "AstApplication: Voicemail">>$ldif
echo "AstApplicationData: $num@default">>$ldif
echo "">>$ldif

echo "dn:cn=$num-4,ou=extensions,ou=asterisk,dc=asterisk,dc=local">>$ldif
echo "objectClass: top">>$ldif
echo "objectClass: inetOrgPerson">>$ldif
echo "objectClass: AsteriskExtension">>$ldif
echo "cn: $num-4">>$ldif
echo "sn: $num-4">>$ldif
echo "AstContext: internal">>$ldif
echo "AstExtension: $num">>$ldif
echo "AstPriority: 4">>$ldif
echo "AstApplication: Hangup">>$ldif

#on injecte le ldif dans le LDAP
echo "Ajout de $user dans asterisk !"
ldapadd -x -D "cn=admin,dc=asterisk,dc=local" -W -f $ldif

#ajout de la boite vocale dans voicemail.conf
voicemail=/etc/asterisk/voicemail.conf
echo "$num => $num,$user">>$voicemail

#on nettoie
rm $ldif

exit

PLEASE HELP ME its been one week looking for a solution
Accept greetings
 
Old 10-24-2012, 01:49 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Could you share what error you are getting... Or what problem you're facing?
 
Old 10-30-2012, 07:11 AM   #3
amadu84
LQ Newbie
 
Registered: Oct 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
This is the error that i have

root@asterisk:/etc/asterisk# ./adduser.sh
Entrez le nom du nouvel utilisateur :
diallo
Quel numéro voulez vous attribuer pour diallo ?
1200
Mot de passe Asterisk pour diallo :

Ajout de diallo dans asterisk !
Enter LDAP Password:
ldapadd: attributeDescription "dn": (possible missing newline after line 23, entry "uid=diallo,ou=users,ou=asterisk,dc=asterisk,dc=local"?)
adding new entry "uid=diallo,ou=users,ou=asterisk,dc=asterisk,dc=local"
ldap_add: Type or value exists (20)
additional info: objectClass: value #0 provided more than once
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Asterisk Configuration on Backtrack5 eyanu Linux - Software 10 07-13-2012 11:01 AM
Asterisk configuration with SNMP aocferreira Linux - Networking 0 03-22-2011 08:05 AM
LDAP configuration error, can't connect to LDAP server (-1) rdanielz Linux - Networking 3 06-01-2010 09:15 AM
Asterisk Server Configuration Completion. Lantzvillian Linux - Server 30 03-13-2008 09:38 PM
asterisk configuration to make a call PC - PC through asterisk priya001 Linux - Server 0 11-08-2006 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration