This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cn:ccr:aai:howto:krb5-lab-install [2009/12/01 16:39] roberto.lulli@roma2.infn.it |
cn:ccr:aai:howto:krb5-lab-install [2009/12/02 08:48] (current) roberto.lulli@roma2.infn.it |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Installazione Realm Kerberos in Laboratorio ====== | ||
+ | |||
+ | ** NOTA BENE ** | ||
+ | Gli esempi citati in questa guida si intendono per MIT Kerberos 5 versione 1.6 su Scientific Linux 5.1. | ||
+ | |||
+ | ===== Descrizione dell' | ||
+ | |||
+ | Nel nostro laboratorio abbiamo un dominio **// | ||
+ | |||
+ | |||
+ | kdc.example.com: | ||
+ | |||
+ | client.example.com: | ||
+ | |||
+ | server.example.com: | ||
+ | |||
+ | |||
+ | lab1.d1.example.com: | ||
+ | |||
+ | lab2.d2.example.com: | ||
+ | |||
+ | .... | ||
+ | |||
+ | .... | ||
+ | |||
+ | .... | ||
+ | |||
+ | labn.dn.example.com: | ||
+ | |||
+ | Per necessità logistiche gli studenti implementeranno il server kdc, il server applicativo ed il client sulla stessa macchina. | ||
+ | |||
+ | ===== Preparazione del sistema ===== | ||
+ | |||
+ | [root@kdc ~]$ //yum install krb5-server// | ||
+ | |||
+ | ===== Configurazione client e librerie K5 ===== | ||
+ | [root@client ~]$ //vi / | ||
+ | < | ||
+ | [logging] | ||
+ | | ||
+ | kdc = FILE:/ | ||
+ | | ||
+ | |||
+ | [libdefaults] | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | [realms] | ||
+ | | ||
+ | kdc = kerberos.dn.example.com: | ||
+ | admin_server = kerberos.dn.example.com: | ||
+ | default_domain = dn.example.com | ||
+ | } | ||
+ | |||
+ | [domain_realm] | ||
+ | | ||
+ | | ||
+ | |||
+ | [appdefaults] | ||
+ | pam = { | ||
+ | debug = false | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Configurazione del KDC (Key Distribution Center) ===== | ||
+ | |||
+ | [root@kdc ~]$ //vi / | ||
+ | |||
+ | < | ||
+ | [kdcdefaults] | ||
+ | | ||
+ | | ||
+ | |||
+ | [realms] | ||
+ | | ||
+ | # | ||
+ | acl_file = / | ||
+ | dict_file = / | ||
+ | admin_keytab = / | ||
+ | supported_enctypes = des3-hmac-sha1: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Creazione del database per il REALM DN.EXAMPLE.COM ===== | ||
+ | |||
+ | |||
+ | |||
+ | [root@kdc ~]$ //kdb5_util create -s// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Avviamento dei servizi che caratterizzano un KDC ===== | ||
+ | |||
+ | [root@kdc ~]$ //service krb5kdc start// | ||
+ | |||
+ | [root@kdc ~]$ //service kadmin start// | ||
+ | |||
+ | [root@kdc ~]$ //service krb524 start// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Creare il primo utente amministratore del REALM ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ // | ||
+ | |||
+ | |||
+ | kadmin.local: | ||
+ | |||
+ | kadmin.local: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Impostazione delle ACL di amministratore ===== | ||
+ | |||
+ | |||
+ | [root@labn ~]$ //vi / | ||
+ | |||
+ | |||
+ | |||
+ | ===== Creare un utente non privilegiato ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ //kinit admin/ | ||
+ | |||
+ | [root@kdc ~]$ //kadmin// | ||
+ | |||
+ | kadmin: //addprinc user1// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Creare la chiave di servizio per la macchina labn.dn.example.com nel database del KDC ===== | ||
+ | |||
+ | [root@kdc ~]$ kadmin | ||
+ | |||
+ | kadmin: //addprinc -randkey host/ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Inserire la chiave di servizio nella keytable del server applicativo ===== | ||
+ | |||
+ | [root@server ~]$ kinit admin/admin | ||
+ | |||
+ | [root@server ~]$ kadmin | ||
+ | |||
+ | kadmin: //ktadd host/ | ||
+ | |||
+ | kadmin: //exit// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Kerberizzazione del servizio ssh mediante le librerie GSSAPI ===== | ||
+ | |||
+ | |||
+ | [root@server ~] //vi / | ||
+ | |||
+ | GSSAPIAuthentication yes | ||
+ | |||
+ | GSSAPICleanupCredentials yes (elimina il ticket alla chiusura della sessione ssh) | ||
+ | |||
+ | [root@server ~]$ //service sshd restart// | ||
+ | |||
+ | ===== Kerberizzazione del client ===== | ||
+ | |||
+ | |||
+ | [root@client ~]$ //vi / | ||
+ | |||
+ | GSSAPIDelegateCredentials yes | ||
+ | |||
+ | |||
+ | ===== Inserimento di un utente nel database di autorizzazione | ||
+ | |||
+ | |||
+ | [root@server ~]$ //adduser -m user1// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Test di utilizzo dell’account Kerberos con ssh ===== | ||
+ | |||
+ | |||
+ | [root@client ~]$ //kinit -F user1// | ||
+ | |||
+ | [root@client ~]$ //klist// | ||
+ | |||
+ | [root@client ~]$ //ssh user1@labn.dn.example.com// | ||
+ | |||
+ | [user1@server ~]$ // | ||
+ | |||
+ | [user1@server ~]$ //exit// | ||
+ | |||
+ | [root@client ~]$ // | ||
+ | |||
+ | [root@client ~]$ //kinit user1// | ||
+ | |||
+ | [root@client ~]$ //klist -f// | ||
+ | |||
+ | [root@client ~]$ //ssh user1@labn.dn.example.com// | ||
+ | |||
+ | [user1@server ~]$ //klist -f// (notare che il TGT è ancora forwardabile) | ||
+ | |||
+ | [user1@server ~]$ //exit// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Configurazione dei moduli PAM per l’autenticazione con Kerberos 5 ===== | ||
+ | |||
+ | |||
+ | [root@server ~]$ authconfig --update --enablekrb5 | ||
+ | [root@server ~]$ vi / | ||
+ | |||
+ | la riga delle pam dovrà apparire come segue: | ||
+ | |||
+ | auth sufficient | ||
+ | |||
+ | |||
+ | |||
+ | ===== Verifica del telnet kerberizzato ===== | ||
+ | |||
+ | |||
+ | [root@server ~]$ //vi / | ||
+ | |||
+ | [root@server ~]$ //service xinetd restart// | ||
+ | |||
+ | [root@client ~]$ //telnet -f -a -l user1 labn.dn.example.com// | ||
+ | |||
+ | [user1@server ~]$ //exit// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Configurazione del DNS del dominio example.com per i servizi Kerberos 5 ===== | ||
+ | |||
+ | |||
+ | [root@kdc ~]$ vi / | ||
+ | |||
+ | _kerberos | ||
+ | |||
+ | _kerberos._udp | ||
+ | |||
+ | _kerberos._tcp | ||
+ | |||
+ | _kerberos-master._udp | ||
+ | |||
+ | _kerberos-adm._tcp | ||
+ | |||
+ | _kpasswd._udp | ||
+ | |||
+ | |||
+ | Inserire inoltre il CANME: | ||
+ | |||
+ | kerberos | ||
+ | |||
+ | |||
+ | ===== Configurazione della Cross Realm Authentication ===== | ||
+ | |||
+ | ==== Cross autenticazione diretta tra i domini DN.EXAMPLE.COM e DM.EXAMPLE.COM ==== | ||
+ | |||
+ | |||
+ | **su entrambi i kdc dei domini N e M:** | ||
+ | |||
+ | aggiungere i principal krbtgt/ | ||
+ | |||
+ | kadmin: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== Cross autenticazione gerarchica tra i domini N e M passando per EXAMPLE.COM ==== | ||
+ | |||
+ | |||
+ | |||
+ | Si tratta semplicemente di fare cross autenticazione diretta tra il kdc di EXAMPLE.COM e i kdc dei domini DN.EXAMPLE.COM e DM.EXAMPLE.COM | ||
+ | |||
+ | |||
+ | Quindi sui kdc di ogni dominio DN.EXAMPLE.COM dobbiamo aggiungere i due principal krbtgt/ | ||
+ | e questi stessi principal vanno aggiunti sul kdc.example.com facendo attenzione che **le password relative a stessi principal creati sui due kdc diversi siano identiche!** | ||
+ | |||
+ | **Scegliamo tutti la password:** //klab// **per tutte le chiavi su tutti i domini** | ||
+ | |||
+ | [root@kdc ~]$ // | ||
+ | |||
+ | kadmin: //addprinc krbtgt/ | ||
+ | |||
+ | kadmin: //addprinc krbtgt/ | ||
+ | |||
+ | kadmin: // | ||
+ | |||
+ | Lo stesso andrà fatto sui labn e labm. | ||
+ | |||
+ | ==== Configurazione del client per la cross authentication ==== | ||
+ | |||
+ | [root@client ~]$ //vi / | ||
+ | |||
+ | dns_lookup_kdc = true | ||
+ | |||
+ | ==== Autorizzazione in ssh ==== | ||
+ | |||
+ | [root@labn ~]$ //vi / | ||
+ | |||
+ | user1@DM.EXAMPLE.COM | ||
+ | |||
+ | [root@labn ~]$ chown user1:user1 / | ||
+ | |||
+ | A questo punto l' | ||
+ | |||
+ | [root@labm ~]$ ssh user1@labn.dn.example.com | ||
+ | |||
+ | [user1@labn ~]$ | ||
+ | |||
+ | |||
+ | ===== Link utili ===== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// |