Vous êtes sur la page 1sur 8

I. Installation et configuration de KDC Kerberos I.1.

Installation

Nous utilisons la commande apt-cache search kerberos pour lister les paquets disponibles. debian:~#apt-cache search kerberos krb5-admin-server - MIT Kerberos master server (kadmind) krb5-clients - Secure replacements for ftp, telnet and rsh using MIT Kerberos krb5-config - Configuration files for Kerberos Version 5 krb5-doc - Documentation for MIT Kerberos krb5-ftpd - Secure FTP server supporting MIT Kerberos krb5-kdc - MIT Kerberos key server (KDC) krb5-rsh-server - Secure replacements for rshd and rlogind using MIT Kerberos krb5-telnetd - Secure telnet server supporting MIT Kerberos krb5-user - Basic programs to authenticate using MIT Kerberos Nous installons tous les paquets ncessaires : debian:~#apt-get install krb5-kdc krb5-admin-server krb5-user

I.2.

Configuration de base de Kerberos

Nous modifions les fichiers de configuration : /etc/kdb5.conf [libdefaults] default_realm = B2.R2SI.COM B2.R2SI.COM = { kdc = 192.168.100.1 admin_server = 192.168.100.1 default_domain = 192.168.100.1 } Nous modifions aussi le fichier /etc/krb5kdc/kdc.conf : B2.R2SI.COM = { database_name = /var/lib/krb5kdc/principal admin_keytab = FILE:/etc/krb5kdc/kadm5.keytab ....
Page 1 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

Nous tapons ensuite la commande kdb5_util create -r B2.R2SI.COM s pour crer le royaume kerberos : debian:/etc/krb5kdc# kdb5_util create -r B2.R2SI.COM -s Loading random data Initializing database '/var/lib/krb5kdc/principal' for realm 'B2.R2SI.COM', master key name 'K/M@B2.R2SI.COM' You will be prompted for the database Master Password. It is important that you NOT FORGET this password. Enter KDC database master key: Re-enter KDC database master key to verify:

I.3.

Dfinition de politiques

On utilise la commande kadmin.local pour configurer notre royaume kerberos : debian:~# kadmin.local Authenticating as principal root/admin@B2.R2SI.COM with password. La commande list_requests permet davoir la liste des commandes disponibles. Pour dfinir les politiques demandes, on se rend compte quil faut utiliser la commande add_policy : kadmin.local: add_policy -maxlife "60 days" -minlength "12" admin kadmin.local: add_policy -maxlife "45 days" -minlength "6" users Rajout de admin On rajoute lutilisateur admin dans le groupe admin : kadmin.local: addprinc -policy admin admin/admin@B2.R2SI.COM Enter password for principal "admin/admin@B2.R2SI.COM": Re-enter password for principal "admin/admin@B2.R2SI.COM": add_principal: Password is too short while creating "admin/admin@B2.R2SI.COM". On remarque que le mot de passe renter est trop court admin doit respecter la politique de admin , et donc le mot de pass doit avoir plus de 12 caractres. Rajout de admin et b On rajoute les administrateurs admin et b : kadmin.local: addprinc -policy admin admin/admin@B2.R2SI.COM Enter password for principal "admin/admin@B2.R2SI.COM":

Page 2 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

Re-enter password for principal "admin/admin@B2.R2SI.COM": Principal "admin/admin@B2.R2SI.COM" created. kadmin.local: addprinc -policy admin b/admin@B2.R2SI.COM Enter password for principal "b/admin@B2.R2SI.COM": Re-enter password for principal "b/admin@B2.R2SI.COM": Principal "b/admin@B2.R2SI.COM" created. On vrifie que les administrateurs ont bien t rajouts : kadmin.local: listprincs K/M@B2.R2SI.COM b/admin@B2.R2SI.COM kadmin/admin@B2.R2SI.COM kadmin/changepw@B2.R2SI.COM kadmin/debian@B2.R2SI.COM kadmin/history@B2.R2SI.COM krbtgt/B2.R2SI.COM@B2.R2SI.COM admin/admin@B2.R2SI.COM Rajout de Martha, John et Lex On rajoute les utilisateurs Martha, John et Lex : kadmin.local: addprinc -policy users martha@B2.R2SI.COM Enter password for principal "martha@B2.R2SI.COM": Re-enter password for principal "martha@B2.R2SI.COM": Principal "martha@B2.R2SI.COM" created. kadmin.local: addprinc -policy users john@B2.R2SI.COM Enter password for principal "john@B2.R2SI.COM": Re-enter password for principal "john@B2.R2SI.COM": Principal "john@B2.R2SI.COM" created. kadmin.local: addprinc -policy users lex@B2.R2SI.COM Enter password for principal "lex@B2.R2SI.COM": Re-enter password for principal "lex@B2.R2SI.COM": Principal "lex@B2.R2SI.COM" created. Configuration des ACL On cre le fichier /etc/krb5kdc/kadm5.acl dans lequel on dfinit les ACL : admin/admin@B2.R2SI.COM * b/admin@B2.R2SI.COM c Admin a tous les droits (*) et b a uniquement le droit de changer les mots de passe. Connexion distance On configure kerberos sur la machine distante. Dans le fichier : /etc/kdb5.conf on rajoute : B2.R2SI.COM = { kdc = 192.168.100.1 admin_server = 192.168.100.1 }

Page 3 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

On utilise la commande kinit pour se connecter notre serveur et gnrer un tecket : debian:/etc# kinit lex@B2.R2SI.COM Password for lex@B2.R2SI.COM: On utilise la commande klist distance: debian:/etc# klist Ticket cache: FILE:/tmp/krb5cc_0 Default principal: lex@B2.R2SI.COM Valid starting Expires Service principal 12/08/08 04:19:29 12/08/08 14:19:29 krbtgt/B2.R2SI.COM@B2.R2SI.COM renew until 12/09/08 04:19:14 Kerberos 4 ticket cache: /tmp/tkt0 klist: You have no tickets cached On va voir dans /tmp le jeton Kerberos : debian:/etc# ls /tmp/ coucou kde-root krb5cc_0 ksocket-root ssh-jlYlzP2932 Une fois la session termine le jeton Kerberos est toujours dans /tmp. Pour des questions de scurit, nous prconisons donc de le dtruire avec kdestroy : debian:/etc# kdestroy debian:/etc# klist klist: No credentials cache found (ticket cache FILE:/tmp/krb5cc_0) Kerberos 4 ticket cache: /tmp/tkt0 klist: You have no tickets cached

II.
I.

Configuration des services kerberized

Red Hat et Fedora vous permettent d'activer et de dsactiver Kerberos dmons de service rseau par l'intermdiaire des fichiers de configuration dans le rpertoire / etc / xinetd.d. Les fichiers suivants doivent tre prsents: 1) klogin 2) eklogin 3) krb5-telnet 4) gssftp 5) kshell Tous ces services peuvent tre protgs par les TCP wrappers. Cela peut tre fait en ditant le fichier / etc / hosts.allow et / ou / etc /

Page 4 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

hosts.deny fichiers de configuration. Votre configuration iptables peut galement tre utilise pour restreindre l'accs aux services. Les tapes : tape 1: Ajouter un principal hte nouveau la base de donnes Kerberos De la CLI kadmin (qui peut tre invoque sur n'importe quel client DAS ou sur DAS-M), ajoutez le principal nouvel hte pour le serveur d'application la base de donnes Kerberos. Il est probablement plus facile d'excuter cette commande partir du serveur d'application, puisque vous aurez besoin d'ajouter la cl de l'hte de la keytab sur le serveur d'application de toute faon. Le nom principal de l'hte doit contenir le nom de domaine complet du serveur kadmin: addprinc -randkey host/post.b2.r2si.com NOTICE: no policy specified for host/post.b2.r2si.com@B2.R2SI.COM; assigning "default" Principal " host/post.b2.r2si.com@B2.R2SI.COM" created.

tape 2: gnrer le fichier keytab :

kadmin: ktadd host/post.b2.r2si.com tape 3 : Configuration de /etc/hosts.allow de TCP Wrappers

#
# hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # # Secure the Portmapper to our LAN portmap : 127. 192.168.100. : ALLOW portmap : ALL : DENY ### Kerberized services ###

Page 5 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

## limit KLOGIN and EKLOGIN connections to local LAN and loopback klogind : 127. 192.168.100. : ALLOW klogind : ALL : DENY ## limit TELNET connections to local LAN and loopback telnetd : 127. 10192.168.100. : ALLOW telnetd : ALL : DENY ## limit Kerberized FTP connections to local LAN and loopback ftpd : 127. 192.168.100. : ALLOW ftpd : ALL : DENY ## limit RSH/RCP connections to local LAN and loopback kshd : 192.168.100. : ALLOW kshd : ALL : DENY

tape 4: Activer les services en ditant les fichiers de configuration dans / etc / xinetd.d. Dans les fichiers: /etc/xinetd .d/gssftp /etc/xinetd.d/krb5 .telnet /etc/xinetd.d/eklogin: On modifier la ligne enable =yes par enable =no pour activer les services. tape 5: Restart xinetd
[root@post xinetd.d]# /etc/init.d/xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ]

On utilise netsat pour afficher les services activ :


[root@post xinetd.d]# netstat -ta | grep LISTEN tcp 0 0 *:kshell *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN tcp 0 0 *:ftp *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 *:telnet *:* LISTEN tcp 0 0 *:eklogin *:* LISTEN tcp 0 0 *:klogin *:* LISTEN

On ajoute les machines qui contiennent les services dans base kerberos comme des principales. tape 1 et 2 telle que le nom host reprsente le nom de service kerberis Et on dplace le fichier krb5.keytab dans les machine client de rseau kerberis par la commande scp, et on modifi les droit dutilisation de ce fichier.

Page 6 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

Exemples d'utilisation des services Kerberos


Le service Kerberos TELNET est similaire au service Kerberos RLOGIN. Il ne crypter les informations d'authentification par dfaut, le reste de la session est envoy "en clair". Vous devez utiliser l'option-a utiliser TELNET dans ce mode. Si vous ne spcifiez pas l'option-a (qui tente la connexion automatique), la session va chouer. Pour crypter toute la session, vous devez utiliser l'option-x. Ci-dessous, vous verrez des exemples de tous les trois scnarios:

[kitty@ushas kitty]$ telnet post


Trying 192.168.100.1... Connected to post.b2.r2si.com (192.168.100.4). Escape character is '^]'. telnetd: No authentication provided. Connection closed by foreign host.

[kitty@ushas kitty]$ telnet -a post


Trying 192.168.100.1... Connected to post.b2.r2si.com (192.168.100.4). Escape character is '^]'. [ Kerberos V5 accepts you as ``kitty@B2.R2SI.COM'' ] Last login: Tue Jun 15 09:28:47 from ushas ###################### # # # POST # # # ###################### Connection closed by foreign host.

FTP Kerberis :
Pour connecter au serveur ftp en utilisant kerberos :
[kitty@ushas kitty]$ ftp -x post Connected to post.kerb.org. 220 post.kerb.org FTP server (Version 5.60) ready. 334 Using authentication type GSSAPI; ADAT must follow GSSAPI accepted as authentication type GSSAPI authentication succeeded 200 Data channel protection level set to private. Name (post:kitty): 232 GSSAPI user kitty@KERB.ORG is authorized as kitty Remote system type is UNIX. Using binary mode to transfer files. ftp> cd ISO 250 CWD command successful. ftp> ls

Page 7 sur 8

Romain REBOTIER Jean-Marc DUFOUR

CS 530 TP2 Novembre 2008 P2009

227 Entering Passive Mode (10,10,22,41,181,173) 150 Opening ASCII mode data connection for /bin/ls. total 95336 -rw------1 labuser 46399488 Jun 15 12:58 cd-puppy.iso -rw-rw-r-1 labuser 51109888 Jun 15 12:58 damnsmall-0.5.2.iso -rw-rw-r-1 labuser 54 Jun 15 12:58 damnsmall-0.5.2.md5.txt 226 Transfer complete. ftp> mget damnsmall* mget damnsmall-0.5.2.iso? y 227 Entering Passive Mode (10,10,22,41,181,180) 150 Opening BINARY mode data connection for damnsmall-0.5.2.iso (51109888 bytes). 226 Transfer complete. 51109888 bytes received in 16 seconds (3.1e+03 Kbytes/s) mget damnsmall-0.5.2.md5.txt? y 227 Entering Passive Mode (10,10,22,41,181,184) 150 Opening BINARY mode data connection for damnsmall-0.5.2.md5.txt (54 bytes). 226 Transfer complete. 54 bytes received in 0.017 seconds (3.2 Kbytes/s) ftp> quit 221 Goodbye. [kitty@ushas kitty]$

Page 8 sur 8

Vous aimerez peut-être aussi