Usando Linux para muchas cosas y disfrutando de videojuegos, en dispositivos moviles, consolas y pc. Using Linux for many things and enjoying video games, mobile devices, consoles and pc

Mostrando entradas con la etiqueta centos ldap. Mostrar todas las entradas
Mostrando entradas con la etiqueta centos ldap. Mostrar todas las entradas

Como instalar LDAP Centos Directory Server paso a paso


Como instalar LDAP Centos Directory Server paso a paso
Una red LAN correctamente organizada no es solo la parte de hardware, tambien el software juega un papel importante, como lo es el tema de este articulo. Como instalar LDAP Centos Directory Server paso a paso.

Que es LDAP Centos Directory Server

También conocido como Fedora 389 Directory Server, es un servicio de directorio activo que podemos descargar e instalar de forma gratuita. Este servicio (y software) es muy popular para manejar grandes redes y los tres pilares del 389 Directory Server son confiabilidad, rendimiento y escalabilidad.

Requerimientos para instalar 389 Directory Server en Centos

Como instalar LDAP Centos Directory Server paso a paso

-Para comenzar, debemos verificar que nuestro servidor este correctamente "nombrado" por asi decirlo, de la forma host.domain. Editamos y si es necesario, modificamos el archivo hosts para esto.
La forma correcta es colocar su ip por la que sera localizable el servidor y su FQDN (Fully qualified domain name o nombre completo calificado de dominio) ademas del host. En este articulo mi servidor Centos 7 estara en la ip 192.168.5.104 con hostname cenldap.drivemeca.com y host cenldap. Salimos guardando si hacemos cambios
vi /etc/hosts
192.168.5.104 cenldap.drivemeca.com cenldap

-Verificamos que este correcto el FQDN de nuestro servidor
hostname
cenldap.drivemeca.com
Nuestro servidor debe tener un correcto FQDN

-Hacemos ajustes a nuestro servidor por seguridad y rendimiento
vi /etc/sysctl.conf
net.ipv4.tcp_keepalive_time = 300
net.ipv4.ip_local_port_range = 1024 65000
fs.file-max = 64000

-Mas cambios
vi /etc/security/limits.conf
*                soft    nofile          8192
*                hard    nofile         8192

-Mas cambios
vi /etc/profile
ulimit -n 8192

-Activamos un modulo pam
vi /etc/pam.d/login
session    required     /usr/lib64/security/pam_limits.so

-Reiniciamos el servidor Linux Centos para que se activen todos los cambios
reboot

-De regreso, nos logeamos como root. Creamos y le colocamos contraseña a una cuenta de usuario encargada de manejar nuestro Centos Direcory Server
useradd ldapadmin
passwd ldapadmin
Creamos la cuenta ldapadmin para 389 Directory Server

-Instalamos los paquetes de 389 con clientes LDAP, dependiendo de tu ancho de banda internet, esto puede demorar un poco
yum install 389-ds-base openldap-clients
Instamos el servidor 389 y clientes LDAP

-Seguidamente instalamos del repositorio Epel otras dependencias para la administración de Fedora 389 Server
yum --enablerepo=epel install idm-console-framework 389-adminutil 389-admin 389-admin-console 389-console 389-ds-console

Configurar Directorio Activo en Linux Centos

-Este paso aunque pareciera complejo, no lo es tanto. Usaremos los valores defauls la mayoría de las veces presionando Enter. Ejecutamos el siguiente comando y el nos ira haciendo preguntas. En este ejemplo marco en ROJO las respuestas, si no vez nada escrito es que simplemente presione Enter
setup-ds-admin.pl 

=======================================================================
This program will set up the 389 Directory and Administration Servers.

It is recommended that you have "root" privilege to set up the software.
Tips for using this program:
  - Press "Enter" to choose the default and go to the next screen
  - Type "Control-B" then "Enter" to go back to the previous screen
  - Type "Control-C" to cancel the setup program

Would you like to continue with set up? [yes]:

======================================================================
Your system has been scanned for potential problems, missing patches,
etc.  The following output is a report of the items found that need to
be addressed before running this software in a production
environment.

389 Directory Server system tuning analysis version 14-JULY-2016.

NOTICE : System is x86_64-unknown-linux4.13.13-5-pve (4 processors).

Would you like to continue? [yes]:

======================================================================
Choose a setup type:

   1. Express
       Allows you to quickly set up the servers using the most
       common options and pre-defined defaults. Useful for quick
       evaluation of the products.

   2. Typical
       Allows you to specify common defaults and options.

   3. Custom
       Allows you to specify more advanced options. This is
       recommended for experienced server administrators only.

To accept the default shown in brackets, press the Enter key.

Choose a setup type [2]:
==============================================================================
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
<hostname>.<domainname>
Example: eros.example.com.

To accept the default shown in brackets, press the Enter key.

Warning: This step may take a few minutes if your DNS servers
can not be reached or if DNS is not configured correctly.  If
you would rather not wait, hit Ctrl-C and run this program again
with the following command line option to specify the hostname:

    General.FullMachineName=your.hostname.domain.name

Computer name [cenldap.drivemeca.com]:

=======================================================================
The servers must run as a specific user in a specific group.
It is strongly recommended that this user should have no privileges
on the computer (i.e. a non-root user).  The setup procedure
will give this user/group some permissions in specific paths/files
to perform server-specific operations.

If you have not yet created a user and group for the servers,
create this user and group using your native operating
system utilities.

System User [dirsrv]: ldapadmin
System Group [dirsrv]: ldapadmin

==============================================================================
Server information is stored in the configuration directory server.
This information is used by the console and administration server to
configure and manage your servers.  If you have already set up a
configuration directory server, you should register any servers you
set up or create with the configuration server.  To do so, the
following information about the configuration server is required: the
fully qualified host name of the form
<hostname>.<domainname>(e.g. hostname.example.com), the port number
(default 389), the suffix, the DN and password of a user having
permission to write the configuration information, usually the
configuration directory administrator, and if you are using security
(TLS/SSL).  If you are using TLS/SSL, specify the TLS/SSL (LDAPS) port
number (default 636) instead of the regular LDAP port number, and
provide the CA certificate (in PEM/ASCII format).

If you do not yet have a configuration directory server, enter 'No' to
be prompted to set up one.

Do you want to register this software with an existing
configuration directory server? [no]:

=======================================================================
Please enter the administrator ID for the configuration directory
server.  This is the ID typically used to log in to the console.  You
will also be prompted for the password.

Configuration directory server
administrator ID [admin]:
Password: Escribimos-una-acontraseña
Password (confirm): Escribimos-una-contraseña

==============================================================================
The information stored in the configuration directory server can be
separated into different Administration Domains.  If you are managing
multiple software releases at the same time, or managing information
about multiple domains, you may use the Administration Domain to keep
them separate.

If you are not using administrative domains, press Enter to select the
default.  Otherwise, enter some descriptive, unique name for the
administration domain, such as the name of the organization
responsible for managing the domain.

Administration Domain [drivemeca.com]:

=======================================================================
The standard directory server network port number is 389.  However, if
you are not logged as the superuser, or port 389 is in use, the
default value will be a random unused port number greater than 1024.
If you want to use port 389, make sure that you are logged in as the
superuser, that port 389 is not in use.

Directory server network port [389]:

==============================================================================
Each instance of a directory server requires a unique identifier.
This identifier is used to name the various
instance specific files and directories in the file system,
as well as for other uses as a server instance identifier.

Directory server identifier [cenldap]:

==============================================================================
The suffix is the root of your directory tree.  The suffix must be a valid DN.
It is recommended that you use the dc=domaincomponent suffix convention.
For example, if your domain is example.com,
you should use dc=example,dc=com for your suffix.
Setup will create this initial suffix for you,
but you may have more than one suffix.
Use the directory server utilities to create additional suffixes.

Suffix [dc=drivemeca, dc=com]:

=======================================================================
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and typically has a
bind Distinguished Name (DN) of cn=Directory Manager.
You will also be prompted for the password for this user.  The password must
be at least 8 characters long, and contain no spaces.
Press Control-B or type the word "back", then Enter to back up and start over.

Directory Manager DN [cn=Directory Manager]:
Password: Escribimos-una-contraseña
Password (confirm): Escribimos-una-contraseña

=======================================================================
The Administration Server is separate from any of your web or application
servers since it listens to a different port and access to it is
restricted.

Pick a port number between 1024 and 65535 to run your Administration
Server on. You should NOT use a port number which you plan to
run a web or application server on, rather, select a number which you
will remember and which will not be used for anything else.

Administration port [9830]:

