Code source wiki de Configuration Linux
Version 15.1 par Stéphane Dugravot le 25/11/2014 - 16:37
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 | |||
5 | {{confluence_section}} | ||
6 | {{confluence_column width="30%"}} | ||
7 | (% style="text-align: center;" %) | ||
8 | [[image:attach:linux.png||title="linux.png"]] | ||
9 | {{/confluence_column}} | ||
10 | |||
11 | {{confluence_column}} | ||
12 | {{panel}} | ||
13 | |||
14 | |||
15 | {{toc/}} | ||
16 | {{/panel}} | ||
17 | {{/confluence_column}} | ||
18 | {{/confluence_section}} | ||
19 | |||
20 | |||
21 | |||
22 | = Configuration Linux (Ubuntu - Mint) = | ||
23 | |||
24 | 3 solutions : | ||
25 | |||
26 | 1. Via le script d'install Cisco vpn anyconnect | ||
27 | 1. Via le package openconnect (compatible AnyConnect) : Open client for Cisco AnyConnect VPN | ||
28 | 1. Via network-manager + vpnc (compatible Cisco IPSec) | ||
29 | |||
30 | == Configuration VPN Network Manager/vpnc == | ||
31 | |||
32 | === Installation === | ||
33 | |||
34 | Network Manager, le logiciel qui gère les connexions réseaux que l'on trouve sous différentes distributions Linux (ici Ubuntu) sait gérer les connexions [[WiFi>>url:http://wikidocs.univ-lorraine.fr/display/WiFi/Configuration+Network+Manager||shape="rect"]] et VPN UHP. Pour la gestion du VPN, vous devez disposer bien sûr de Network Manager, mais aussi du client vpnc : | ||
35 | |||
36 | ((( | ||
37 | (% class="syntaxhighlighter nogutter java" %) | ||
38 | ((( | ||
39 | |||
40 | |||
41 | |((( | ||
42 | (% class="container" title="Hint: double-click to select code" %) | ||
43 | ((( | ||
44 | (% class="line number1 index0 alt2" %) | ||
45 | ((( | ||
46 | {{code language="none"}} | ||
47 | > apt-get install vpnc | ||
48 | {{/code}} | ||
49 | ))) | ||
50 | ))) | ||
51 | ))) | ||
52 | |||
53 | |||
54 | ))) | ||
55 | ))) | ||
56 | |||
57 | Et enfin, du plugin network-manager-vpnc : | ||
58 | |||
59 | ((( | ||
60 | (% class="syntaxhighlighter nogutter java" %) | ||
61 | ((( | ||
62 | |||
63 | |||
64 | |((( | ||
65 | (% class="container" title="Hint: double-click to select code" %) | ||
66 | ((( | ||
67 | (% class="line number1 index0 alt2" %) | ||
68 | ((( | ||
69 | {{code language="none"}} | ||
70 | > apt-get install network-manager-vpnc | ||
71 | {{/code}} | ||
72 | ))) | ||
73 | ))) | ||
74 | ))) | ||
75 | |||
76 | |||
77 | ))) | ||
78 | ))) | ||
79 | |||
80 | === Configuration === | ||
81 | |||
82 | Faites un clique droit sur l’icône de Network Manager dans la zone de notification, puis Modification des connexions ... Comme ici : | ||
83 | |||
84 | |||
85 | |||
86 | [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/1.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]] | ||
87 | |||
88 | Rendez-vous dans l'onglet VPN, si vous avez bien installé le plugin vpnc, alors vous pouvez **//AJOUTER//** un profil : | ||
89 | |||
90 | [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/7.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]] | ||
91 | |||
92 | Cliquez sur CREER, vous obtenez alors : | ||
93 | |||
94 | [[image:attach:Capture_001.png||thumbnail="true" width="300"]] | ||
95 | |||
96 | Saisissez alors les informations de la page suivantes : | ||
97 | |||
98 | * [[doc:xwiki:publique.dn.com.infra.VPN.WebHome]] | ||
99 | * Domaine : Ne rien y inscrire | ||
100 | * Méthode chiffrement : **//Sécurisé//** | ||
101 | * Traversée du NAT : **//UDP Cisco//** | ||
102 | Dans l'onglet Paramètres IPv4, ne rien changer car l'adresse doit être attribuée automatiquement. | ||
103 | |||
104 | (% class="panelMacro" %) | ||
105 | ((( | ||
106 | |||
107 | |||
108 | |((( | ||
109 | [[image:url:http://wikidocs.univ-lorraine.fr/images/icons/emoticons/forbidden.png||width="16" height="16"]] | ||
110 | )))|((( | ||
111 | Si vous venez d'installer les paquets précédents (vpnc, network-manager-vpnc, etc ...), alors vous devez redémarrer votre poste de travail ! | ||
112 | ))) | ||
113 | |||
114 | |||
115 | ))) | ||
116 | |||
117 | === Connexion === | ||
118 | |||
119 | Faites un clique gauche sur l’icône de Network Manager dans la zone de notification, puis choisissez Connexions VPN ... | ||
120 | Enfin valider en choisissant le profil que vous venez de créer : | ||
121 | |||
122 | [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/9.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]] | ||
123 | |||
124 | Une fois la connexion établie, l’icône de Network Manager indique un cadenas pour vous informer que la connexion a été établie avec succès : | ||
125 | |||
126 | [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/10.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]] | ||
127 | |||
128 | |||
129 | |||
130 | == Via le script d'install Cisco vpn anyconnect == | ||
131 | |||
132 | Sous linux on peux installer le client anyconnect en lancant le script vpnsetup.sh disponible soit : | ||
133 | |||
134 | ici : | ||
135 | |||
136 | * Linux_X86_64 : [[attach:vpnsetup_64b.sh]] ( Version au 13/02/2013) | ||
137 | * Linux_32 : [[attach:vpnsetup_32b.sh]] ( Version au 13/02/2013) | ||
138 | |||
139 | soit | ||
140 | |||
141 | en allant le chercher sur le [[https:~~/~~/vpn.lothaire.net>>url:https://vpn.lothaire.net||shape="rect"]] | ||
142 | |||
143 | |||
144 | |||
145 | [[image:attach:VPN_Linux1.png||width="800" title="VPN_Linux1.png"]] | ||
146 | |||
147 | puis en cliquant sur le lien ( apres 1, à 2 min) : | ||
148 | |||
149 | [[image:attach:VPN_Linux2.png||title="VPN_Linux2.png"]] | ||
150 | |||
151 | |||
152 | |||
153 | Une fois le script récuperé, on install le produit : | ||
154 | |||
155 | |||
156 | |||
157 | {{code title="install_anyconnect" theme="RDark" language="bash"}} | ||
158 | xxxxxx@pcxxxxx ~/Téléchargements $ sudo sh vpnsetup_64b.sh | ||
159 | [sudo] password for xxxxxx: | ||
160 | Installing Cisco AnyConnect Secure Mobility Client... | ||
161 | Removing previous installation... | ||
162 | mv: impossible d'évaluer «/opt/cisco/vpn/*.log»: Aucun fichier ou dossier de ce type | ||
163 | Extracting installation files to /tmp/vpn.zFF5b4/vpninst095927597.tgz... | ||
164 | Unarchiving installation files to /tmp/vpn.zFF5b4... | ||
165 | Starting the VPN agent... | ||
166 | Done! | ||
167 | |||
168 | |||
169 | {{/code}} | ||
170 | |||
171 | |||
172 | |||
173 | on doit rebooter sa machine, pour voir apparaître dans un menu l'application "Cisco Anyconnect Secure Mobility Client" : | ||
174 | |||
175 | [[image:attach:VPN_Linux3.png||title="VPN_Linux3.png"]] | ||
176 | |||
177 | ** | ||
178 | ** | ||
179 | |||
180 | on le lance : | ||
181 | |||
182 | **[[image:attach:VPN_Linux4.png||title="VPN_Linux4.png"]]** | ||
183 | |||
184 | ** | ||
185 | ** | ||
186 | |||
187 | **on accepte le certificat et on peut se connecter :** | ||
188 | |||
189 | ** | ||
190 | ** | ||
191 | |||
192 | **[[image:attach:VPN_Linux5.png||title="VPN_Linux5.png"]]** | ||
193 | |||
194 | **NB : si on a ces erreurs "AnyConnect cannot confirm it is connected to your secure gateway. The local network may not be trustworthy. Please try another network."** | ||
195 | |||
196 | **c'est qu'il manque le certificat TERENA SSL CA** | ||
197 | |||
198 | |||
199 | |||
200 | {{code}} | ||
201 | cd /opt/.cisco/certificates/ca | ||
202 | wget http://www.crium.univ-metz.fr/chaintcs.crt -o chaintcs.pem | ||
203 | {{/code}} | ||
204 | |||
205 | |||
206 | |||
207 | === Fichier XML pour la configuration d'anyconnect === | ||
208 | |||
209 | Dans le cas ou il y a plusieurs concentrateur vpn à gérer. | ||
210 | |||
211 | Fichier à installer dans : | ||
212 | |||
213 | * MacOS X : /opt/cisco/anyconnect/profile | ||
214 | * Windows : (% class="content" %)C:\ProgramData\Cisco\Cisco AnyConnect VPN Client\Profile\ | ||
215 | |||
216 | Mettre un nom suffixé **.xml** | ||
217 | (% class="content" %)\\ | ||
218 | |||
219 | {{code}} | ||
220 | <?xml version="1.0" encoding="UTF-8"?> | ||
221 | |||
222 | <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" | ||
223 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
224 | xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd"> | ||
225 | <ClientInitialization> | ||
226 | <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon> | ||
227 | <CertEnrollmentPin>pinAllowed</CertEnrollmentPin> | ||
228 | <CertificateMatch> | ||
229 | <KeyUsage> | ||
230 | <MatchKey>Non_Repudiation</MatchKey> | ||
231 | <MatchKey>Digital_Signature</MatchKey> | ||
232 | </KeyUsage> | ||
233 | <ExtendedKeyUsage> | ||
234 | <ExtendedMatchKey>ClientAuth</ExtendedMatchKey> | ||
235 | <ExtendedMatchKey>ServerAuth</ExtendedMatchKey> | ||
236 | <CustomExtendedMatchKey>1.3.6.1.5.5.7.3.11</CustomExtendedMatchKey> | ||
237 | </ExtendedKeyUsage> | ||
238 | <DistinguishedName> | ||
239 | <DistinguishedNameDefinition Operator="Equal" Wildcard="Enabled"> | ||
240 | <Name>CN</Name> | ||
241 | <Pattern>ASASecurity</Pattern> | ||
242 | </DistinguishedNameDefinition> | ||
243 | <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled"> | ||
244 | <Name>L</Name> | ||
245 | <Pattern>Boulder</Pattern> | ||
246 | </DistinguishedNameDefinition> | ||
247 | </DistinguishedName> | ||
248 | </CertificateMatch> | ||
249 | </ClientInitialization> | ||
250 | <ServerList> | ||
251 | <HostEntry> | ||
252 | <HostName>UL</HostName> | ||
253 | <HostAddress>vpn.lothaire.net</HostAddress> | ||
254 | </HostEntry> | ||
255 | </ServerList> | ||
256 | </AnyConnectProfile> | ||
257 | {{/code}} | ||
258 | |||
259 | |||
260 | |||
261 | == Via le package Openconnect == | ||
262 | |||
263 | on install le package openconnect et les plugin network-manager-openconnect, network-manager-openconnect-gnome | ||
264 | |||
265 | |||
266 | |||
267 | {{code title="Openconnect" theme="RDark" language="bash"}} | ||
268 | sudo apt-get install openconnect network-manager-openconnect network-manager-openconnect-gnome | ||
269 | {{/code}} | ||
270 | |||
271 | |||
272 | |||
273 | rebooter sa machine , on verra maintenant apparaître dans son module de gestion réseau/VPN un nouveau module "VPN Compatible Cisco Anyconnect ( openconnect)" | ||
274 | |||
275 | |||
276 | |||
277 | [[image:attach:VPN_Linux6.png||title="VPN_Linux6.png"]] | ||
278 | |||
279 | |||
280 | |||
281 | [[image:attach:VPN_Linux7.png||title="VPN_Linux7.png"]] | ||
282 | |||
283 | |||
284 | |||
285 | créer , Renseigner uniquement le nomde la connexion et la passerelle | ||
286 | |||
287 | [[image:attach:VPN_Linux8.png||title="VPN_Linux8.png"]] | ||
288 | |||
289 | Pour avoir de bonnes performances il faut activer le Split-Tunnel (seules les connexions nécessaires passent dans le tunnel), | ||
290 | il faut cocher une case dans les paramètres IPV4 > Routes (la traduction française a coupé la phrase) | ||
291 | |||
292 | [[image:attach:openconnect-split-tunnel.jpg||title="openconnect-split-tunnel.jpg"]] | ||
293 | |||
294 | votre nvelle connexion VPN s'affiche maintenant dans votre gestionnaire réseau : | ||
295 | |||
296 | [[image:attach:VPN_Linux9.png||title="VPN_Linux9.png"]] | ||
297 | |||
298 | cocher " Automatically start ....." et cliquer à coté du VPN host pour la connexion : | ||
299 | |||
300 | |||
301 | |||
302 | [[image:attach:VPN_Linux10.png||title="VPN_Linux10.png"]] | ||
303 | |||
304 | valider le certificat : | ||
305 | |||
306 | [[image:attach:VPN_Linux11.png||title="VPN_Linux11.png"]] | ||
307 | |||
308 | |||
309 | |||
310 | puis loguer vous : | ||
311 | |||
312 | |||
313 | |||
314 | [[image:attach:VPN_Linux12.png||title="VPN_Linux12.png"]] | ||
315 | |||
316 | = En cas de problèmes = | ||
317 | |||
318 | == Problème AnyConnect cannot confirm it is connected to your secure gateway == | ||
319 | |||
320 | Lors du démarrage du client Anyconnect, on obtient le message suivant : | ||
321 | |||
322 | [[image:attach:untrust.png||thumbnail="true" width="300"]] | ||
323 | |||
324 | Pour résourde ce problème, procédez comme cela : | ||
325 | |||
326 | 1. ((( | ||
327 | Renommer le dossier ca | ||
328 | |||
329 | {{code}} | ||
330 | cd /opt/.cisco/certificates | ||
331 | mv ca ca.orig | ||
332 | {{/code}} | ||
333 | ))) | ||
334 | 1. ((( | ||
335 | Nouveau dossier | ||
336 | |||
337 | {{code}} | ||
338 | mkdir ca | ||
339 | {{/code}} | ||
340 | ))) | ||
341 | 1. Dans le dossier ca, créez un nouveau certificat, vous pouvez le téléchargez à partir de ce fichier : | ||
342 | [[attach:vpn.pem]] | ||
343 | 1. ((( | ||
344 | Redémarrez le service | ||
345 | |||
346 | {{code}} | ||
347 | /etc/init.d/vpnagentd restart | ||
348 | {{/code}} | ||
349 | ))) | ||
350 | 1. Et le client, le problème ne devrait plus se poser. | ||
351 | |||
352 |