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 20.1 par Stéphane Dugravot le 17/01/2018 - 11:15

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