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