Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 7

How to Configure PBIS to Join Ubuntu with

Windows AD
In this article, we will install and configure PowerBroker Identity Services (PBIS) on the Ubuntu 14.04
in order to join together with Windows Active Directory. We also will consider how to remove stale
computer account from AD using dsquery command.

Download and Install


To start with, we need to download the latest version of PowerBroker Identity Services from GitHub
Also, you can download it by simply running following command on Ubuntu OS:
wget https://github.com/BeyondTrust/pbis-open/releases/download/8.5.3/pbis- open-
8.5.3.293.linux.x86.deb.sh

Now, you need to set execution bit and execute the package with root privileges:
chmod +x pbis-open-8.5.3.293.linux.x86_64.deb.sh

sudo ./pbis-open-8.5.3.293.linux.x86_64.deb.sh

It will ask a couple of question during installation so choose options accordingly. Once the installation
is done its time to join the machine to the domain.

PBIS Configuration
We are ready to proceed with configuration. Please navigate to /opt/pbis/bin/ directory and run
domainjoin-cli command to join a host to an Active directory domain.
cd /opt/pbis/bin/
sudo domainjoin-cli join [DomainName [DomainAccount]

where,
DomainName - the name of your domain
DomainAccount - your domain account (user@domainname)
Example: sudo domainjoin-cli join example.com administrator
When prompted, please provide Active Directory administrator's password. On successful
authentication, the command adds your Ubuntu computer as a member of the domain. The command
also adds entries in the /etc/hosts file.
To check Ubuntu domain setting you need to run the following command from your terminal:
sudo domainjoin-cli query
The command will display the name of the domain to which your Ubuntu computer has joined.
Example:
Name = username
Domain = example.com
Distinguished Name = CN=username,CN=Computers,DC=example,DC=com
Note: If you want to remove your Ubuntu computer from the domain, you need to run
sudo domainjoin-cli leave

Once joined to the domain important thing to do is to restrict access to sudoers group to members of
Domain Admin group only. This can be accomplished by updating /etc/sudoers file by adding
%domain^admins ALL=(ALL) ALL in group section so sudoers file section looks as follows:
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
%domain^admins ALL=(ALL) ALL

The good thing about using PBIS is that it allows multiple ways to customize the login, domain prefix,
login shell, folder name, etc. In order to set up default configuration for domain users, you need to use
PBIS to set the environment for all required domain users that will be logged to the system.
Please open the terminal and run following commands:
sudo /opt/pbis/bin/config UserDomainPrefix [Domain]

Set domain prefix


sudo /opt/pbis/bin/config AssumeDefaultDomain True

Set this to 'true' avoid entering domain names all the time
sudo /opt/pbis/bin/config LoginShellTemplate /bin/bash

Set default shell


sudo /opt/pbis/bin/config HomeDirTemplate %H/%D/%U

Set different home dir then the local users on the machine
sudo /opt/pbis/bin/config RequireMembershipOf "[Domain]\\[SecurityGroup]"

Set specific Active Directory security groups


Next step, you need to edit the pamd.d common-session file. Please type in terminal:
sudo vi /etc/pam.d/common-session

Navigate to the line that states session sufficient pam_lsass.so and replace it with session [success=ok
default=ignore] pam_lsass.so
Then, we need to edit the lightdm configuration file and append the following lines:
sudo vi /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

allow-guest=false
greeter-show-manual-login=true

Please note, that if you are using Lubuntu 14.04 your lightdm configuration file will be 60-lightdm-
gtk-greeter.conf

Test it!
Once satisfied with all the options just reboot the machine:
reboot

and login:
ssh [username]@[servername]

How to restart PBIS service


The PBIS agents are composed of the service manager lwsmd daemon, that is located in
/opt/pbis/sbin/lwsmd. This daemon includes lsass service, that handles authentication, authorization,
caching and ldmap lookups. Because the authentication service registers trusts only on startups, you
should restart lsass with the PBIS Service Manager after you modify a trust relationship. To restart the
service simply run:
/opt/pbis/bin/lwsm restart lsass

How to uninstall PBIS using a command line


To uninstall PBIS by using a command, run the following command:
/opt/pbis/bin/uninstall.sh uninstall

If you want to completely remove all PBIS related files from you system, please run purge process:
/opt/pbis/bin/uninstall.sh purge

How to find and remove stale computers in Active Directory


Some organizations have their maximum inactivity period that can be allowed for the AD accounts. So,
accounts that were being inactive for such period of time should be deleted. But it is highly
recommended that you first find out all the inactive accounts before deleting them. In our article, we
will use Command Prompt. Finding inactive accounts, and disabling or deleting them can be performed
using the command prompt, by using dsquery command.
Basically, the dsquery command searches for AD objects according to the specified criteria (for
instance, inactive account for specific period of time). Later on, the search results can be given as input
to dsmod and dsrm commands in order to disable and delete accounts. To start with, you need to open
Command Prompt on AD host. Then, to find the computers that are inactive, please run:
dsquery computer -inactive

Now, to disable inactive computers, please run:


dsquery computer -inactive | dsmod computer -disabled yes

After disabling then, you are allowed to delete them by running:


dsquery computer -disabled | dsrm -noprompt

Please note, that instead of disabling the inactive computers firs, you can directly delete them by
running:
dsquery computer -inactive | dsrm -noprompt

Conclusion
This article is a continuation of the earleir article on integrating LDAP with Active Directory. There are
several ways to authenticate Linux servers against Microsoft Active Directory such as Samba/Winbind,
Centrify, etc. and installers are available for both debian and rpm package format supporting RHEL,
Ubuntu, CentOS, Debian, etc. Nevertheless, provided instructions have only been tested on Ubuntu
14.04 LTS Distribution. With minimal tweaking these steps should also work for other distributions.
Older and now deprecated versions of Likewise-Open should work in a similar fashion as PBIS-Open,
and may be required on older distributions.

Cómo configurar PBIS para unirse a Ubuntu con Windows AD


En este artículo, instalaremos y configuraremos PowerBroker Identity Services (PBIS) en Ubuntu
14.04 para unirnos con Windows Active Directory. También consideraremos cómo eliminar la cuenta
obsoleta de la computadora de AD mediante el comando dsquery.
Descargar e instalar
Para empezar, tenemos que descargar la última versión de PowerBroker Identity Services de GitHub
Además, puedes descargarlo simplemente ejecutando el siguiente comando en el sistema operativo
Ubuntu:
wget https://github.com/BeyondTrust/pbis-open/releases/download/8.5.3/pbis- open-
8.5.3.293.linux.x86.deb.sh
Ahora, debe establecer el bit de ejecución y ejecutar el paquete con privilegios de administrador:
chmod + x pbis-open-8.5.3.293.linux.x86_64.deb.sh
sudo ./pbis-open-8.5.3.293.linux.x86_64.deb.sh
Te preguntará un par de preguntas durante la instalación, así que elige las opciones en consecuencia.
Una vez que se realiza la instalación, es hora de unir la máquina al dominio.
Configuración PBIS
Estamos listos para continuar con la configuración. Navegue al directorio / opt / pbis / bin / y ejecute el
comando domainjoin-cli para unir un host a un dominio de Active Directory.
cd / opt / pbis / bin /
sudo domainjoin-cli join [DomainName [DomainAccount]
dónde,
DomainName - el nombre de tu dominio
DomainAccount: tu cuenta de dominio (usuario @ nombre de dominio)
Ejemplo: sudo domainjoin-cli join example.com administrador
Cuando se le solicite, proporcione la contraseña del administrador de Active Directory. En la
autenticación exitosa, el comando agrega su computadora Ubuntu como miembro del dominio. El
comando también agrega entradas en el archivo / etc / hosts.
Para verificar la configuración de dominio de Ubuntu, debe ejecutar el siguiente comando desde su
terminal:
sudo domainjoin-cli query
El comando mostrará el nombre del dominio al que se ha unido su computadora Ubuntu.

Ejemplo:
Nombre = nombre de usuario
Domain = example.com
Nombre distinguido = CN = nombre de usuario, CN = computadoras, DC = ejemplo, DC = com
Nota: Si desea eliminar su computadora Ubuntu del dominio, debe ejecutar
sudo domainjoin-cli leave
Una vez que se haya unido al dominio, lo importante es restringir el acceso al grupo de sudoers
únicamente a los miembros del grupo de administración del dominio. Esto se puede lograr actualizando
el archivo / etc / sudoers agregando% domain ^ admins ALL = (ALL) ALL en la sección de grupo para
que la sección del archivo sudoers tenga el siguiente aspecto:
# Los miembros del grupo de administración pueden obtener privilegios de raíz
% admin ALL = (TODOS) TODOS
% domain ^ admins ALL = (ALL) TODOS
Lo bueno de usar PBIS es que permite múltiples formas de personalizar el inicio de sesión, el prefijo
del dominio, el shell de inicio de sesión, el nombre de la carpeta, etc. Para configurar la configuración
predeterminada para los usuarios del dominio, debe usar PBIS para establecer el entorno para todos
usuarios de dominio requeridos que se registrarán en el sistema.
Abra el terminal y ejecute los siguientes comandos:
sudo / opt / pbis / bin / config UserDomainPrefix [Dominio]
Establecer prefijo de dominio
sudo / opt / pbis / bin / config AssumeDefaultDomain True
Establezca esto en 'verdadero' evite ingresar nombres de dominio todo el tiempo
sudo / opt / pbis / bin / config LoginShellTemplate / bin / bash
Establecer el shell por defecto
sudo / opt / pbis / bin / config HomeDirTemplate% H /% D /% U
Establezca un directorio de inicio diferente y luego los usuarios locales en la máquina
sudo / opt / pbis / bin / config RequireMembershipOf "[Domain] \\ [SecurityGroup]"
Establecer grupos de seguridad específicos de Active Directory
El siguiente paso es editar el archivo de sesión común pamd.d. Por favor ingrese la terminal:
sudo vi /etc/pam.d/common-session
Navegue a la línea que indica la sesión suficiente pam_lsass.so y reemplácela por la sesión [success =
ok default = ignore] pam_lsass.so
Entonces, necesitamos editar el archivo de configuración lightdm y anexar las siguientes líneas:
sudo vi /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
allow-guest = falso
greeter-show-manual-login = true
Tenga en cuenta que si usa Lubuntu 14.04, su archivo de configuración lightdm será 60-lightdm-gtk-
greeter.conf

¡Pruébalo!
Una vez satisfecho con todas las opciones solo reinicie la máquina:
reiniciar
e inicie sesión:
ssh [nombre de usuario] @ [nombre de servidor]
Cómo reiniciar el servicio PBIS
Los agentes PBIS están compuestos por el administrador de servicios lwsmd daemon, que se encuentra
en / opt / pbis / sbin / lwsmd. Este daemon incluye el servicio lsass, que maneja las búsquedas de
autenticación, autorización, almacenamiento en caché y ldmap. Debido a que el servicio de
autenticación registra las confianzas solo en los inicios, debe reiniciar lsass con el Administrador de
servicios PBIS después de modificar una relación de confianza. Para reiniciar el servicio simplemente
ejecute:
/ opt / pbis / bin / lwsm reiniciar lsass
Cómo desinstalar PBIS usando una línea de comando
Para desinstalar PBIS usando un comando, ejecute el siguiente comando:
/opt/pbis/bin/uninstall.sh uninstall
Si desea eliminar por completo todos los archivos relacionados con PBIS de su sistema, ejecute el
proceso de purga:
/opt/pbis/bin/uninstall.sh purge

Cómo encontrar y eliminar computadoras obsoletas en Active Directory


Algunas organizaciones tienen su período máximo de inactividad que se puede permitir para las
cuentas de AD. Por lo tanto, las cuentas que estaban inactivas durante ese período de tiempo deben
eliminarse. Pero es muy recomendable que primero descubra todas las cuentas inactivas antes de
eliminarlas. En nuestro artículo, usaremos Command Prompt. Encontrar cuentas inactivas y
deshabilitarlas o eliminarlas se puede realizar usando el símbolo del sistema, usando el comando
dsquery.
Básicamente, el comando dsquery busca objetos AD de acuerdo con los criterios especificados (por
ejemplo, cuenta inactiva por un período específico de tiempo). Más adelante, los resultados de
búsqueda se pueden dar como entrada a los comandos dsmod y dsrm para deshabilitar y eliminar
cuentas. Para comenzar, debe abrir el símbolo del sistema en el host AD. Luego, para encontrar las
computadoras que están inactivas, por favor ejecute:
dsquery computadora -inactiva
Ahora, para desactivar las computadoras inactivas, ejecute:
dsquery computadora -inactiva | dsmod computer-disaabled yes
Luego de deshabilitarlo, puede eliminarlos ejecutando:
dsquery computadora -desactivada | dsrm -noprompt
Tenga en cuenta que, en lugar de desactivar las computadoras inactivas, puede eliminarlas directamente
ejecutando:
dsquery computadora -inactiva | dsrm -noprompt
Conclusión
Este artículo es una continuación del artículo de Earleir sobre la integración de LDAP con Active
Directory. Hay varias maneras de autenticar servidores Linux contra Microsoft Active Directory como
Samba / Winbind, Centrify, etc. y los instaladores están disponibles para ambos formatos de paquete
Debian y RPM soportando RHEL, Ubuntu, CentOS, Debian, etc. Sin embargo, las instrucciones
provistas solo tienen probado en Ubuntu 14.04 LTS Distribution. Con ajustes mínimos, estos pasos
también deberían funcionar para otras distribuciones. Las versiones anteriores y ahora en desuso de
Likewise-Open deberían funcionar de manera similar a PBIS-Open, y pueden ser necesarias en
distribuciones más antiguas.

You might also like