I begun with a clean FreeBSD 8.0 installed in a virtual machine on VirtualBox running on Linux host.
I started with the article "LDAP Authentication" (http://www.freebsd.org/doc/en/articles/ldap-auth/article.html) and I got stuck trying to start SSL/TLS connection.
These are the configurations files and the commands I executed
------------------------------------------------------------
/etc/hosts
------------------------------------------------------------
[cmd=]fbsd# pkg_add -r openldap24-server[/cmd]
------------------------------------------------------------
/usr/local/etc/openldap/slapd.conf
------------------------------------------------------------
/etc/rc.conf
------------------------------------------------------------
Generates files for clients to authenticate you as the valid LDAP server:
------------------------------------------------------------
------------------------------------------------------------
/usr/local/etc/openldap/ldap.conf
------------------------------------------------------------
Testing the connection:
Where is the problem? on the certs maybe? Thanks in advance...
I started with the article "LDAP Authentication" (http://www.freebsd.org/doc/en/articles/ldap-auth/article.html) and I got stuck trying to start SSL/TLS connection.
These are the configurations files and the commands I executed
------------------------------------------------------------
/etc/hosts
Code:
::1 localhost localhost.example.com
127.0.0.1 localhost localhost.example.com
192.168.1.101 fbsd.example.com fbsd
------------------------------------------------------------
[cmd=]fbsd# pkg_add -r openldap24-server[/cmd]
------------------------------------------------------------
/usr/local/etc/openldap/slapd.conf
Code:
include /usr/local/etc/openldap/schema/core.schema
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
modulepath /usr/local/libexec/openldap
moduleload back_bdb
security ssf=128
TLSCertificateFile /usr/local/etc/openldap/cert.crt
TLSCertificateKeyFile /usr/local/etc/openldap/cert.key
TLSCACertificateFile /usr/local/etc/openldap/cacert.crt
database bdb
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
directory /var/db/openldap-data
index objectClass eq
------------------------------------------------------------
/etc/rc.conf
Code:
keymap="spanish.iso.acc"
sshd_enable="YES"
ifconfig_em0="inet 192.168.1.101 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="fbsd.example.com"
slapd_enable="YES"
------------------------------------------------------------
Generates files for clients to authenticate you as the valid LDAP server:
Code:
fbsd# cd /usr/local/etc/openldap
fbsd# openssl genrsa -out cert.key 1024
Generating RSA private key, 1024 bit long modulus
......++++++
..++++++
e is 65537 (0x10001)
fbsd# openssl req -new -key cert.key -out cert.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:AR
State or Province Name (full name) [Some-State]:Tucuman
Locality Name (eg, city) []:Capital
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Example.Com
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []: fbsd.example.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
fbsd# openssl x509 -req -in cert.csr -days 365 -signkey cert.key -out cert.crt
Signature ok
subject=/C=AR/ST=Tucuman/L=Capital/O=Example.Com/CN=fbsd.example.com
Getting Private key
fbsd# cp cert.crt cacert.crt
Code:
fbsd# /usr/local/etc/rc.d/slapd start
Starting slapd.
fbsd# sockstat -4 -p 389
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
ldap slapd 917 7 tcp4 *:389 *:*
------------------------------------------------------------
/usr/local/etc/openldap/ldap.conf
Code:
base dc=example,dc=com
uri ldap://server.example.com/
ssl start_tls
tls_cacert /usr/local/etc/openldap/cacert.crt
------------------------------------------------------------
Testing the connection:
Code:
fbsd# ldapsearch -Z -d 255
ldap_create
ldap_extended_operation_s
ldap_extended_operation
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP server.example.com:389
ldap_connect_to_host: getaddrinfo failed: hostname nor servname provided, or not known
ldap_err2string
ldap_start_tls: Can't contact LDAP server (-1)
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP server.example.com:389
ldap_connect_to_host: getaddrinfo failed: hostname nor servname provided, or not known
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
Where is the problem? on the certs maybe? Thanks in advance...
Last edited by a moderator: