Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
320kerberos:50_apache [le 15/02/2010 à 09:16] – prof | 320kerberos:50_apache [le 30/06/2018 à 15:58] (Version actuelle) – prof | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Configuration d' | ====== Configuration d' | ||
Le serveur '' | Le serveur '' | ||
- | * un système de synchronisation de l' | + | * un système de synchronisation de l' |
* un serveur apache classique ; | * un serveur apache classique ; | ||
* les composants kerberos nécessaires. | * les composants kerberos nécessaires. | ||
+ | |||
===== Installation d' | ===== Installation d' | ||
Nous installons un Apache « prefork » classique : | Nous installons un Apache « prefork » classique : | ||
Ligne 73: | Ligne 74: | ||
</ | </ | ||
+ | Cette opération a permis la création d'une clé secrète qui doit être partagée avec le service http situé sur '' | ||
+ | |||
+ | '' | ||
+ | < | ||
+ | kerberos:~# kadmin -p chris/admin | ||
+ | Authenticating as principal chris/admin with password. | ||
+ | Password for chris/ | ||
+ | kadmin: | ||
+ | Entry for principal HTTP/ | ||
+ | Entry for principal HTTP/ | ||
+ | Entry for principal HTTP/ | ||
+ | Entry for principal HTTP/ | ||
+ | kadmin: | ||
+ | </ | ||
+ | |||
+ | Nous avons créé dans le répertoire courant un fichier nommé '' | ||
+ | |||
+ | < | ||
+ | kerberos:~# klist -e -k krb5-http.keytab | ||
+ | Keytab name: WRFILE: | ||
+ | KVNO Principal | ||
+ | ---- -------------------------------------------------------------------------- | ||
+ | 3 HTTP/ | ||
+ | 3 HTTP/ | ||
+ | 3 HTTP/ | ||
+ | 3 HTTP/ | ||
+ | </ | ||
+ | Il nous faut déménager **par un moyen sécurisé** ce fichier sur '' | ||
+ | < | ||
+ | kerberos:~# scp krb5-http.keytab | ||
+ | ... | ||
+ | root@apache-krb.maison.mrs' | ||
+ | krb5-http.keytab | ||
+ | kerberos:~# rm krb5-http.keytab | ||
+ | </ | ||
+ | Nous aurions également pu utiliser la commande '' | ||
=== sur apache-krb === | === sur apache-krb === | ||
- | Pas | + | Première chose à faire, rendre le « keytab » lisible par '' |
+ | < | ||
+ | apache-krb:/ | ||
+ | apache-krb:/ | ||
+ | apache-krb:/ | ||
+ | -r-------- 1 www-data www-data 322 févr. 15 10:55 krb5-http.keytab | ||
+ | </ | ||
===== Configuration d' | ===== Configuration d' | ||
+ | Nous allons maintenant modifier la configuration du serveur par défaut, pour nécessiter l' | ||
+ | < | ||
+ | apache-krb:/ | ||
+ | & | ||
+ | ServerAdmin webmaster@localhost | ||
+ | |||
+ | DocumentRoot /var/www | ||
+ | & | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride None | ||
+ | & | ||
+ | & | ||
+ | <span class=" | ||
+ | AuthType Kerberos | ||
+ | Krb5Keytab / | ||
+ | KrbMethodK5Passwd off | ||
+ | KrbSaveCredentials on | ||
+ | require valid-user</ | ||
+ | |||
+ | AllowOverride None | ||
+ | Order allow,deny | ||
+ | allow from all | ||
+ | & | ||
+ | ... | ||
+ | & | ||
+ | </ | ||
+ | Pour les diverses options de configuration disponibles pour le module '' | ||
+ | |||
+ | L' | ||
+ | ===== Configuration du client ===== | ||
+ | Il n'y a pas grand chose à faire si ce n'est de s' | ||
+ | network.negotiate-auth.trusted-uris; | ||
+ | Ici, toute demande d'URI faisant référence aux protocoles http et https sera autorisée à effectuer la négociation kerberos. | ||
+ | ===== Vérifions ===== | ||
+ | Un petit coup de '' | ||
+ | ==== Dans une console ==== | ||
+ | Obtention du TGT : | ||
+ | chris@pchris: | ||
+ | Password for chris@MAISON.MRS: | ||
+ | ==== Dans Firefox ==== | ||
+ | http:// | ||
+ | Ça marche, on le sait, on a déjà fait. | ||
+ | ==== Re dans la console ==== | ||
+ | < | ||
+ | chris@pchris: | ||
+ | Ticket cache: FILE:/ | ||
+ | Default principal: chris@MAISON.MRS | ||
+ | |||
+ | Valid starting | ||
+ | 02/15/10 11: | ||
+ | renew until 02/16/10 11:45:22 | ||
+ | 02/15/10 11: | ||
+ | renew until 02/16/10 11:45:22 | ||
+ | </ | ||
+ | Nous constatons que désormais nous avons bien, en plus du TGT, le ticket d' | ||
+ | ==== Le snif ==== | ||
+ | Nous avons pu capturer ce qu'il s'est passé et nous voyons ceci (débarrassé des paquets ARP, NTP et autres TCP inutiles à la compréhension) : | ||
+ | < | ||
+ | No. | ||
+ | ... | ||
+ | 3 0.000209 | ||
+ | 4 0.000811 | ||
+ | ... | ||
+ | 7 5.152873 | ||
+ | 8 5.154053 | ||
+ | ... | ||
+ | 16 19.545409 | ||
+ | ... | ||
+ | 18 19.547868 | ||
+ | ... | ||
+ | 20 19.562570 | ||
+ | 21 19.564939 | ||
+ | 22 19.566770 | ||
+ | </ | ||
+ | Les trames 3 à 8 correspondent à la demande et à l' | ||
+ | |||
+ | La trame 16 correspond à une demande HTTP ingénue de la part du client. La trame 18 correspond à l' | ||
+ | < | ||
+ | Frame 18 (719 bytes on wire, 719 bytes captured) | ||
+ | ... | ||
+ | Hypertext Transfer Protocol | ||
+ | HTTP/1.1 401 Authorization Required\r\n | ||
+ | [Expert Info (Chat/ | ||
+ | [Message: HTTP/1.1 401 Authorization Required\r\n] | ||
+ | [Severity level: Chat] | ||
+ | [Group: Sequence] | ||
+ | Request Version: HTTP/1.1 | ||
+ | Response Code: 401 | ||
+ | Date: Mon, 15 Feb 2010 10:45:42 GMT\r\n | ||
+ | Server: Apache/ | ||
+ | WWW-Authenticate: | ||
+ | Vary: Accept-Encoding\r\n | ||
+ | Content-Encoding: | ||
+ | Content-Length: | ||
+ | [Content length: 346] | ||
+ | Keep-Alive: timeout=15, max=100\r\n | ||
+ | Connection: Keep-Alive\r\n | ||
+ | Content-Type: | ||
+ | \r\n | ||
+ | Content-encoded entity body (gzip): 346 bytes -> 488 bytes | ||
+ | Line-based text data: text/html | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | are authorized to access the document\n | ||
+ | requested. | ||
+ | credentials (e.g., bad password), or your\n | ||
+ | browser doesn' | ||
+ | the credentials required.</ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | Notre renard de feu, rusé par nature et qui plus est averti que dans ce cas là il doit aller regarder du côté de kerberos, va constater la présence du TGT de '' | ||
+ | < | ||
+ | Frame 20 (761 bytes on wire, 761 bytes captured) | ||
+ | ... | ||
+ | Kerberos TGS-REQ | ||
+ | Pvno: 5 | ||
+ | MSG Type: TGS-REQ (12) | ||
+ | padata: PA-TGS-REQ | ||
+ | Type: PA-TGS-REQ (1) | ||
+ | Value: 6E82022730820223A003020105A10302010EA20703050000... AP-REQ | ||
+ | Pvno: 5 | ||
+ | MSG Type: AP-REQ (14) | ||
+ | Padding: 0 | ||
+ | APOptions: 00000000 | ||
+ | .0.. .... .... .... .... .... .... .... = Use Session Key: Do NOT use the session key to encrypt the ticket | ||
+ | ..0. .... .... .... .... .... .... .... = Mutual required: Mutual authentication is NOT required | ||
+ | Ticket | ||
+ | Tkt-vno: 5 | ||
+ | Realm: MAISON.MRS | ||
+ | Server Name (Unknown): krbtgt/ | ||
+ | Name-type: Unknown (0) | ||
+ | Name: krbtgt | ||
+ | Name: MAISON.MRS | ||
+ | enc-part aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Kvno: 1 | ||
+ | enc-part: 50AB88CDE4D868AACA1BDD95C155FCD1BB24764BF57551E1... | ||
+ | Authenticator aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Authenticator data: 2C7936EF34EF6EB1AB7BE53F70E870987591510EB7B0FC90... | ||
+ | KDC_REQ_BODY | ||
+ | Padding: 0 | ||
+ | KDCOptions: 00810000 (Renewable, Canonicalize) | ||
+ | .0.. .... .... .... .... .... .... .... = Forwardable: | ||
+ | ..0. .... .... .... .... .... .... .... = Forwarded: This is NOT a forwarded ticket | ||
+ | ...0 .... .... .... .... .... .... .... = Proxiable: Do NOT use proxiable tickets | ||
+ | .... 0... .... .... .... .... .... .... = Proxy: This ticket has NOT been proxied | ||
+ | .... .0.. .... .... .... .... .... .... = Allow Postdate: We do NOT allow the ticket to be postdated | ||
+ | .... ..0. .... .... .... .... .... .... = Postdated: This ticket is NOT postdated | ||
+ | .... .... 1... .... .... .... .... .... = Renewable: This ticket is RENEWABLE | ||
+ | .... .... ...0 .... .... .... .... .... = Opt HW Auth: False | ||
+ | .... .... .... ..0. .... .... .... .... = Constrained Delegation: This is a normal request (no constrained delegation) | ||
+ | .... .... .... ...1 .... .... .... .... = Canonicalize: | ||
+ | .... .... .... .... .... .... ..0. .... = Disable Transited Check: Transited checking is NOT disabled | ||
+ | .... .... .... .... .... .... ...0 .... = Renewable OK: We do NOT accept renewed tickets | ||
+ | .... .... .... .... .... .... .... 0... = Enc-Tkt-in-Skey: | ||
+ | .... .... .... .... .... .... .... ..0. = Renew: This is NOT a request to renew a ticket | ||
+ | .... .... .... .... .... .... .... ...0 = Validate: This is NOT a request to validate a postdated ticket | ||
+ | Realm: MAISON.MRS | ||
+ | Server Name (Service and Host): HTTP/ | ||
+ | Name-type: Service and Host (3) | ||
+ | Name: HTTP | ||
+ | Name: apache-krb.maison.mrs | ||
+ | till: 2010-02-15 20:45:27 (UTC) | ||
+ | Nonce: 1266230742 | ||
+ | Encryption Types: aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 rc4-hmac des-cbc-crc des-cbc-md5 des-cbc-md4 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Encryption type: aes128-cts-hmac-sha1-96 (17) | ||
+ | Encryption type: des3-cbc-sha1 (16) | ||
+ | Encryption type: rc4-hmac (23) | ||
+ | Encryption type: des-cbc-crc (1) | ||
+ | Encryption type: des-cbc-md5 (3) | ||
+ | Encryption type: des-cbc-md4 (2) | ||
+ | </ | ||
+ | Le serveur '' | ||
+ | < | ||
+ | Frame 21 (744 bytes on wire, 744 bytes captured) | ||
+ | ... | ||
+ | Kerberos TGS-REP | ||
+ | Pvno: 5 | ||
+ | MSG Type: TGS-REP (13) | ||
+ | Client Realm: MAISON.MRS | ||
+ | Client Name (Principal): | ||
+ | Name-type: Principal (1) | ||
+ | Name: chris | ||
+ | Ticket | ||
+ | Tkt-vno: 5 | ||
+ | Realm: MAISON.MRS | ||
+ | Server Name (Service and Host): HTTP/ | ||
+ | Name-type: Service and Host (3) | ||
+ | Name: HTTP | ||
+ | Name: apache-krb.maison.mrs | ||
+ | enc-part aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Kvno: 3 | ||
+ | enc-part: 726E9E662C728E522451A0E630596656899C08CFF04F6F04... | ||
+ | enc-part aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | enc-part: 7FEDC49B008108F3E775207CB937C1DE83828023F9FCFE54... | ||
+ | </ | ||
+ | Et notre renard va re-formuler sa requête avec cette fois-ci ce qu'il faut dedans pour satisfaire l' | ||
+ | < | ||
+ | Frame 22 (1504 bytes on wire, 1504 bytes captured) | ||
+ | ... | ||
+ | Hypertext Transfer Protocol | ||
+ | GET / HTTP/ | ||
+ | [Expert Info (Chat/ | ||
+ | [Message: GET / HTTP/ | ||
+ | [Severity level: Chat] | ||
+ | [Group: Sequence] | ||
+ | Request Method: GET | ||
+ | Request URI: / | ||
+ | Request Version: HTTP/1.1 | ||
+ | Host: apache-krb.maison.mrs\r\n | ||
+ | User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.9.1.7) Gecko/ | ||
+ | Accept: text/ | ||
+ | Accept-Language: | ||
+ | Accept-Encoding: | ||
+ | Accept-Charset: | ||
+ | Keep-Alive: 300\r\n | ||
+ | Connection: keep-alive\r\n | ||
+ | If-Modified-Since: | ||
+ | If-None-Match: | ||
+ | [truncated] Authorization: | ||
+ | GSS-API Generic Security Service Application Program Interface | ||
+ | OID: 1.3.6.1.5.5.2 (SPNEGO - Simple Protected Negotiation) | ||
+ | SPNEGO | ||
+ | negTokenInit | ||
+ | mechTypes: 3 items | ||
+ | MechType: 1.2.840.113554.1.2.2 (KRB5 - Kerberos 5) | ||
+ | MechType: 1.3.5.1.5.2 (SNMPv2-SMI:: | ||
+ | MechType: 1.2.840.48018.1.2.2 (MS KRB5 - Microsoft Kerberos 5) | ||
+ | mechToken: 6082026B06092A864886F71201020201006E82025A308202... | ||
+ | krb5_blob: 6082026B06092A864886F71201020201006E82025A308202... | ||
+ | KRB5 OID: 1.2.840.113554.1.2.2 (KRB5 - Kerberos 5) | ||
+ | krb5_tok_id: | ||
+ | Kerberos AP-REQ | ||
+ | Pvno: 5 | ||
+ | MSG Type: AP-REQ (14) | ||
+ | Padding: 0 | ||
+ | APOptions: 00000000 | ||
+ | .0.. .... .... .... .... .... .... .... = Use Session Key: Do NOT use the session key to encrypt the ticket | ||
+ | ..0. .... .... .... .... .... .... .... = Mutual required: Mutual authentication is NOT required | ||
+ | Ticket | ||
+ | Tkt-vno: 5 | ||
+ | Realm: MAISON.MRS | ||
+ | Server Name (Service and Host): HTTP/ | ||
+ | Name-type: Service and Host (3) | ||
+ | Name: HTTP | ||
+ | Name: apache-krb.maison.mrs | ||
+ | enc-part aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Kvno: 3 | ||
+ | enc-part: 726E9E662C728E522451A0E630596656899C08CFF04F6F04... | ||
+ | Authenticator aes256-cts-hmac-sha1-96 | ||
+ | Encryption type: aes256-cts-hmac-sha1-96 (18) | ||
+ | Authenticator data: FAC8A2377494B396884927BE3726631FA66EFD41C98DC227... | ||
+ | \r\n | ||
+ | </ | ||
+ | Voilà, c'est aussi compliqué que ça, mais ça fonctionne quand même. | ||
Configuration d'apache-krb: Dernière modification le: 15/02/2010 à 09:16 par prof