=======================================================================
The interactive phase is complete.  The script will now set up your
servers.  Enter No or go Back if you want to change something.

Are you ready to set up your servers? [yes]:
Creating directory server . . .
Your new DS instance 'cenldap' was successfully created.
Creating the configuration directory server . . .
Beginning Admin Server creation . . .
Creating Admin Server files and directories . . .
Updating adm.conf . . .
Updating admpw . . .
Registering admin server with the configuration directory server . . .
Updating adm.conf with information from configuration directory server . . .
Updating the configuration for the httpd engine . . .
Starting admin server . . .
The admin server was successfully started.
Admin server was successfully created, configured, and started.
Exiting . . .
Log file is '/tmp/setupvTYWOb.log'

-Ya configurado 389 Server. Activamos los servicios para que se ejecuten cada vez que haga boot el servidor
systemctl enable dirsrv.target
systemctl enable dirsrv-admin

-Iniciamos el servicio de directorio y verificamos su ejecución
systemctl start dirsrv.target
systemctl status dirsrv.target
● dirsrv.target - 389 Directory Server
   Loaded: loaded (/usr/lib/systemd/system/dirsrv.target; enabled; vendor preset: disabled)
   Active: active since Thu 2018-03-01 21:34:51 UTC; 28s ago

Mar 01 21:34:51 cenldap.drivemeca.com systemd[1]: Reached target 389 Directory Server.
Mar 01 21:34:51 cenldap.drivemeca.com systemd[1]: Starting 389 Directory Server.

