User Tools

Site Tools


cn:ccr:formazione:centos7:2018-11:autnx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
cn:ccr:formazione:centos7:2018-11:autnx [2018/11/28 15:54] enrico@infn.itcn: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 /etc/krb5.conf
 +<code>
 +# Configuration snippets may be placed in this directory as well
 +includedir /etc/krb5.conf.d/
 +
 +[logging]
 + default = FILE:/var/log/krb5libs.log
 + kdc = FILE:/var/log/krb5kdc.log
 + admin_server = FILE:/var/log/kadmind.log
 +
 +[libdefaults]
 + dns_lookup_realm = false
 + dns_lookup_kdc = false
 + ticket_lifetime = 24h
 + renew_lifetime = 7d
 + forwardable = true
 + rdns = false
 + default_realm = EXAMPLE.COM
 + default_ccache_name = KEYRING:persistent:%{uid}
 +
 +[realms]
 + EXAMPLE.COM = {
 +  kdc = kdc.example.com
 +  admin_server =kdc.example.com
 + }
 +
 +[domain_realm]
 + .example.com = EXAMPLE.COM
 + example.com = EXAMPLE.COM
 +
 +</code>
 +
 +===== Configurazione del KDC (Key Distribution Center) =====
 +
 +[root@kdc ~]# vi /var/kerberos/krb5kdc/kdc.conf 
 +
 +<code>
 +[kdcdefaults]
 + kdc_ports = 88
 + kdc_tcp_ports = 88
 +
 +[realms]
 + EXAMPLE.COM = {
 +  #master_key_type = aes256-cts
 +  acl_file = /var/kerberos/krb5kdc/kadm5.acl
 +  dict_file = /usr/share/dict/words
 +  admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
 +  supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal camellia256-cts:normal camellia128-cts:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
 + }
 +</code>
 +
 +===== 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: listprincs
 +
 +kadmin.local: addprinc admin/admin
 +
 +
 +
 +
 +
 +===== Impostazione delle ACL di amministratore =====
 +
 +
 +[root@kdc ~]$ vi /var/kerberos/krb5kdc/kadm5.acl
 +
 +
 +
 +
 +===== 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/kdc.example.com
 +
 +
 +
 +===== Inserire la chiave di servizio nella keytable del server applicativo =====
 +
 +
 +
 +kadmin: ktadd host/kdc.example.com
 +
 +kadmin: exit
 +
 +
 +
 +
 +
 +===== Kerberizzazione del servizio ssh mediante le librerie GSSAPI =====
 +
 +
 +[root@kdc ~] vi /etc/ssh/sshd_config
 +
 +GSSAPIAuthentication yes
 +
 +GSSAPICleanupCredentials yes  (elimina il ticket alla chiusura della sessione ssh)
 +
 +[root@kdc ~]$ service sshd restart
 +
 +[root@kdc ~]$ vi /etc/ssh/ssh_config
 +
 +GSSAPIDelegateCredentials yes   (abilita il client ssh al forwarding del ticket)
 +
 +===== 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
 +
 + 
 +
 +
 +
 +
 +
 +
 +
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki