Code source wiki de Configuration Linux
Version 29.1 par Stéphane Dugravot le 15/09/2023 - 17:05
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | \\ | ||
2 | |||
3 | {{confluence_section}} | ||
4 | {{confluence_column width="30%"}} | ||
5 | (% style="text-align: center;" %) | ||
6 | [[image:attach:linux.png||title="linux.png"]] | ||
7 | {{/confluence_column}} | ||
8 | |||
9 | {{confluence_column}} | ||
10 | {{panel}} | ||
11 | |||
12 | |||
13 | {{toc/}} | ||
14 | {{/panel}} | ||
15 | {{/confluence_column}} | ||
16 | {{/confluence_section}} | ||
17 | |||
18 | \\ | ||
19 | |||
20 | = Configuration Linux (Ubuntu - Mint) = | ||
21 | |||
22 | 2 solutions : | ||
23 | |||
24 | 1. Via le script d'install Cisco vpn anyconnect | ||
25 | 1. Via le package openconnect (compatible AnyConnect) : Open client for Cisco AnyConnect VPN | ||
26 | |||
27 | \\ | ||
28 | |||
29 | (% class="panelMacro" %) | ||
30 | ((( | ||
31 | |||
32 | ))) | ||
33 | |||
34 | == Via le script d'install Cisco vpn anyconnect == | ||
35 | |||
36 | Sous linux on peux installer le client anyconnect en lancant le script vpnsetup.sh disponible soit : | ||
37 | |||
38 | ici : | ||
39 | |||
40 | * Linux_X86_64 : [[attach:vpnsetup_64b.sh]] ( Version au 13/02/2013) | ||
41 | * Linux_32 : [[attach:vpnsetup_32b.sh]] ( Version au 13/02/2013) | ||
42 | |||
43 | soit | ||
44 | |||
45 | en allant le chercher sur le [[https:~~/~~/vpn.lothaire.net>>url:https://vpn.lothaire.net||shape="rect"]] | ||
46 | |||
47 | \\ | ||
48 | |||
49 | [[image:attach:VPN_Linux1.png||width="800" title="VPN_Linux1.png"]] | ||
50 | |||
51 | puis en cliquant sur le lien ( apres 1, à 2 min) : | ||
52 | |||
53 | [[image:attach:VPN_Linux2.png||title="VPN_Linux2.png"]] | ||
54 | |||
55 | \\ | ||
56 | |||
57 | Une fois le script récuperé, on install le produit : | ||
58 | |||
59 | \\ | ||
60 | |||
61 | {{code language="bash" theme="RDark" title="install_anyconnect"}} | ||
62 | xxxxxx@pcxxxxx ~/Téléchargements $ sudo sh vpnsetup_64b.sh | ||
63 | [sudo] password for xxxxxx: | ||
64 | Installing Cisco AnyConnect Secure Mobility Client... | ||
65 | Removing previous installation... | ||
66 | mv: impossible d'évaluer «/opt/cisco/vpn/*.log»: Aucun fichier ou dossier de ce type | ||
67 | Extracting installation files to /tmp/vpn.zFF5b4/vpninst095927597.tgz... | ||
68 | Unarchiving installation files to /tmp/vpn.zFF5b4... | ||
69 | Starting the VPN agent... | ||
70 | Done! | ||
71 | |||
72 | |||
73 | {{/code}} | ||
74 | |||
75 | {{confluence_tip title="Remarque Linux MINT"}} | ||
76 | pour les utilisateur de Linux MINT : Il est nécessaire d'installer la librairie **libpangox** | ||
77 | {{/confluence_tip}} | ||
78 | |||
79 | \\ | ||
80 | |||
81 | on doit rebooter sa machine, pour voir apparaître dans un menu l'application "Cisco Anyconnect Secure Mobility Client" : | ||
82 | |||
83 | [[image:attach:VPN_Linux3.png||title="VPN_Linux3.png"]] | ||
84 | |||
85 | ** | ||
86 | ** | ||
87 | |||
88 | on le lance : | ||
89 | |||
90 | **[[image:attach:VPN_Linux4.png||title="VPN_Linux4.png"]]** | ||
91 | |||
92 | ** | ||
93 | ** | ||
94 | |||
95 | **on accepte le certificat et on peut se connecter :** | ||
96 | |||
97 | ** | ||
98 | ** | ||
99 | |||
100 | **[[image:attach:VPN_Linux5.png||title="VPN_Linux5.png"]]** | ||
101 | |||
102 | **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."** | ||
103 | |||
104 | **c'est qu'il manque le certificat TERENA SSL CA, que l'on peut récupérer ici :** | ||
105 | |||
106 | * **[[attach:DigiCertCA.crt]]** | ||
107 | |||
108 | === Fichier XML pour la configuration d'anyconnect === | ||
109 | |||
110 | Dans le cas ou il y a plusieurs concentrateur vpn à gérer. | ||
111 | |||
112 | Fichier à installer dans : | ||
113 | |||
114 | * MacOS X : /opt/cisco/anyconnect/profile | ||
115 | * Windows : (% class="content" %)C:\ProgramData\Cisco\Cisco AnyConnect VPN Client\Profile\ | ||
116 | |||
117 | Mettre un nom suffixé **.xml** | ||
118 | (% class="content" %)\\ | ||
119 | |||
120 | {{code}} | ||
121 | <?xml version="1.0" encoding="UTF-8"?> | ||
122 | |||
123 | <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" | ||
124 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
125 | xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd"> | ||
126 | <ClientInitialization> | ||
127 | <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon> | ||
128 | <CertEnrollmentPin>pinAllowed</CertEnrollmentPin> | ||
129 | <CertificateMatch> | ||
130 | <KeyUsage> | ||
131 | <MatchKey>Non_Repudiation</MatchKey> | ||
132 | <MatchKey>Digital_Signature</MatchKey> | ||
133 | </KeyUsage> | ||
134 | <ExtendedKeyUsage> | ||
135 | <ExtendedMatchKey>ClientAuth</ExtendedMatchKey> | ||
136 | <ExtendedMatchKey>ServerAuth</ExtendedMatchKey> | ||
137 | <CustomExtendedMatchKey>1.3.6.1.5.5.7.3.11</CustomExtendedMatchKey> | ||
138 | </ExtendedKeyUsage> | ||
139 | <DistinguishedName> | ||
140 | <DistinguishedNameDefinition Operator="Equal" Wildcard="Enabled"> | ||
141 | <Name>CN</Name> | ||
142 | <Pattern>ASASecurity</Pattern> | ||
143 | </DistinguishedNameDefinition> | ||
144 | <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled"> | ||
145 | <Name>L</Name> | ||
146 | <Pattern>Boulder</Pattern> | ||
147 | </DistinguishedNameDefinition> | ||
148 | </DistinguishedName> | ||
149 | </CertificateMatch> | ||
150 | </ClientInitialization> | ||
151 | <ServerList> | ||
152 | <HostEntry> | ||
153 | <HostName>UL</HostName> | ||
154 | <HostAddress>vpn.lothaire.net</HostAddress> | ||
155 | </HostEntry> | ||
156 | </ServerList> | ||
157 | </AnyConnectProfile> | ||
158 | {{/code}} | ||
159 | |||
160 | \\ | ||
161 | |||
162 | == Via le package Openconnect en CLI == | ||
163 | |||
164 | Installation préalable : | ||
165 | |||
166 | {{code}} | ||
167 | sudo apt-get install openconnect | ||
168 | {{/code}} | ||
169 | |||
170 | \\ | ||
171 | |||
172 | Commande : | ||
173 | |||
174 | {{code}} | ||
175 | sudo openconnect -u dugravot6@dn-infra --authgroup='Universite-de-Lorraine' --no-cert-check vpn.lothaire.net | ||
176 | {{/code}} | ||
177 | |||
178 | \\ | ||
179 | |||
180 | == Via le package Openconnect avec Network-Manager == | ||
181 | |||
182 | On installe le package openconnect et les plugin network-manager-openconnect, network-manager-openconnect-gnome (fonctionne aussi avec linux mint 18.3 en cinnamon) | ||
183 | |||
184 | \\ | ||
185 | |||
186 | {{code language="bash" theme="RDark" title="Openconnect"}} | ||
187 | sudo apt-get install openconnect network-manager-openconnect network-manager-openconnect-gnome | ||
188 | {{/code}} | ||
189 | |||
190 | Rebooter sa machine , on verra maintenant apparaître dans son module de gestion réseau/VPN un nouveau module "VPN Compatible Cisco Anyconnect ( openconnect)" | ||
191 | |||
192 | \\ | ||
193 | |||
194 | [[image:attach:VPN_Linux6.png||title="VPN_Linux6.png"]] | ||
195 | |||
196 | \\ | ||
197 | |||
198 | [[image:attach:VPN_Linux7.png||title="VPN_Linux7.png"]] | ||
199 | |||
200 | \\ | ||
201 | |||
202 | créer , Renseigner uniquement le nomde la connexion et la passerelle | ||
203 | |||
204 | [[image:attach:VPN_Linux8.png||title="VPN_Linux8.png"]] | ||
205 | |||
206 | Pour avoir de bonnes performances il faut activer le Split-Tunnel (seules les connexions nécessaires passent dans le tunnel), | ||
207 | il faut cocher une case dans les paramètres IPV4 > Routes (la traduction française a coupé la phrase) | ||
208 | |||
209 | [[image:attach:openconnect-split-tunnel.jpg||title="openconnect-split-tunnel.jpg"]] | ||
210 | |||
211 | votre nvelle connexion VPN s'affiche maintenant dans votre gestionnaire réseau : | ||
212 | |||
213 | [[image:attach:VPN_Linux9.png||title="VPN_Linux9.png"]] | ||
214 | |||
215 | cocher " Automatically start ....." et cliquer à coté du VPN host pour la connexion : | ||
216 | |||
217 | \\ | ||
218 | |||
219 | [[image:attach:VPN_Linux10.png||title="VPN_Linux10.png"]] | ||
220 | |||
221 | valider le certificat : | ||
222 | |||
223 | [[image:attach:VPN_Linux11.png||title="VPN_Linux11.png"]] | ||
224 | |||
225 | \\ | ||
226 | |||
227 | puis loguer vous : | ||
228 | |||
229 | \\ | ||
230 | |||
231 | [[image:attach:VPN_Linux12.png||title="VPN_Linux12.png"]] | ||
232 | |||
233 | = En cas de problèmes = | ||
234 | |||
235 | == Problème AnyConnect cannot confirm it is connected to your secure gateway == | ||
236 | |||
237 | Lors du démarrage du client Anyconnect, on obtient le message suivant : | ||
238 | |||
239 | [[image:attach:untrust.png||thumbnail="true" width="300"]] | ||
240 | |||
241 | Pour résourde ce problème, procédez comme cela : | ||
242 | |||
243 | 1. ((( | ||
244 | Renommer le dossier ca | ||
245 | |||
246 | {{code}} | ||
247 | cd /opt/.cisco/certificates | ||
248 | mv ca ca.orig | ||
249 | {{/code}} | ||
250 | ))) | ||
251 | 1. ((( | ||
252 | Nouveau dossier | ||
253 | |||
254 | {{code}} | ||
255 | mkdir ca | ||
256 | {{/code}} | ||
257 | ))) | ||
258 | 1. Dans le dossier ca, créez un nouveau certificat, vous pouvez le téléchargez à partir de ce fichier : | ||
259 | [[attach:vpn.pem]] | ||
260 | 1. ((( | ||
261 | Redémarrez le service | ||
262 | |||
263 | {{code}} | ||
264 | /etc/init.d/vpnagentd restart | ||
265 | {{/code}} | ||
266 | ))) | ||
267 | 1. Et le client, le problème ne devrait plus se poser. | ||
268 | |||
269 | == Les accès vers les machines privées ne se font pas depuis l'extérieur == | ||
270 | |||
271 | Il faut modifier la conf du VPN comme ça : | ||
272 | |||
273 | [[image:attach:Capture d'écran de 2015-02-03 12 14 28.png||width="458"]] | ||
274 | |||
275 | \\ |