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 25.1 par Stéphane Dugravot le 24/05/2019 - 16:55

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, que l'on peut récupérer ici :**
153
154 * **[[attach:DigiCertCA.crt]]**
155
156 === Fichier XML pour la configuration d'anyconnect ===
157
158 Dans le cas ou il y a plusieurs concentrateur vpn à gérer.
159
160 Fichier à installer dans :
161
162 * MacOS X : /opt/cisco/anyconnect/profile
163 * Windows : (% class="content" %)C:\ProgramData\Cisco\Cisco AnyConnect VPN Client\Profile\
164
165 Mettre un nom suffixé **.xml**
166 (% class="content" %)\\
167
168 {{code}}
169 <?xml version="1.0" encoding="UTF-8"?>
170
171 <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/"
172 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
173 xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
174 <ClientInitialization>
175 <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
176 <CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
177 <CertificateMatch>
178 <KeyUsage>
179 <MatchKey>Non_Repudiation</MatchKey>
180 <MatchKey>Digital_Signature</MatchKey>
181 </KeyUsage>
182 <ExtendedKeyUsage>
183 <ExtendedMatchKey>ClientAuth</ExtendedMatchKey>
184 <ExtendedMatchKey>ServerAuth</ExtendedMatchKey>
185 <CustomExtendedMatchKey>1.3.6.1.5.5.7.3.11</CustomExtendedMatchKey>
186 </ExtendedKeyUsage>
187 <DistinguishedName>
188 <DistinguishedNameDefinition Operator="Equal" Wildcard="Enabled">
189 <Name>CN</Name>
190 <Pattern>ASASecurity</Pattern>
191 </DistinguishedNameDefinition>
192 <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled">
193 <Name>L</Name>
194 <Pattern>Boulder</Pattern>
195 </DistinguishedNameDefinition>
196 </DistinguishedName>
197 </CertificateMatch>
198 </ClientInitialization>
199 <ServerList>
200 <HostEntry>
201 <HostName>UL</HostName>
202 <HostAddress>vpn.lothaire.net</HostAddress>
203 </HostEntry>
204 </ServerList>
205 </AnyConnectProfile>
206 {{/code}}
207
208
209
210 == Via le package Openconnect en CLI ==
211
212 Installation préalable :
213
214 {{code}}
215 sudo apt-get install openconnect
216 {{/code}}
217
218
219
220 Commande :
221
222 {{code}}
223 sudo openconnect -u dugravot6@dn-infra --authgroup='Universite-de-Lorraine' --no-cert-check vpn.lothaire.net
224 {{/code}}
225
226
227
228 == Via le package Openconnect avec Network-Manager ==
229
230 On installe le package openconnect et les plugin network-manager-openconnect, network-manager-openconnect-gnome (fonctionne aussi avec linux mint 18.3 en cinnamon)
231
232 \\
233
234 {{code language="bash" theme="RDark" title="Openconnect"}}
235 sudo apt-get install openconnect network-manager-openconnect network-manager-openconnect-gnome
236 {{/code}}
237
238 Rebooter sa machine , on verra maintenant apparaître dans son module de gestion réseau/VPN un nouveau module "VPN Compatible Cisco Anyconnect ( openconnect)"
239
240
241
242 [[image:attach:VPN_Linux6.png||title="VPN_Linux6.png"]]
243
244
245
246 [[image:attach:VPN_Linux7.png||title="VPN_Linux7.png"]]
247
248
249
250 créer , Renseigner uniquement le nomde la connexion et la passerelle
251
252 [[image:attach:VPN_Linux8.png||title="VPN_Linux8.png"]]
253
254 Pour avoir de bonnes performances il faut activer le Split-Tunnel (seules les connexions nécessaires passent dans le tunnel),
255 il faut cocher une case dans les paramètres IPV4 > Routes (la traduction française a coupé la phrase)
256
257 [[image:attach:openconnect-split-tunnel.jpg||title="openconnect-split-tunnel.jpg"]]
258
259 votre nvelle connexion VPN s'affiche maintenant dans votre gestionnaire réseau :
260
261 [[image:attach:VPN_Linux9.png||title="VPN_Linux9.png"]]
262
263 cocher " Automatically start ....." et cliquer à coté du VPN host pour la connexion :
264
265
266
267 [[image:attach:VPN_Linux10.png||title="VPN_Linux10.png"]]
268
269 valider le certificat :
270
271 [[image:attach:VPN_Linux11.png||title="VPN_Linux11.png"]]
272
273
274
275 puis loguer vous :
276
277
278
279 [[image:attach:VPN_Linux12.png||title="VPN_Linux12.png"]]
280
281 = En cas de problèmes =
282
283 == Problème AnyConnect cannot confirm it is connected to your secure gateway ==
284
285 Lors du démarrage du client Anyconnect, on obtient le message suivant :
286
287 [[image:attach:untrust.png||thumbnail="true" width="300"]]
288
289 Pour résourde ce problème, procédez comme cela :
290
291 1. (((
292 Renommer le dossier ca
293
294 {{code}}
295 cd /opt/.cisco/certificates
296 mv ca ca.orig
297 {{/code}}
298 )))
299 1. (((
300 Nouveau dossier
301
302 {{code}}
303 mkdir ca
304 {{/code}}
305 )))
306 1. Dans le dossier ca, créez un nouveau certificat, vous pouvez le téléchargez à partir de ce fichier :
307 [[attach:vpn.pem]]
308 1. (((
309 Redémarrez le service
310
311 {{code}}
312 /etc/init.d/vpnagentd restart
313 {{/code}}
314 )))
315 1. Et le client, le problème ne devrait plus se poser.
316
317 == Les accès vers les machines privées ne se font pas depuis l'extérieur ==
318
319 Il faut modifier la conf du VPN comme ça :
320
321 [[image:attach:Capture d'écran de 2015-02-03 12:14:28.png]]