Installa e configura il server FreeIPA su CentOS 8/RHEL 8
Benvenuti nella nostra guida su come installare e configurare il server FreeIPA su RHEL 8/CentOS 8. FreeIPA è uno strumento di gestione delle identità gratuito e open source sponsorizzato da Red Hat ed è l'upstream per Red Hat Identity Manager(IdM). In questa guida discuteremo su come installare e configurare FreeIPA Server sul server Linux CentOS 8/RHEL 8.
Per CentOS 7: come installare FreeIPA Server su CentOS 7
Il sistema di gestione delle identità FreeIPA mira a fornire un modo semplice per gestire a livello centrale identità, policy e controllo per utenti e servizi. È progettato per fornire un servizio integrato di gestione delle identità per un'ampia gamma di client, inclusi Linux, Mac e persino Windows.
Vantaggi dell'utilizzo di FreeIPA
- Gestione centrale dell'autenticazione: gestione centralizzata di utenti, macchine e servizi all'interno di grandi ambienti aziendali Linux/Unix.
- Controllo degli accessi capillare: fornisce un metodo chiaro per definire le policy di controllo degli accessi per governare le identità degli utenti e la delega delle attività amministrative.
- One Time Password (OTP): fornisce un metodo popolare per ottenere l'autenticazione a due fattori (2FA).
- Connessione diretta ad Active Directory: puoi recuperare informazioni da Active Directory (AD) e unirti a un dominio o realm in modo standard.
- Trust tra realm di Active Directory: in qualità di amministratore di sistema, puoi stabilire trust Kerberos tra foreste con Microsoft Active Directory. Ciò consente agli utenti esterni di Active Directory (AD) di accedere comodamente alle risorse nel dominio di gestione delle identità.
- Servizio PKI (Integrated Public Key Infrastructure): fornisce servizi PKI che firmano e pubblicano certificati per host e servizi, elenco di revoche di certificati (CRL) e servizi OCSP per il software che convalida il certificato pubblicato e un'API per richiedere, mostrare e trovare certificati.
Componenti di FreeIPA Server
FreeIPA Server è composto dai seguenti progetti Open Source.
- 389 Directory Server: archivio dati principale e fornisce un'infrastruttura di directory LDAPv3 multimaster completa.
- MIT Kerberos KDC: fornisce l'autenticazione Single-Sign-on.
- Sistema di certificazione dogtag: fornisce CA e RA per le funzioni di gestione dei certificati.
- ISC Bind DNS server : per la gestione dei nomi di dominio.
- Interfaccia utente Web/strumento da riga di comando ipa: utilizzato per gestire centralmente il controllo degli accessi, la delega delle attività amministrative e altre attività di amministrazione della rete.
- Server NTP
Requisiti di installazione del server FreeIPA
- Server con 4 GB di RAM: ho riscontrato installazioni non riuscite per 1 GB e 2 GB di RAM
- Nuova installazione del server RHEL/CentOS 8
- 2 vCPU
- Porte 443 e 80 non utilizzate da un'altra applicazione
- FQDN: risolvibile tramite il server DNS pubblico o privato
- 10 GB di spazio su disco
Vedi i dettagli del mio server di seguito.
$ free -h
total used free shared buff/cache available
Mem: 3.7Gi 185Mi 3.3Gi 8.0Mi 196Mi 3.3Gi
Swap: 2.0Gi 0B 2.0Gi
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel Core Processor (Skylake, IBRS)
Stepping: 3
CPU MHz: 1800.000
BogoMIPS: 3600.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
L3 cache: 16384K
NUMA node0 CPU(s): 0,1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat umip
$ df -h | grep root
/dev/mapper/rhel-root 17G 2.3G 15G 14% /
La sezione successiva discuterà i passaggi necessari per installare e configurare FreeIPA Server su RHEL/CentOS 8.
Passaggio 1: imposta il fuso orario e il nome host
È necessario disporre del fuso orario e del nome host corretti sul server prima di poter procedere. Il server FreeIPA eseguirà anche il servizio NTP e il fuso orario corretto garantirà che tu abbia l'ora corretta sul server.
- Come impostare il nome host e il fuso orario su RHEL/CentOS 8
Passaggio 2: installa i pacchetti server FreeIPA
RHEL IdM è una soluzione integrata per fornire identità gestita centralmente (utenti, host, servizi), autenticazione (SSO, 2FA) e autorizzazione (controllo dell'accesso host, ruoli utente SELinux, servizi).
Avevo fallito l'installazione con SELinux in modalità di applicazione, ti consiglio di impostarlo su permissivo o disabilitato.
sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
I pacchetti server e client FreeIPA sono distribuiti tramite il repository AppStream in RHEL/CentOS 8. Puoi verificare i moduli IdM disponibili.
$ sudo yum module list idm
Updating Subscription Management repositories.
Updating Subscription Management repositories.
Last metadata expiration check: 0:16:51 ago on Sat 29 Dec 2018 09:52:44 AM EAT.
Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
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 modulo Server, eseguire:
sudo yum module info idm:DL1
Poiché si tratta dell'installazione di FreeIPA Server, installa lo stream DL1 e quindi freeipa-server.
sudo yum -y install @idm:DL1
sudo yum -y install freeipa-server
Se desideri includere il servizio DNS, installa anche ipa-server-dns, bind e bind-dyndb-ldap:
sudo yum install ipa-server-dns bind-dyndb-ldap
Altri flussi utilizzati come dipendenze da questa installazione sono:
- 389-d
- httpd
- pki-core
- pki-deps
Passaggio 3: configurare il server IPA su RHEL/CentOS 8
La configurazione iniziale del server FreeIPA è interattiva e devi solo rispondere ad alcune domande e tutto il lavoro sporco viene svolto tramite uno script. Ti verrà chiesto di fornire:
- DNS integrato – se la tua zona DNS e i record SRV sono impostati correttamente sul tuo sistema, puoi procedere selezionando il valore predefinito “no”.
- Nome host: ottenuto per impostazione predefinita utilizzando il DNS inverso
- Nome di dominio: per impostazione predefinita in base al nome host
- Nome del realm: per impostazione predefinita in base al nome host
- Password per Directory Manager: un account amministratore per Directory Server
- Password per amministratore IPA: un superutente per IdM Server
Se non disponi di un server DNS per risolvere il nome host del server, modifica il file /etc/hosts
per includere il nome host e l'indirizzo IP.
$ sudo vi /etc/hosts
192.168.122.198 ipa.example.com
Confermare
[jmutai@rhel8 ~]$ ping -c 2 ipa.example.com
PING ipa.example.com (192.168.122.198) 56(84) bytes of data.
64 bytes from ipa.example.com (192.168.122.198): icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from ipa.example.com (192.168.122.198): icmp_seq=2 ttl=64 time=0.113 ms
--- ipa.example.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 30ms
rtt min/avg/max/mdev = 0.040/0.076/0.113/0.037 ms
Configura il nome host del server in modo che corrisponda al nome sopra:
export HNAME="ipa.example.com"
sudo hostnamectl set-hostname $HNAME --static
sudo hostname $HNAME
Non dimenticare di sostituire ipa.example.com
con il tuo nome host valido.
Quindi esegui il comando ipa-server-install per configurare il server IPA. Esegui come utente con privilegi sudo o come utente root.
sudo ipa-server-install
Se desideri configurare anche il servizio DNS, includi l'opzione –setup-dns :
sudo ipa-server-install --setup-dns
Output di esempio:
$ sudo ipa-server-install
The log file for this installation can be found in /var/log/ipaserver-install.log
This program will set up the IPA Server.
Version 4.7.1
This includes:
Configure a stand-alone CA (dogtag) for certificate management
Configure the NTP client (chronyd)
Create and configure an instance of Directory Server
Create and configure a Kerberos Key Distribution Center (KDC)
Configure Apache (httpd)
Configure the KDC to enable PKINIT
To accept the default shown in brackets, press the Enter key.
Do you want to configure integrated DNS (BIND)? [no]: <yes/no>
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
.
Example: master.example.com.
Server host name [ipa.example.com]: <Set/Confirm Hostname>
The domain name has been determined based on the host name.
Please confirm the domain name [example.com]: <Confirm domain name>
The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.
Please provide a realm name [EXAMPLE.COM]: <Confirm Real name>
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and has full access
to the Directory for system management tasks and will be added to the
instance of directory server created for IPA.
The password must be at least 8 characters long.
Directory Manager password: <Enter Password>
Password (confirm): <Confirm Password>
The IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.
IPA admin password: <Enter Password>
Password (confirm): <Confirm Password>
The IPA Master Server will be configured with:
Hostname: ipa.example.com
IP address(es): 192.168.122.198
Domain name: example.com
Realm name: EXAMPLE.COM
The CA will be configured with:
Subject DN: CN=Certificate Authority,O=EXAMPLE.COM
Subject base: O=EXAMPLE.COM
Chaining: self-signed
Continue to configure the system with these values? [no]: yes
The following operations may take some minutes to complete.
Please wait until the prompt is returned.
.....
Questo sarà:
- Configurare una CA autonoma (dogtag) per la gestione dei certificati
- Configurare il client NTP (chronyd)
- Creare e configurare un'istanza di Directory Server
- Creare e configurare un centro di distribuzione delle chiavi Kerberos (KDC)
- Configura Apache (httpd)
- Configurare il KDC per abilitare PKINIT
Un'installazione riuscita dovrebbe fornire un output simile al seguente.
....
Restarting the KDC
Configuring client side components
This program will set up IPA client.
Version 4.7.1
Using existing certificate '/etc/ipa/ca.crt'.
Client hostname: ipa.example.com
Realm: EXAMPLE.COM
DNS Domain: example.com
IPA Server: ipa.example.com
BaseDN: dc=example,dc=com
Configured sudoers in /etc/nsswitch.conf
Configured /etc/sssd/sssd.conf
Systemwide CA database updated.
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
Setup complete
Passaggio 4: configura Firewalld per FreeIPA
Si consiglia di eseguire il servizio firewall e consentire l'accesso alle porte utilizzate dai servizi server FreeIPA.
sudo firewall-cmd --add-service={http,https,dns,ntp,freeipa-ldap,freeipa-ldaps} --permanent
sudo firewall-cmd --reload
Passaggio 5: accedi all'interfaccia Web di FreeIPA
L'installazione del tuo server FreeIPA è pronta. Accedi all'interfaccia utente web su https://ipa.example.com
.
Accedi con il nome utente admin
e la password amministratore IPA
forniti durante l'installazione.
Dovrebbe esserti presentata la dashboard amministrativa di FreeIPA. L'amministrazione del server FreeIPA può essere eseguita dall'interfaccia utente web o dalla riga di comando.
Passaggio 6: proteggi il server FreeIPA con Let's Encrypt SSL
Dopo l'installazione ti consigliamo di utilizzare SSL sicuro sul tuo server FreeIPA. Se in esecuzione su un'istanza pubblica, segui la nostra guida nel collegamento successivo:
- Proteggi il server FreeIPA con il certificato SSL Let's Encrypt
Passaggio 7: utilizzo della CLI di FreeIPA
Per utilizzare il comando ipa, devi prima ottenere un ticket Kerberos.
$ sudo kinit admin
Password for [email :
Controlla le informazioni sulla scadenza del biglietto utilizzando klist.
$ sudo 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/[email
Imposta la shell predefinita dell'utente su /bin/bash
.
$ sudo ipa config-mod --defaultshell=/bin/bash
Maximum username length: 32
Home directory base: /home
Default shell: /bin/bash
Default users group: ipausers
Default e-mail domain: example.com
Search time limit: 2
Search size limit: 100
User search fields: uid,givenname,sn,telephonenumber,ou,title
Group search fields: cn,description
Enable migration mode: FALSE
Certificate Subject base: O=EXAMPLE.COM
Password Expiration Notification (days): 4
Password plugin features: AllowNThash, KDC:Disable Last Success
SELinux user map order: guest_u:s0$xguest_u:s0$user_u:s0$staff_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023
Default SELinux user: unconfined_u:s0-s0:c0.c1023
Default PAC types: MS-PAC, nfs:NONE
IPA masters: ipa.example.com
IPA CA servers: ipa.example.com
IPA CA renewal master: ipa.example.com
IPA master capable of PKINIT: ipa.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
Per elencare gli account utente aggiunti, esegui:
$ sudo ipa user-find
---------------
2 users matched
---------------
User login: admin
Last name: Administrator
Home directory: /home/admin
Login shell: /bin/bash
Principal alias: [email
UID: 1201400000
GID: 1201400000
Account disabled: False
User login: test
First name: Test
Last name: User
Home directory: /home/test
Login shell: /bin/bash
Principal name: [email
Principal alias: [email
Email address: [email
UID: 1201400001
GID: 1201400001
Account disabled: False
----------------------------
Number of entries returned 2
----------------------------
Prova ad accedere come utente test
. Al tuo primo accesso ti verrà chiesto di modificare la password:
$ 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
Disinstallare FreeIPA Server su RHEL/CentOS 8
Per disinstallare FreeIPA Server, eseguire:
$ sudo ipa-server-install --uninstall
This is a NON REVERSIBLE operation and will delete all data and configuration!
It is highly recommended to take a backup of existing data and configuration using ipa-backup utility before proceeding.
Are you sure you want to continue with the uninstall procedure? [no]: yes
If this server is the last instance of CA, KRA, or DNSSEC master, uninstallation may result in data loss.
Are you sure you want to continue with the uninstall procedure? [no]: yes
Shutting down all IPA services
Unconfiguring CA
Unconfiguring web server
Unconfiguring krb5kdc
Unconfiguring kadmin
Unconfiguring directory server
.......
Hai installato con successo FreeIPA Server su CentOS/RHEL 8. La prossima lettura è attiva
- Come installare il client FreeIPA su CentOS/RHEL 8.
Altri articoli precedenti di FreeIPA.
- Come installare FreeIPA Server su CentOS 7
- Come reimpostare la password amministratore di FreeIPA come utente root
- Come configurare il client FreeIPA su Ubuntu/CentOS 7.
- Come configurare la replica FreeIPA su Ubuntu/CentOS
Se hai bisogno dell'autenticazione LDAP sul tuo server GitLab, leggi:
- Come configurare l'autenticazione GitLab FreeIPA
Come unire la macchina RHEL 8/CentOS 8 a Windows AD