0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00
Commit Graph

87 Commits

Author SHA1 Message Date
Frank Lichtenheld
eaf9147fcd
Add various moves as suggested by Coverity
Out of all the suggestions by Coverity I picked
the ones that move non-Ptr objects into variables
or attributes.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-01-31 17:02:45 +01:00
Charlie Vigue
b06252bb5d Cleanup API for JSON, map() --> asObject() etc
- .map() --> .asObject()
- .array() --> .asArray()

Required by changes in JSON API

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-01-23 13:21:53 +00:00
Frank Lichtenheld
6b222bccd8 remove some unused variables in catch clauses
MSVC complains about those.
warning C4101: 'e': unreferenced local variable

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2023-06-28 14:22:31 +02:00
David Sommerseth
dde1574596
Reformatting source code to new coding style
This is the result after running 'clang-format -i' on all C++ files and
headers, with the defined formatting rules in .clang-format.

Only the openvpn/common/unicode-impl.hpp has been excluded, as that is
mostly a copy of an external project.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2023-01-18 19:24:15 +01:00
David Sommerseth
4996c38ed4
Merge lastest changes from Core v3.7.2 2022-12-14 17:34:29 +01:00
Frank Lichtenheld
5c5d115619 Fix some "variable set but not used" errors with clang 15
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2022-10-24 13:52:28 +02:00
David Sommerseth
8c94a8f774
copyright: Update to 2022
Signed-off-by: David Sommerseth <davids@openvpn.net>
2022-09-29 12:00:26 +02:00
Heiko Hund
b660e5642b
add support for --dns option
As a first step towards DNS configuration in openvpn and a unified way
to push DNS related settings to clients in v2 and v3, this commit adds
support for parsing the new --dns option. Later commits will add support
for setting up DNS on different platforms.

For now, --dns and DNS related --dhcp-option can be used together for
smoother transition. Settings from --dns will override ones --dhcp-option
where applicable.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2022-02-10 18:35:02 +01:00
Heiko Hund
7f103450f9
respect --http-proxy auth-method
Do not try other auth methods, if a specific method was given
as a third parameter to the --http-proxy config option.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:40:08 +02:00
Heiko Hund
f6000e1f18 add support for --pull-filter option
Port the pull-filter option from openvpn 2.4.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-02-11 02:14:11 +01:00
James Yonan
3555b12a16
push-continuation: added new server-side fragmentor
Includes new unit test for both client and
server-side push-continuation code.

Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:53:00 +02:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
David Sommerseth
6969264a94
Merge changes applied to coming Core release
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-19 18:24:49 +01:00
Lev Stipakov
8bf5c163d6
Improve profile error handling
Introduce new

 - ERR_PROFILE_FILE_IS_BINARY
 - ERR_PROFILE_OPTION

error codes.

Also use "ERR_PROFILE_FILE_TOO_LARGE"
when generic was erronrously used.

Fixes OVPN3-523.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-24 11:52:56 +02:00
James Yonan
6a5430e763 ServerPushList: added JSON parse() method
Signed-off-by: James Yonan <james@openvpn.net>
2019-12-26 03:44:14 -07:00
Antonio Quartulli
3166957e2e
add error codes for better error management at profile parsing time
Prefix error messages with a predefined string of the form:

ERR_PROFILE_xxxxx:

This way a user can parse the prefix and get a better understanding of
the error, without relying on the sole message.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-10-09 17:58:05 +02:00
James Yonan
cadb712ea9
ProfileMerge: added "static-key" to is_fileref_directive()
Signed-off-by: James Yonan <james@openvpn.net>
2019-05-16 14:50:06 +02:00
Antonio Quartulli
60fcf374fb
tls-crypt-v2: implement WKc appending/unwrapping logic
The client reads the WKc from the key file and appends it to
the HARD_RESET_CLIENT_V3 packet when starting a connection.

The server reads the WKc from the received HARD_RESET_CLIENT_V3 packet,
decrypts and authenticates it (it is encrypted and signed with the
server keys upon generation) and finally extracts the client key.

