cn:ccr:formazione:centos7:2018-11:autnx
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
cn:ccr:formazione:centos7:2018-11:autnx [2018/11/28 15:54] – enrico@infn.it | cn:ccr:formazione:centos7:2018-11:autnx [2018/11/28 15:59] (current) – enrico@infn.it | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Kerberos KDC (soluzioni) ====== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Preparazione del sistema ===== | ||
+ | |||
+ | [root@kdc ~]$ yum install krb5-server | ||
+ | |||
+ | ===== Configurazione client e librerie K5 ===== | ||
+ | [root@kdc ~]$ vi / | ||
+ | < | ||
+ | # Configuration snippets may be placed in this directory as well | ||
+ | includedir / | ||
+ | |||
+ | [logging] | ||
+ | | ||
+ | kdc = FILE:/ | ||
+ | | ||
+ | |||
+ | [libdefaults] | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | rdns = false | ||
+ | | ||
+ | | ||
+ | |||
+ | [realms] | ||
+ | | ||
+ | kdc = kdc.example.com | ||
+ | admin_server =kdc.example.com | ||
+ | } | ||
+ | |||
+ | [domain_realm] | ||
+ | | ||
+ | | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Configurazione del KDC (Key Distribution Center) ===== | ||
+ | |||
+ | [root@kdc ~]# vi / | ||
+ | |||
+ | < | ||
+ | [kdcdefaults] | ||
+ | | ||
+ | | ||
+ | |||
+ | [realms] | ||
+ | | ||
+ | # | ||
+ | acl_file = / | ||
+ | dict_file = / | ||
+ | admin_keytab = / | ||
+ | supported_enctypes = aes256-cts: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Creazione del database per il REALM EXAMPLE.COM ===== | ||
+ | |||
+ | |||
+ | |||
+ | [root@kdc ~]$ kdb5_util create -s | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Avviamento dei servizi che caratterizzano un KDC ===== | ||
+ | |||
+ | [root@kdc ~]$ systemctl start krb5kdc | ||
+ | |||
+ | [root@kdc ~]$ systemctl status krb5kdc | ||
+ | |||
+ | [root@kdc ~]$ systemctl start kadmin | ||
+ | |||
+ | [root@kdc ~]$ systemctl status kadmin | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Creare il primo utente amministratore del REALM ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ kadmin.local | ||
+ | |||
+ | |||
+ | kadmin.local: | ||
+ | |||
+ | kadmin.local: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Impostazione delle ACL di amministratore ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ vi / | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Creare un utente non privilegiato ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ kinit admin/admin | ||
+ | |||
+ | [root@kdc ~]$ kadmin | ||
+ | |||
+ | kadmin: addprinc user1 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Creare la chiave di servizio per la macchina kdc.example.com nel database del KDC ===== | ||
+ | |||
+ | |||
+ | kadmin: addprinc -randkey host/ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Inserire la chiave di servizio nella keytable del server applicativo ===== | ||
+ | |||
+ | |||
+ | |||
+ | kadmin: ktadd host/ | ||
+ | |||
+ | kadmin: exit | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Kerberizzazione del servizio ssh mediante le librerie GSSAPI ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~] vi / | ||
+ | |||
+ | GSSAPIAuthentication yes | ||
+ | |||
+ | GSSAPICleanupCredentials yes (elimina il ticket alla chiusura della sessione ssh) | ||
+ | |||
+ | [root@kdc ~]$ service sshd restart | ||
+ | |||
+ | [root@kdc ~]$ vi / | ||
+ | |||
+ | GSSAPIDelegateCredentials yes | ||
+ | |||
+ | ===== Inserimento di un utente nel database di autorizzazione | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ adduser -m user1 | ||
+ | |||
+ | |||
+ | |||
+ | ===== Test di utilizzo dell’account Kerberos con ssh ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ kinit user1 | ||
+ | |||
+ | [root@kdc ~]$ klist | ||
+ | |||
+ | [root@kdc ~]$ ssh user1@kdc.example.com | ||
+ | |||
+ | [user1@kdc ~]$ klist (la cache delle credenziali è vuota) | ||
+ | |||
+ | [user1@kdc ~]$ exit | ||
+ | |||
+ | [root@kdc ~]$ kinit -f user1 | ||
+ | |||
+ | [root@kdc ~]$ klist -f | ||
+ | |||
+ | [root@kdc ~]$ ssh user1@kdc.example.com | ||
+ | |||
+ | [user1@kdc ~]$ klist -f (notare che il TGT è ancora forwardabile) | ||
+ | |||
+ | [user1@kdc ~]$ exit | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||