connecting.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <PAGE>
  2. <INCLUDE file="inc/header.tmpl" />
  3. <VAR match="VAR_SEL_STARTED" replace="selected" />
  4. <VAR match="VAR_SEL_CONNECTING" replace="selected" />
  5. <PARSE file="menu1.xml" />
  6. <PARSE file="menu2-started.xml" />
  7. <INCLUDE file="inc/content.tmpl" />
  8. <h1>Connecting to the VPN</h1>
  9. <p>Once you have <a href="building.html">installed</a> OpenConnect and checked that you have a
  10. <a href="vpnc-script.html">vpnc-script</a> which will set up the routing and DNS for it, using OpenConnect
  11. is very simple. As root, run the following command for an AnyConnect/ocserv VPN:
  12. <ul>
  13. <li><tt>openconnect https://vpn.mycompany.com/</tt></li>
  14. </ul>
  15. For one of the other <a href="protocols.html">supported protocols</a>, you'll need to add <tt>--protocol</tt>.
  16. For example, for a PAN GlobalProtect VPN:
  17. <ul>
  18. <li><tt>openconnect --protocol=gp https://vpn.mycompany.com/</tt></li>
  19. </ul>
  20. </p>
  21. <p>That should be it, if you have a password-based login. If your VPN uses
  22. <a href="https://en.wikipedia.org/wiki/Client_certificate">TLS/SSL client certificates</a> for authentication,
  23. you'll need to tell OpenConnect where to find the certificate with the <tt>-c</tt> option.</p>
  24. <p>You can provide the certificate either as the file name of a PKCS#12 or PEM file,
  25. or if OpenConnect is built against a suitable version of GnuTLS you can provide the
  26. certificate in the form of a PKCS#11 URI. If the private key is in a separate file
  27. from the certificate, this must be specified with <tt>-k</tt>:
  28. <ul>
  29. <li><tt>openconnect -c cert_and_private_key.pem https://vpn.mycompany.com/</tt></li>
  30. <li><tt>openconnect -c certificate.pem -k private_key.pem https://vpn.mycompany.com/</tt></li>
  31. <li><tt>openconnect -c pkcs11:id=X_%b04%c3%85%d4u%e7%0b%10v%08%c9%0dA%8f%3bl%df https://vpn.mycompany.com/</tt></li>
  32. <li><tt>openconnect -c system:win:id=37835fdcdfe2817ee22d6b161e54812fe95867fe https://vpn.mycompany.com/</tt></li>
  33. </ul>
  34. </p>
  35. <p>
  36. See the <a href="manual.html">manual</a> for additional options which can be used to tune
  37. OpenConnect's connections, and automate various aspects of the authentication process (e.g.
  38. populating multi-factor authentication codes using RSA- or OATH-based soft tokens).
  39. </p>
  40. <h2>Windows certificate store</h2>
  41. <p>If your certificate is in the system certificate store, OpenConnect should be able
  42. to use it when built against GnuTLS, as a "<a href="https://www.gnutls.org/manual/html_node/Application_002dspecific-keys.html">system key</a>".
  43. </p>
  44. <p>
  45. To find the <tt>system:win:…</tt> URI to use for your key with the <tt>list-system-keys.exe</tt>
  46. tool included with OpenConnect. Its output might look something like the following:
  47. <table border="1"><tr><td><pre>
  48. Label: (null)
  49. Cert URI: system:win:id=37835fdcdfe2817ee22d6b161e54812fe95867fe;type=cert
  50. Key URI: system:win:id=37835fdcdfe2817ee22d6b161e54812fe95867fe;type=privkey
  51. Cert info: subject `CN=d1ab215ccab521bc', issuer `CN=Token Signing Public Key', serial 0x2ce0193a3ecf4da9f0591cee9158e48ec53a8e54, RSA key 1024 bits, signed using DSA-SHA1 (broken!), activated `2020-05-07 06:48:59 UTC', expires `2020-05-14 06:48:59 UTC', pin-sha256="2XOidBPfppXj4REiuj9fIE3UYQK6TTQIODQajIOiLFi="
  52. </pre></td></tr></table>
  53. You can choose the certificate you need to use, and provide it to OpenConnect with the <tt>-c</tt> argument as shown in the last example above; omitting the <tt>;type=</tt> part.</p>
  54. <p>
  55. Note that as of the time of writing (2022-05-22; GnuTLS v3.7.5), GnuTLS is only able to use keys from the <tt>CERT_SYSTEM_STORE_CURRENT_USER</tt> store in Windows,
  56. not the <tt>CERT_SYSTEM_STORE_LOCAL_MACHINE</tt> or <a href="https://docs.microsoft.com/en-us/windows/win32/seccrypto/system-store-locations">other locations</a>.
  57. This is reported as <a href="https://gitlab.com/gnutls/gnutls/-/issues/1365">GnuTLS issue #1365</a>.
  58. </p>
  59. <p>
  60. Even where the certificate is marked as "non-exportable", some have succeeded in stealing
  61. certificates from their Windows certificate store using tools like
  62. <a href="https://github.com/iSECPartners/jailbreak">Jailbreak</a> and
  63. <a href="https://krestfield.github.io/docs/pki/exporting_a_nonexportable_certificate.html">mimikatz</a>.
  64. </p>
  65. <INCLUDE file="inc/footer.tmpl" />
  66. </PAGE>