Ricerca nel sito web

Come installare il client FreeIPA su CentOS 8/RHEL 8


Come posso installare e configurare il client FreeIPA su CentOS 8/RHEL 8?. Nella nostra ultima guida, abbiamo trattato l'installazione del server FreeIPA su RHEL/CentOS 8. Questo articolo si concentrerà su come installare il client FreeIPA su CentOS 8/RHEL 8. Il client FreeIPA è installato sulle macchine da autenticare rispetto al server FreeIPA.

FreeIPA Client si integra con molti servizi nativi Linux come:

  • SSH: il server può mantenere le chiavi pubbliche SSH utilizzate sia da sshd che da ssh
  • SUDO: il server può fornire sudoer centralizzati a tutti i client
  • automount: il server può mantenere le mappe di montaggio automatico utilizzate dal client autofs differenziate in base a una posizione
  • Mappa utenti SELinux: il server può mantenere policy per assegnare diversi ruoli utente SELinux agli utenti, in base al loro gruppo o gruppo host

Queste integrazioni consentono all'amministratore di sistema di configurarle comodamente a livello centrale, sul server FreeIPA. Quando un comando di gestione viene eseguito sulla macchina Client, il client FreeIPA lo invia al server dove viene eseguito.

Installa il client FreeIPA su CentOS 8/RHEL 8

Su RHEL/CentOS 8, il client FreeIPA è disponibile come modulo AppStream.

$ sudo yum module list idm
 Name         Stream             Profiles                                          Summary
 idm          DL1                adtrust, client, dns, server, default [d]         The Red Hat Enterprise Linux Identity Management system module
 idm          client [d]         default [d]                                       RHEL IdM long term support client module
 Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Dall'output, puoi vedere che abbiamo flussi DL1 e client. Per ulteriori informazioni sul flusso client FreeIPA, esegui:

sudo yum module info idm:client

Installa il client FreeIPA sul sistema CentOS/RHEL 8 eseguendo il comando seguente nel tuo terminale.

sudo yum -y install @idm:client

Controlla la versione di ipa-client installata.

