Découvrez les nouveautés de cette version : Fonctionnalités, améliorations et évolutions vous attendent ! 👉 Cliquez ici pour en savoir plus

Code source wiki de Configuration Linux

Version 18.1 par Stéphane Dugravot le 17/01/2018 - 11:14

Afficher les derniers auteurs
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 ... puis rendez-vous dans l'onglet VPN, si vous avez bien installé le plugin vpnc, alors vous pouvez **//AJOUTER//** un profil.
83
84 Cliquez sur CREER, vous obtenez alors :
85
86 [[image:attach:Capture_001.png||thumbnail="true" width="300"]]
87
88 Saisissez alors les informations de la page suivantes :
89
90 * [[doc:xwiki:publique.dn.com.infra.Services numériques.Documentation officielle VPN.WebHome]]
91 * Domaine : Ne rien y inscrire
92 * Méthode chiffrement : **//Sécurisé//**
93 * Traversée du NAT : **//UDP Cisco//**
94 Dans l'onglet Paramètres IPv4, ne rien changer car l'adresse doit être attribuée automatiquement.
95
96 (% class="panelMacro" %)
97 (((
98
99
100 |(((
101 [[image:url:http://wikidocs.univ-lorraine.fr/images/icons/emoticons/forbidden.png||width="16" height="16"]]
102 )))|(((
103 Si vous venez d'installer les paquets précédents (vpnc, network-manager-vpnc, etc ...), alors vous devez redémarrer votre poste de travail !
104 )))
105
106
107 )))
108
109 === Connexion ===
110
111 Faites un clique gauche sur l’icône de Network Manager dans la zone de notification, puis choisissez Connexions VPN ...
112 Enfin valider en choisissant le profil que vous venez de créer :
113
114 [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/9.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]]
115
116 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 :
117
118 [[image:url:http://wikidocs.univ-lorraine.fr/download/thumbnails/41123876/10.png?version=1&modificationDate=1243940356000&api=v2||thumbnail="true"]]
119
120
121
122 == Via le script d'install Cisco vpn anyconnect ==
123
124 Sous linux on peux installer le client anyconnect en lancant le script vpnsetup.sh disponible soit :
125
126 ici :
127
128 * Linux_X86_64 : [[attach:vpnsetup_64b.sh]] ( Version au 13/02/2013)
129 * Linux_32 : [[attach:vpnsetup_32b.sh]] ( Version au 13/02/2013)
130
131 soit
132
133 en allant le chercher sur le [[https:~~/~~/vpn.lothaire.net>>url:https://vpn.lothaire.net||shape="rect"]]
134
135
136
137 [[image:attach:VPN_Linux1.png||width="800" title="VPN_Linux1.png"]]
138
139 puis en cliquant sur le lien ( apres 1, à 2 min) :
140
141 [[image:attach:VPN_Linux2.png||title="VPN_Linux2.png"]]
142
143
144
145 Une fois le script récuperé, on install le produit :
146
147
148
149 {{code title="install_anyconnect" theme="RDark" language="bash"}}
150 xxxxxx@pcxxxxx ~/Téléchargements $ sudo sh vpnsetup_64b.sh
151 [sudo] password for xxxxxx:
152 Installing Cisco AnyConnect Secure Mobility Client...
153 Removing previous installation...
154 mv: impossible d'évaluer «/opt/cisco/vpn/*.log»: Aucun fichier ou dossier de ce type
155 Extracting installation files to /tmp/vpn.zFF5b4/vpninst095927597.tgz...
156 Unarchiving installation files to /tmp/vpn.zFF5b4...
157 Starting the VPN agent...
158 Done!
159
160
161 {{/code}}
162
163
164
165 on doit rebooter sa machine, pour voir apparaître dans un menu l'application "Cisco Anyconnect Secure Mobility Client" :
166
167 [[image:attach:VPN_Linux3.png||title="VPN_Linux3.png"]]
168
169 **
170 **
171
172 on le lance :
173
174 **[[image:attach:VPN_Linux4.png||title="VPN_Linux4.png"]]**
175
176 **
177 **
178
179 **on accepte le certificat et on peut se connecter :**
180
181 **
182 **
183
184 **[[image:attach:VPN_Linux5.png||title="VPN_Linux5.png"]]**
185
186 **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."**
187
188 **c'est qu'il manque le certificat TERENA SSL CA**
189
190
191
192 {{code}}
193 cd /opt/.cisco/certificates/ca
194 wget http://www.crium.univ-metz.fr/chaintcs.crt -o chaintcs.pem
195 {{/code}}
196
197
198
199 === Fichier XML pour la configuration d'anyconnect ===
200
201 Dans le cas ou il y a plusieurs concentrateur vpn à gérer.
202
203 Fichier à installer dans :
204
205 * MacOS X : /opt/cisco/anyconnect/profile
206 * Windows : (% class="content" %)C:\ProgramData\Cisco\Cisco AnyConnect VPN Client\Profile\
207
208 Mettre un nom suffixé **.xml**
209 (% class="content" %)\\
210
211 {{code}}
212 <?xml version="1.0" encoding="UTF-8"?>
213
214 <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/"
215 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
216 xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
217 <ClientInitialization>
218 <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
219 <CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
220 <CertificateMatch>
221 <KeyUsage>
222 <MatchKey>Non_Repudiation</MatchKey>
223 <MatchKey>Digital_Signature</MatchKey>
224 </KeyUsage>
225 <ExtendedKeyUsage>
226 <ExtendedMatchKey>ClientAuth</ExtendedMatchKey>
227 <ExtendedMatchKey>ServerAuth</ExtendedMatchKey>
228 <CustomExtendedMatchKey>1.3.6.1.5.5.7.3.11</CustomExtendedMatchKey>
229 </ExtendedKeyUsage>
230 <DistinguishedName>
231 <DistinguishedNameDefinition Operator="Equal" Wildcard="Enabled">
232 <Name>CN</Name>
233 <Pattern>ASASecurity</Pattern>
234 </DistinguishedNameDefinition>
235 <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled">
236 <Name>L</Name>
237 <Pattern>Boulder</Pattern>
238 </DistinguishedNameDefinition>
239 </DistinguishedName>
240 </CertificateMatch>
241 </ClientInitialization>
242 <ServerList>
243 <HostEntry>
244 <HostName>UL</HostName>
245 <HostAddress>vpn.lothaire.net</HostAddress>
246 </HostEntry>
247 </ServerList>
248 </AnyConnectProfile>
249 {{/code}}
250
251
252
253 == Via le package Openconnect en CLI ==
254
255 Installation préalable :
256
257 {{code}}
258 sudo apt-get install openconnect
259 {{/code}}
260
261
262
263 Commande :
264
265 {{code}}
266 sudo openconnect -u dugravot6@dn-infra --authgroup='Universite-de-Lorraine' --no-cert-check vpn.lothaire.net
267 {{/code}}
268
269
270
271 == Via le package Openconnect avec Network-Manager ==
272
273 On install le package openconnect et les plugin network-manager-openconnect, network-manager-openconnect-gnome
274
275
276
277 {{code title="Openconnect" theme="RDark" language="bash"}}
278 sudo apt-get install openconnect network-manager-openconnect network-manager-openconnect-gnome
279 {{/code}}
280
281
282
283 rebooter sa machine , on verra maintenant apparaître dans son module de gestion réseau/VPN un nouveau module "VPN Compatible Cisco Anyconnect ( openconnect)"
284
285
286
287 [[image:attach:VPN_Linux6.png||title="VPN_Linux6.png"]]
288
289
290
291 [[image:attach:VPN_Linux7.png||title="VPN_Linux7.png"]]
292
293
294
295 créer , Renseigner uniquement le nomde la connexion et la passerelle
296
297 [[image:attach:VPN_Linux8.png||title="VPN_Linux8.png"]]
298
299 Pour avoir de bonnes performances il faut activer le Split-Tunnel (seules les connexions nécessaires passent dans le tunnel),
300 il faut cocher une case dans les paramètres IPV4 > Routes (la traduction française a coupé la phrase)
301
302 [[image:attach:openconnect-split-tunnel.jpg||title="openconnect-split-tunnel.jpg"]]
303
304 votre nvelle connexion VPN s'affiche maintenant dans votre gestionnaire réseau :
305
306 [[image:attach:VPN_Linux9.png||title="VPN_Linux9.png"]]
307
308 cocher " Automatically start ....." et cliquer à coté du VPN host pour la connexion :
309
310
311
312 [[image:attach:VPN_Linux10.png||title="VPN_Linux10.png"]]
313
314 valider le certificat :
315
316 [[image:attach:VPN_Linux11.png||title="VPN_Linux11.png"]]
317
318
319
320 puis loguer vous :
321
322
323
324 [[image:attach:VPN_Linux12.png||title="VPN_Linux12.png"]]
325
326 = En cas de problèmes =
327
328 == Problème AnyConnect cannot confirm it is connected to your secure gateway ==
329
330 Lors du démarrage du client Anyconnect, on obtient le message suivant :
331
332 [[image:attach:untrust.png||thumbnail="true" width="300"]]
333
334 Pour résourde ce problème, procédez comme cela :
335
336 1. (((
337 Renommer le dossier ca
338
339 {{code}}
340 cd /opt/.cisco/certificates
341 mv ca ca.orig
342 {{/code}}
343 )))
344 1. (((
345 Nouveau dossier
346
347 {{code}}
348 mkdir ca
349 {{/code}}
350 )))
351 1. Dans le dossier ca, créez un nouveau certificat, vous pouvez le téléchargez à partir de ce fichier :
352 [[attach:vpn.pem]]
353 1. (((
354 Redémarrez le service
355
356 {{code}}
357 /etc/init.d/vpnagentd restart
358 {{/code}}
359 )))
360 1. Et le client, le problème ne devrait plus se poser.
361
362 == Les accès vers les machines privées ne se font pas depuis l'extérieur ==
363
364 Il faut modifier la conf du VPN comme ça :
365
366 [[image:attach:Capture d'écran de 2015-02-03 12:14:28.png]]