The client key is then used to initialize the server tls-crypt.
At this point every packet is treated as a standard tls-crypt framed
message (HARD_RESET_CLIENT_V3 included).

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-12-06 09:19:22 +10:00
David Sommerseth
16b10559f2 [OVPN3-140] Update company names in copyrights
OpenVPN Technologies, Inc. change their name to OpenVPN Inc. during the
autumn of 2017.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
David Sommerseth
6caca2c313 [OVPN3-140] Relicense back to AGPLv3
This is essentially a revert of commit 04b2a3c9b7 and commit
ef42e59e05.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
Antonio Quartulli
74c5f4f38f [OVPN3-5] tls-crypt: introduce tls-crypt support
backported from OpenVPN 2.4.x

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
b2cd82a5bf copyright: updated to 2017.
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 13:11:09 -06:00
James Yonan
9c0397ebd3 Added Relay capability, a kind of proxy function similar
to HTTP CONNECT but implemented over the OpenVPN protocol.

1. Client connects to relay server as if it were connecting
   to an ordinary OpenVPN server.

2. Client authenticates to relay server using its client
   certificate.

3. Client sends a PUSH_REQUEST method to relay server which
   then replies with a RELAY message instead of PUSH_REPLY.

4. On receiving the RELAY message, the client attempts to
   reconnect using the existing transport socket.  The
   server will proxy this new connection (at the transport
   layer) to a second server (chosen by the relay server)
   that is the target of proxy.

5. The client must establish and authenticate a new session
   from scratch with the target server, only reusing the
   transport layer socket from the original connection to
   the relay server.

6. The relay acts as a man-in-the-middle only at the
   transport layer (like most proxies), i.e. it forwards
   the encrypted session between client and target server
   without decrypting or having the capability to decrypt
   the session.

7. The client is designed to protect against potentially
   untrusted or malicious relays:

   (a) The client never transmits the target server
       username/password credentials to the relay server.

   (b) The relay forwards the encrypted OpenVPN session
       between client and target server without having
       access to the session keys.

   (c) The client configuration has a special directive
       for relay server CA (<relay-extra-ca>) and relay
       server tls-auth key (<relay-tls-auth>) to allow
       for separation of TLS/crypto configuration between
       relay and target servers.

   (d) The client will reject any PUSH_REPLY messages
       from the relay itself to prevent the relay from
       trying to establish a tunnel directly with the
       client.

Example configuring a client for relay:

  # remote addresses point to the relay server
  remote ... 1194 udp
  remote ... 443 tcp

  # include all other directives for connecting
  # to the target server

  # enable relay mode
  relay-mode

  # constrain the relay server's cert type
  relay-ns-cert-type server

  # include extra CAs that validate the relay
  # server cert (optional).
  <relay-extra-ca>
  -----BEGIN CERTIFICATE-----
  . . .
  -----END CERTIFICATE-----
  </relay-extra-ca>

  # specify the TLS auth key for the relay server
  relay-key-direction 1
  <relay-tls-auth>
  -----BEGIN OpenVPN Static key V1-----
  . . .
  -----END OpenVPN Static key V1-----
  </relay-tls-auth>
2017-03-18 12:24:54 -06:00
James Yonan
32d1b9d714 ServerPushList : optimize reserve() call in parse() method,
and add extend() method.
2017-03-18 12:19:39 -06:00
Samuli Seppänen
04b2a3c9b7 Switch from AGPLv3 to GPLv3
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2017-03-16 14:43:55 +02:00
James Yonan
971abda88f copyright : updated to 2016 2016-09-03 23:29:23 -06:00
James Yonan
98de9cec52 options/servpush.hpp : break out output_arg() functionality
from output_csv().  Use C++11 range-based for loops.
2016-05-05 00:35:02 -06:00
James Yonan
211af3a91b string : rename methods for consistency with in-place/copy
variants of other string methods:

