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 24.1 par Stéphane Dugravot le 24/05/2019 - 10:42

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