$ rpm -qi ipa-client
Name        : ipa-client
Version     : 4.9.8
Release     : 6.module+el8.6.0+797+07647629
Architecture: x86_64
Install Date: Fri 21 Oct 2022 11:59:39 PM EAT
Group       : Unspecified
Size        : 270423
License     : GPLv3+
Signature   : RSA/SHA256, Tue 10 May 2022 09:24:00 PM EAT, Key ID 15af5dac6d745a60
Source RPM  : ipa-4.9.8-6.module+el8.6.0+797+07647629.src.rpm
Build Date  : Tue 10 May 2022 08:34:01 PM EAT
Build Host  : ord1-prod-x86build005.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager    : [email 
Vendor      : Rocky
URL         : http://www.freeipa.org/
Summary     : IPA authentication for use on clients
...

Puoi fare lo stesso per SSD.

$ rpm -qi sssd
 Name        : sssd
Version     : 2.6.2
Release     : 4.el8_6
Architecture: x86_64
Install Date: Tue 28 Jun 2022 02:31:59 AM EAT
Group       : Applications/System
Size        : 35147
License     : GPLv3+
Signature   : RSA/SHA256, Sun 15 May 2022 07:55:55 PM EAT, Key ID 15af5dac6d745a60
Source RPM  : sssd-2.6.2-4.el8_6.src.rpm
Build Date  : Sun 15 May 2022 07:37:10 PM EAT
Build Host  : ord1-prod-x86build005.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager    : [email 
Vendor      : Rocky
URL         : https://github.com/SSSD/sssd
Summary     : System Security Services Daemon
....

Configura il client FreeIPA su CentOS 8/RHEL 8

Una volta completata l'installazione dei pacchetti client FreeIPA. Aggiungi il nome host e l'indirizzo IP del tuo server IPA al file /etc/hosts se non disponi di una risoluzione DNS funzionante.

$ sudo vim /etc/hosts
192.168.58.121 ipa.example.com

Imposta il nome host del tuo sistema.

export HNAME="rhel8.example.com"
sudo hostnamectl set-hostname $HNAME --static
sudo hostname $HNAME

Infine, configura il client FreeIPA sul tuo sistema eseguendo il comando seguente.

sudo ipa-client-install --hostname=rhel8.example.com \
 --mkhomedir \
 --server=ipa.example.com \
 --domain example.com \
 --realm EXAMPLE.COM

Dove :

  • rhel8.example.com : nome host del client
  • ipa.example.com Nome host del server FreeIPA
  • esempio.com : nome di dominio configurato nel server FreeIPA
  • EXAMPLE.COM – Server IPA gratuito Kerberos REALM

L'installazione dovrebbe essere simile all'esempio seguente.

This program will set up IPA client.
 Version 4.7.1
 Autodiscovery of servers for failover cannot work with this configuration.
 If you proceed with the installation, services will be configured to always access the discovered server for all operations and will not fail over to other servers in case of failure.
 Proceed with fixed values and no DNS discovery? [no]: yes
 Client hostname: rhel8.example.com
 Realm: EXAMPLE.COM
 DNS Domain: example.com
 IPA Server: ipa.example.com
 BaseDN: dc=example,dc=com
 Continue to configure the system with these values? [no]: yes
 Synchronizing time
 No SRV records of NTP servers found and no NTP server or pool address was provided.
 Using default chrony configuration.
 Attempting to sync time with chronyc.
 Time synchronization was successful.
 User authorized to enroll computers: admin
 Password for [email : <admin Password>
 Successfully retrieved CA cert
     Subject:     CN=Certificate Authority,O=EXAMPLE.COM
     Issuer:      CN=Certificate Authority,O=EXAMPLE.COM
     Valid From:  2019-03-24 10:12:55
     Valid Until: 2038-03-24 10:12:55
 Enrolled in IPA realm EXAMPLE.COM
 Created /etc/ipa/default.conf
 Configured sudoers in /etc/nsswitch.conf
 Configured /etc/sssd/sssd.conf
 Configured /etc/krb5.conf for IPA realm EXAMPLE.COM
 Systemwide CA database updated.
 Hostname (rhel8.local) does not have A/AAAA record.
 Failed to update DNS records.
 Missing A/AAAA record(s) for host rhel8.local: 192.168.122.198.
 Incorrect reverse record(s):
 192.168.122.198 is pointing to rhel8.example.com
 Adding SSH public key from /etc/ssh/ssh_host_ed25519_key.pub
 Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
 Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
 Could not update DNS SSHFP records.
 SSSD enabled
 Configured /etc/openldap/ldap.conf
 Configured /etc/ssh/ssh_config
 Configured /etc/ssh/sshd_config
 Configuring example.com as NIS domain.
 Client configuration complete.
 The ipa-client-install command was successful

Se disponi di un server DNS, il programma di installazione del client FreeIPA può rilevare il server FreeIPA ed eseguire il pull dell'installazione richiesta. Il comando:

sudo ipa-client-install

Dovrebbe essere sufficiente per configurare la macchina client.

Abilita la creazione di directory home al primo accesso

Se la directory home dell'utente non viene creata automaticamente, abilita questa funzione eseguendo il comando seguente.

$ sudo authconfig --enablemkhomedir --update
...
Executing: /usr/bin/authselect check
Executing: /usr/bin/authselect current --raw
Executing: /usr/bin/authselect select sssd with-sudo with-mkhomedir --force
Executing: /usr/bin/systemctl enable oddjobd.service
Executing: /usr/bin/systemctl stop oddjobd.service
Executing: /usr/bin/systemctl start oddjobd.service

Controlla se l'identificazione dell'utente è visibile sul server.

$ id josphat
uid=1676000008(josphat) gid=1676000008(josphat) groups=1676000008(josphat),1676000007(wheel-users)

Testare l'autenticazione utente LDAP FreeIPA.

$ ssh test@localhost
Password: 
Password expired. Change your password now.
Current Password: 
New password: <Set new passwoird
Retype new password: 
Activate the web console with: systemctl enable --now cockpit.socket
[test1@ipa ~]$ id
uid=1201400003(test1) gid=1201400003(test1) groups=1201400003(test1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Utilizzo dello strumento di gestione della riga di comando ipa di FreeIPA

Puoi amministrare FreeIPA Server dal computer client utilizzando lo strumento a riga di comando ipa.

Innanzitutto, procurati un ticket Kerberos.

$ sudo kinit admin
Password for [email : 

Controlla le informazioni sulla scadenza del biglietto utilizzando klist.

$ klist 
Ticket cache: KCM:0
Default principal: [email 
Valid starting       Expires              Service principal
03/24/2019 11:48:06  03/25/2019 11:48:04  krbtgt/EXAMPLE.COM@EXAMPLE.COM

Prova aggiungendo un account utente ed elencando gli account presenti:

$ sudo ipa user-add test \
  --first=Test --last=User \
  --email=[email  --password

Password: 
Enter Password again to verify: 
-------------------
 Added user "test"
-------------------
   User login: test
   First name: Test
   Last name: User
   Full name: Test User
   Display name: Test User
   Initials: TU
   Home directory: /home/test
   GECOS: Test User
   Login shell: /bin/bash
   Principal name: [email 
   Principal alias: [email 
   User password expiration: 20190324085532Z
   Email address: [email 
   UID: 1201400001
   GID: 1201400001
   Password: True
   Member of groups: ipausers
   Kerberos keys available: True

Verificare.

ipa user-find test

Abilita l'autenticazione senza password utilizzando la chiave privata

Se desideri autenticarti su un server senza password, copia la tua chiave pubblica sul server FreeIPA:

Fai clic sul pulsante Aggiungi sotto "Chiavi pubbliche SSH", incolla la chiave pubblica nella casella e salva.

Rimozione del client IPA dal sistema CentOS 8/RHEL 8

La rimozione del client FreeIPA su CentOS/RHEL 8 può essere eseguita eseguendo il comando:

$ sudo ipa-client-install  --uninstall
Unenrolling client from IPA server
Removing Kerberos service principals from /etc/krb5.keytab
Disabling client Kerberos and LDAP configurations
Redundant SSSD configuration file /etc/sssd/sssd.conf was moved to /etc/sssd/sssd.conf.deleted
Restoring client configuration files
Unconfiguring the NIS domain.
nscd daemon is not installed, skip configuration
nslcd daemon is not installed, skip configuration
Systemwide CA database updated.
Client uninstall complete.
The original nsswitch.conf configuration has been restored.
You may need to restart services or reboot the machine.
Do you want to reboot the machine? [no]: 
The ipa-client-install command was successful

Conclusione

Ecco qua. Il client FreeIPA è stato installato e configurato sul sistema RHEL/CentOS 8. Fare riferimento alle nostre guide di seguito per installare e configurare il client FreeIPA su altri sistemi.

  • Come configurare il client FreeIPA su Ubuntu/CentOS 7
  • Come configurare il client LDAP su Ubuntu e Ubuntu LTS
  • Installa FreeIPA Server su Ubuntu

Articoli correlati: