Outils pour utilisateurs

Outils du site


Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
320kerberos:50_apache [le 15/02/2010 à 11:02] prof320kerberos:50_apache [le 30/06/2018 à 15:58] (Version actuelle) prof
Ligne 1: Ligne 1:
 ====== Configuration d'apache-krb ====== ====== Configuration d'apache-krb ======
 Le serveur ''apache-krb.maison.mrs'' va fournir un service http nécessitant une authentification kerberos. Nous allons donc installer ce qui est nécessaire : Le serveur ''apache-krb.maison.mrs'' va fournir un service http nécessitant une authentification kerberos. Nous allons donc installer ce qui est nécessaire :
-  * un système de synchronisation de l'horloge (NTP). Nous ne verrons ici comment faire, ce n'est pas le sujet principal ;+  * un système de synchronisation de l'horloge (NTP) ;
   * un serveur apache classique ;   * un serveur apache classique ;
   * les composants kerberos nécessaires.   * les composants kerberos nécessaires.
 +
 ===== Installation d'apache ===== ===== Installation d'apache =====
 Nous installons un Apache « prefork » classique : Nous installons un Apache « prefork » classique :
Ligne 108: Ligne 109:
 kerberos:~# rm krb5-http.keytab  kerberos:~# rm krb5-http.keytab 
 </code> </code>
 +Nous aurions également pu utiliser la commande ''kadmin'' directement sur ''apache-krb.maison.mrs'' pour obtenir le keytab sur place.
  
 === sur apache-krb === === sur apache-krb ===
Ligne 193: Ligne 195:
      22 19.566770   192.168.0.16          192.168.0.134         HTTP     GET / HTTP/1.1       22 19.566770   192.168.0.16          192.168.0.134         HTTP     GET / HTTP/1.1 
 </code> </code>
-    +Les trames 3 à 8 correspondent à la demande et à l'obtention du TGT (commande ''kinit''), ce n'est pas nouveau. 
 + 
 +La trame 16 correspond à une demande HTTP ingénue de la part du client. La trame 18 correspond à l'erreur 401 ''Authorization Required''. Dans la réponse HTTP, il n'y a rien de plus que le HTML normalement destiné à afficher l'erreur, comme nous l'avons vu au début de ce chapitre : 
 +<code> 
 +Frame 18 (719 bytes on wire, 719 bytes captured) 
 +... 
 +Hypertext Transfer Protocol 
 +    HTTP/1.1 401 Authorization Required\r\n 
 +        [Expert Info (Chat/Sequence): HTTP/1.1 401 Authorization Required\r\n] 
 +            [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/2.2.14 (Debian)\r\n 
 +    WWW-Authenticate: Negotiate\r\n 
 +    Vary: Accept-Encoding\r\n 
 +    Content-Encoding: gzip\r\n 
 +    Content-Length: 346\r\n 
 +        [Content length: 346] 
 +    Keep-Alive: timeout=15, max=100\r\n 
 +    Connection: Keep-Alive\r\n 
 +    Content-Type: text/html; charset=iso-8859-1\r\n 
 +    \r\n 
 +    Content-encoded entity body (gzip): 346 bytes -> 488 bytes 
 +Line-based text data: text/html 
 +    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n 
 +    <html><head>\n 
 +    <title>401 Authorization Required</title>\n 
 +    </head><body>\n 
 +    <h1>Authorization Required</h1>\n 
 +    <p>This server could not verify that you\n 
 +    are authorized to access the document\n 
 +    requested.  Either you supplied the wrong\n 
 +    credentials (e.g., bad password), or your\n 
 +    browser doesn't understand how to supply\n 
 +    the credentials required.</p>\n 
 +    <hr>\n 
 +    <address>Apache/2.2.14 (Debian) Server at apache-krb.maison.mrs Port 80</address>\n 
 +    </body></html>\n 
 +</code> 
 +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 ''chris'' et lancer une demande de ticket (TGS-REQ) dans la trame 20 : 
 +<html><pre class="code"> 
 +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/MAISON.MRS 
 +                        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: Do NOT use forwardable tickets 
 +            ..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: This is a request for a CANONICALIZED ticket 
 +            .... .... .... .... .... .... ..0. .... = Disable Transited Check: Transited checking is NOT disabled 
 +            .... .... .... .... .... .... ...0 .... = Renewable OK: We do NOT accept renewed tickets 
 +            .... .... .... .... .... .... .... 0... = Enc-Tkt-in-Skey: Do NOT encrypt the tkt inside the 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/apache-krb.maison.mrs 
 +            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) 
 +</pre></html> 
 +Le serveur ''kerberos'' va répondre dans la trame 21 : 
 +<html><pre class="code"> 
 +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): chris 
 +        Name-type: Principal (1) 
 +        Name: chris 
 +    Ticket 
 +        Tkt-vno: 5 
 +        Realm: MAISON.MRS 
 +        Server Name (Service and Host): HTTP/apache-krb.maison.mrs 
 +            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... 
 +</pre></html> 
 +Et notre renard va re-formuler sa requête avec cette fois-ci ce qu'il faut dedans pour satisfaire l'indien dans la trame 22 : 
 +<html><pre class="code"> 
 +Frame 22 (1504 bytes on wire, 1504 bytes captured) 
 +... 
 +Hypertext Transfer Protocol 
 +    GET / HTTP/1.1\r\n 
 +        [Expert Info (Chat/Sequence): GET / HTTP/1.1\r\n] 
 +            [Message: GET / HTTP/1.1\r\n] 
 +            [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/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7\r\n 
 +    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n 
 +    Accept-Language: fr-fr,fr;q=0.8,en;q=0.5,en-us;q=0.3\r\n 
 +    Accept-Encoding: gzip,deflate\r\n 
 +    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n 
 +    Keep-Alive: 300\r\n 
 +    Connection: keep-alive\r\n 
 +    If-Modified-Since: Mon, 15 Feb 2010 08:38:55 GMT\r\n 
 +    If-None-Match: "45d72-b1-47f9f8c2b05c0"\r\n 
 +    [truncated] Authorization: Negotiate YIICqAYGKwYBBQUCoIICnDCCApigHzAdBgkqhkiG9xIBAgIGBSsFAQUCBgkqhkiC9xIBAgKiggJzBIICb2CCAmsGCSqGSIb3EgECAgEAboICWjCCAlagAwIBBaEDAgEOogcDBQAAAAAAo4IBb2GCAWswggFnoAMCAQWhDBsKTUFJU09OLk1SU6IoMCagAwIBA6EfMB0bBE 
 +        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::org.5.1.5.2) 
 +                        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: KRB5_AP_REQ (0x0001) 
 +                        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/apache-krb.maison.mrs 
 +                                    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 
 +</pre></html> 
 +Voilà, c'est aussi compliqué que ça, mais ça fonctionne quand même. 
Configuration d'apache-krb: Dernière modification le: 15/02/2010 à 11:02 par