-Iniciamos el administrador del directorio y verificamos su ejecución
systemctl start dirsrv-admin
systemctl status dirsrv-admin
● dirsrv-admin.service - 389 Administration Server.
   Loaded: loaded (/usr/lib/systemd/system/dirsrv-admin.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2018-03-01 21:31:51 UTC; 4min 43s ago
 Main PID: 1149 (httpd)
   CGroup: /system.slice/dirsrv-admin.service
           ├─1149 /usr/sbin/httpd -k start -f /etc/dirsrv/admin-serv/httpd.conf
           ├─1150 /usr/sbin/httpd -k start -f /etc/dirsrv/admin-serv/httpd.conf
           └─1151 /usr/sbin/httpd -k start -f /etc/dirsrv/admin-serv/httpd.conf

Mar 01 21:31:51 cenldap.drivemeca.com systemd[1]: Starting 389 Administration Server....
Mar 01 21:31:51 cenldap.drivemeca.com systemd[1]: PID file /var/run/dirsrv/admin-serv.pid not readable (yet?) after start.
Mar 01 21:31:51 cenldap.drivemeca.com systemd[1]: Started 389 Administration Server..

-Información importante para posterior administración en Linux Centos
Configuración de 389 LDAP: /etc/dirsrv/
Logs de 389 LDAP: /var/log/dirsrv/

Probando Centos 389 LDAP

-Antes de continuar, probaremos de forma basica el funcionamiento de nuestro LDAP ejecutando el siguiente comando
Probamos de forma basica nuestro LDAP

ldapsearch -x -b "dc=drivemeca,dc=com"
# extended LDIF
#
# LDAPv3
# base <dc=drivemeca,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# drivemeca.com
dn: dc=drivemeca,dc=com
objectClass: top
objectClass: domain
dc: drivemeca

# Directory Administrators, drivemeca.com
dn: cn=Directory Administrators,dc=drivemeca,dc=com
objectClass: top
objectClass: groupofuniquenames
cn: Directory Administrators
uniqueMember: cn=Directory Manager

# Groups, drivemeca.com
dn: ou=Groups,dc=drivemeca,dc=com
objectClass: top
objectClass: organizationalunit
ou: Groups

# People, drivemeca.com
dn: ou=People,dc=drivemeca,dc=com
objectClass: top
objectClass: organizationalunit
ou: People

# Special Users, drivemeca.com
dn: ou=Special Users,dc=drivemeca,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Special Users
description: Special Administrative Accounts

# Accounting Managers, Groups, drivemeca.com
dn: cn=Accounting Managers,ou=Groups,dc=drivemeca,dc=com
objectClass: top
objectClass: groupOfUniqueNames
cn: Accounting Managers
ou: groups
description: People who can manage accounting entries
uniqueMember: cn=Directory Manager

# HR Managers, Groups, drivemeca.com
dn: cn=HR Managers,ou=Groups,dc=drivemeca,dc=com
objectClass: top
objectClass: groupOfUniqueNames
cn: HR Managers
ou: groups
description: People who can manage HR entries
uniqueMember: cn=Directory Manager

# QA Managers, Groups, drivemeca.com
dn: cn=QA Managers,ou=Groups,dc=drivemeca,dc=com
objectClass: top
objectClass: groupOfUniqueNames
cn: QA Managers
ou: groups
description: People who can manage QA entries
uniqueMember: cn=Directory Manager

# PD Managers, Groups, drivemeca.com
dn: cn=PD Managers,ou=Groups,dc=drivemeca,dc=com
objectClass: top
objectClass: groupOfUniqueNames
cn: PD Managers
ou: groups
description: People who can manage engineer entries
uniqueMember: cn=Directory Manager

# search result
search: 2
result: 0 Success

# numResponses: 10
# numEntries: 9

Como administrar Centos LDAP

-Hay dos formas, local o remota. Para ejecutar la consola en el servidor, abrimos una consola en nuestra session gráfica o GUI y ejecutamos
389-console

-Si no estamos frente al Centos Directory Server ejecutamos una session con ssh conectándonos al puerto 9830. Tu ip del servidor podría ser diferente, haz el cambio.
Nos aparecera una ventana para iniciar session. Nos conectamos con la cuenta admin configurada en pasos anteriores y presionamos Enter o damos click al botón OK
ssh -X root@192.168.5.104 /usr/bin/389-console -a http://192.168.5.104:9830
Nos logeamos a la consola administrativa 389 con la cuenta admin

-La consola es bastante sencilla y poderosa a la vez
La consola 389 es sencilla y poderosa

Como administrar LDAP Centos 7

-En el arbol de la izquierda daremos click a Administration Server y seguidamente click al botón Open de la esquina superior derecha
Abrimos la ventana de administracion de nuestro servidor Centos LDAP

-En la nueva ventana que nos aparece tenemos dos pestañas, Task con funcionalidades básicas como apagar, reiniciar, etc nuestro opensource active directory (estas tareas también se puede ejecutar desde linea de comandos) y la pestaña Configuration
En la pestaña Task podemos ejecutar tareas basicas para nuestro 389 Server

-En la pestaña Configuration podemos realizar una serie de tareas como son cambiar el puerto default de conexiones (9830), permitir conexiones, etc
En Configuration podemos bloquear o dar permisos de conexion

-Algo muy importante, en la pestaña Access podemos cambiar la contraseña de nuestra cuenta admin
Tambien podemos cambiar la contraseña de nuestra cuenta admin 389

Como administrar el Centos Directorio Activo

-En la ventana principal 389 damos click en el árbol de la izquierda a Directory Server (cenldap) y seguidamente al botón Open de la esquina superior derecha
Ingresamos a administrar el Directorio Activo 389

-En la nueva ventana que nos aparece podemos realizar una serie de tareas en la pestaña Task
En Task podemos realizar varias tareas de administracion

-En la pestaña Configuration contamos con otras opciones
La pestaña Configuration nos permite otras funciones

-En la pestaña Directory sera donde mas trabajaras; aqui puedes crear organizaciones, grupos y usuarios
En la pestaña Directory podemos crear Organizaciones, grupos y usuarios

-Y por ultimo, la pestaña Status nos muestra el estado actual de nuestro LDAP opensource
Status nos muestra el estado del servidor LDAP

LDAP Centos Directory Server es una potente herramienta opensource para manejar y administrar tu red informática. Ya lo utilizas, usas otra solución, cual?

Artículos recomendadosFreeIPA en tu oficina
                                           Como configurar FreeIPA replica
                                           Como instalar y configurar OpenLDAP en Linux Centos 7
                                           Como instalar phpldapadmin en centos
                                           Como instalar Samba en Linux Centos
                                           Como cambiar zona horaria en Linux Centos


Quiero vivir de mi blog, de enseñar opensource, pero esto no sera posible sin tu apoyo, me ayudas?


Satisfech@ con el articulo? Bien, hazme un favor, compártelo en tus redes sociales (compartir es sexy). Escríbeme en los comentarios aquí debajo y pasa la voz compartiendo el tweet.
Sígueme en twittergoogle+facebook, email, YouTube o Patreon y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.



Share/Bookmark