* rename add_trailing() -> add_trailing_copy()
* rename add_trailing_in_place() -> add_trailing()
2016-03-28 09:42:13 -06:00
James Yonan
f9592e17fc In ServerPushList:
* added to_option_list()
* renamed output() to output_csv()
* use C++11 iterators
2016-02-04 15:51:06 -07:00
James Yonan
134ba710f2 ovpn3 core globals cleanup:
1. move all const globals into anonymous namespace
2. make sure that all non-class functions are inline
3. refactor class static data members
2015-11-25 11:34:41 -07:00
James Yonan
99c0f064ef ServerPushList::parse() now accepts directive name. 2015-09-21 11:43:01 -07:00
James Yonan
ba91532554 In merge.hpp, detect multiline breakout attempt. 2015-09-18 21:25:40 -07:00
James Yonan
b75c780cab Renamed boost::intrusive_ptr<T> usage to RCPtr<T>. 2015-05-17 21:26:53 -06:00
James Yonan
35ac9f6229 Renamed types.hpp to size.hpp since it now only defines
size_t and ssize_t.
2015-05-17 13:27:34 -06:00
James Yonan
fe6fcefa61 C++11 : rename NULL to nullptr 2015-05-17 02:53:37 -06:00
James Yonan
cc8af0e641 Added ProfileMergeFromString::merge() method. 2015-04-18 23:52:19 -06:00
James Yonan
8f4b17ce6a Add extension parameter to ProfileMerge constructor to allow
parsing of files with non-ovpn extensions.
2015-02-10 15:48:08 -07:00
James Yonan
d4af03c205 Extended follow_references parameter of ProfileMerge class to allow
for full reference following (e.g. cert ssl/serv.crt) as is helpful
in server-side environments.
2015-01-19 14:30:37 -07:00
James Yonan
c2c7292a70 Updated copyright to 2015. 2015-01-06 12:56:21 -07:00
James Yonan
464690aa6b Added class ServerPushList for keeping track of
push "..." directives on the server.
2014-12-29 21:51:08 -07:00
James Yonan
2c6d972ad6 Added AGPL copyright/licensing language. 2014-07-20 21:22:06 -06:00
James Yonan
c77af1e85a Core: added CRL support (crl-verify directive) to PolarSSL module. 2014-04-22 01:55:05 -06:00
James Yonan
6fcceb6809 Core: fixed typo in merge.hpp where "auto-nct" was incorrectly
given as "auth-nct".
2014-01-08 21:05:24 -07:00
James Yonan
baca5e05d5 Core proxy changes:
Added support for "http-proxy" and "http-proxy-option" directives
in the main section of the config file, outside of <connection>
blocks.

Added <http-proxy-user-pass> multiline directive for inlining
proxy creds:

  <http-proxy-user-pass>
  user
  pass
  </http-proxy-user-pass>

Merge class now knows how to expand creds file inline.
For example,

  http-proxy ntlm.yonan.net 3128 auth.txt

is converted to:

  http-proxy ntlm.yonan.net 3128 auto
  <http-proxy-user-pass>
  user
  pass
  </http-proxy-user-pass>
2013-12-30 16:17:22 -07:00
James Yonan
ec084a0c71 Profile merge code now can merge external auth-user-pass cred files. 2013-12-22 17:06:23 -07:00
James Yonan
cf39be0516 Log unused options, i.e. options specified in config file that were
unrecognized, ignored, or unused.

This behavior is somewhat different (by design) to 2.x branch, which
will raise a fatal exception if an unrecognized option is
encountered.
2013-06-10 00:42:19 +00:00
James Yonan
bbaaf65b0a Fixed options parsing issue if non-aggregate option was
specified in profile as well as pushed by server
(the pushed version should win).
2013-05-25 01:13:11 +00:00
James Yonan
cebc610e8e Implemented route-nopull (second attempt). 2013-03-14 02:54:58 +00:00
James Yonan
6c0be1e1c0 iOS: 1.0.1 build 55
Android: 1.1.9 build 31

* Reverted key-direction back to a default of 1.

* Raise fatal error if "fragment" option is used.

* Made TunBuilderCapture more useful as a base class for
  tun construction on various platforms.

* Added disableClientCert flag at ovpncli.hpp API.

* Updated help FAQ with more details on how to
  properly set key-direction, and notes about
  possible network disconnect during voice calls.
2013-01-24 13:34:17 +00:00
James Yonan
d5874f4684 Misc client and pre-server cleanup. 2012-11-26 01:51:24 +00:00