| 64 | | -> Editez dans /etc/rc.conf en ajoutant la ligne |
| | 66 | -> Si vous entrez |
| | 67 | {{{ |
| | 68 | $ setkey -D -P |
| | 69 | }}} |
| | 70 | la création des SA et SP devraient vous produire un affichage à peu près similaire à |
| | 71 | {{{ |
| | 72 | [root@SERVEUR1 ~]# setkey -P -D |
| | 73 | 10.0.0.13[any] 10.40.0.9[any] any |
| | 74 | in ipsec |
| | 75 | ah/transport/10.40.0.13-10.40.0.9/use |
| | 76 | esp/transport/10.0.0.13-10.0.0.9/use |
| | 77 | created: Apr 20 18:10:44 2007 lastused: Apr 20 18:10:44 2007 |
| | 78 | lifetime: 0(s) validtime: 0(s) |
| | 79 | spid=16393 seq=1 pid=7761 |
| | 80 | refcnt=1 |
| | 81 | 10.40.0.9[any] 10.0.0.13[any] any |
| | 82 | out ipsec |
| | 83 | ah/transport/10.40.0.9-10.40.0.13/use |
| | 84 | esp/transport/10.0.0.9-10.0.0.13/use |
| | 85 | created: Apr 20 18:10:44 2007 lastused: Apr 20 18:10:44 2007 |
| | 86 | lifetime: 0(s) validtime: 0(s) |
| | 87 | spid=16392 seq=0 pid=7761 |
| | 88 | refcnt=1 |
| | 89 | }}} |
| | 90 | -> Pour automatiser cette procédure au démarrage de la machine, éditez dans /etc/rc.conf en ajoutant : |
| 73 | | |
| | 99 | [[BR]] |
| | 100 | |
| | 101 | -> Créer psk.txt initiant l'échange de clé partagé |
| | 102 | {{{ |
| | 103 | $ cat > psk.txt << EOF |
| | 104 | 10.40.0.9 mot_de_passe_t3$T |
| | 105 | EOF |
| | 106 | }}} |
| | 107 | L'adresse IP est celle de la cible (ici Serveur1), suivi du mot de passe. |
| | 108 | -> Créer racoon.conf. Vous pouvez vous inspirer de l'exemple fourni par défaut avec Racoon, ou bien utiliser (en le modifiant) celui-ci: |
| | 109 | {{{ |
| | 110 | $ cat > racoon.conf << EOF |
| | 111 | # $File: /home/chris/PRes/Postes_Rackables/ipsec_client1/racoon.conf $ |
| | 112 | # $MD5: 2922df40b60a8f1eb7116f90a485f84a $ |
| | 113 | # $By Christophe Alladoum <christophe[dot]alladoum[at]gmail[dot]com>$ |
| | 114 | # $Last-Modified: Fri Apr 20 18:28:11 2007$ |
| | 115 | |
| | 116 | # |
| | 117 | # Configuration de RACOON cote client |
| | 118 | # |
| | 119 | |
| | 120 | path include "/chemin/absolu/vers/ce/repertoire" ; |
| | 121 | |
| | 122 | path pre_shared_key "/chemin/absolu/vers/psk.txt" ; |
| | 123 | # path pre_shared_key "/root/ipsec_client1/psk.txt" ; |
| | 124 | # path certificate "/usr/local/etc/cert" ; |
| | 125 | |
| | 126 | # "log" indique le niveau de debug |
| | 127 | # choix : notify, debug, debug2 |
| | 128 | # log debug; |
| | 129 | |
| | 130 | padding |
| | 131 | { |
| | 132 | maximum_length 20; # maximum padding length. |
| | 133 | randomize off; # enable randomize length. |
| | 134 | strict_check off; # enable strict check. |
| | 135 | exclusive_tail off; # extract last one octet. |
| | 136 | } |
| | 137 | |
| | 138 | # Interfaces a ecouter (IPv4 et/ou v6) |
| | 139 | # Si aucune, ecoute sur toutes les interfaces de la machine |
| | 140 | listen |
| | 141 | { |
| | 142 | # pour le client IPv4 |
| | 143 | isakmp 10.40.0.13 [500]; |
| | 144 | # pour le client IPv6 |
| | 145 | # isakmp ::1 [7000]; |
| | 146 | } |
| | 147 | |
| | 148 | # Temporisateurs d echange de cle |
| | 149 | timer |
| | 150 | { |
| | 151 | counter 5; # maximum trying count to send. |
| | 152 | interval 20 sec; # maximum interval to resend. |
| | 153 | persend 1; # the number of packets per a send. |
| | 154 | |
| | 155 | # Temps max. pour chaque phase |
| | 156 | phase1 2 min; |
| | 157 | phase2 4 min; |
| | 158 | } |
| | 159 | |
| | 160 | # Cas du client1 |
| | 161 | remote 10.40.0.9 |
| | 162 | { |
| | 163 | exchange_mode aggressive,main; |
| | 164 | doi ipsec_doi; |
| | 165 | situation identity_only; |
| | 166 | |
| | 167 | nonce_size 16; |
| | 168 | lifetime time 60 min; # sec,min,hour |
| | 169 | initial_contact on; |
| | 170 | support_proxy on; |
| | 171 | proposal_check obey; # obey, strict or claim |
| | 172 | |
| | 173 | proposal { |
| | 174 | encryption_algorithm blowfish; |
| | 175 | hash_algorithm sha1; |
| | 176 | authentication_method pre_shared_key ; |
| | 177 | dh_group 5 ; |
| | 178 | } |
| | 179 | } |
| | 180 | |
| | 181 | # Cas du client1 |
| | 182 | sainfo anonymous |
| | 183 | { |
| | 184 | pfs_group 5; |
| | 185 | lifetime time 48 hour; |
| | 186 | encryption_algorithm 3des, cast128, blowfish 448, des; |
| | 187 | authentication_algorithm hmac_md5, hmac_sha1; |
| | 188 | compression_algorithm deflate ; |
| | 189 | } |
| | 190 | EOF |
| | 191 | }}} |
| | 192 | -> A présent, lancez: |
| | 193 | {{{ |
| | 194 | $ /usr/local/sbin/racoon -l /var/log/racoon.log -f /chemin/vers/racoon.conf |
| | 195 | }}} |
| | 196 | Un fichier de log (utile pour le debug) sera crée à l'adresse /var/log/racoon.log |
| | 197 | -> ''' Votre Racoon est lancé !! ''' |