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

529 Commits

Author SHA1 Message Date
James Yonan
e3388ff1ec On Mac, create a DNS watchdog thread to monitor for potential changes
to DNS settings by a foreign actor.  If changes are detected,
revert them.
2014-03-24 17:23:17 -06:00
James Yonan
91f82f1276 cli wrapper now handles SIGUSR1/SIGUSR2:
SIGUSR1: print stats
SIGUSR2: toggle pause/resume state
2014-03-24 16:53:19 -06:00
James Yonan
68a6b6d730 On Mac OS X, slightly tweak the DNS cache flush method
based on current OS X version.  The cache flush method
is called on connect and disconnect.

Previously, we always followed the 10.9 method.  So this
change is a no-op on 10.9.

OS X 10.9 or higher (Mavericks):

  /usr/bin/dscacheutil -flushcache
  /usr/bin/killall -HUP mDNSResponder

OS X 10.7 & 10.8 (Lion and Mountain Lion):

  /usr/bin/killall -HUP mDNSResponder

OS X 10.6 (Snow Leopard)

  /usr/bin/dscacheutil -flushcache

We don't support earlier OS X versions.
2014-03-21 17:07:17 -06:00
James Yonan
1cb534053b Core: further attempts to disable SSL renegotiation and/or session
resumption due to Triple Handshake vulnerability.

OpenSSL driver: Set SSL_OP_NO_TICKET flag.

PolarSSL build: #undef POLARSSL_SSL_SESSION_TICKETS
2014-03-15 15:18:35 -06:00
James Yonan
05aa744dce TunWin::Client now tries to delete any stale routes on
interface left over from previous session.
2014-03-06 19:08:57 -07:00
James Yonan
141182e21e Support pushed DNS search domains in TunWin::Client. 2014-03-06 00:27:41 -07:00
James Yonan
c1cf0d7375 In ActionList::execute(), catch exceptions and log them. 2014-03-06 00:27:41 -07:00
James Yonan
1d825fcc20 When setting DNS servers on Windows, use netsh option
"register=primary".  This appears to improve DNS
responsiveness.
2014-03-06 00:27:41 -07:00
James Yonan
b414dc6d12 * TunWin::Client now configures a default gateway for the IPv4
side of the TAP interface using the "gateway=" option in the
  netsh interface ip set address command.  This seems to mostly
  solve the issue of the TAP adapter appearing to be unconnected
  to the internet in the Control Panel.

* Adapted TunWin::Client to work with ActionList (instead of
  WinCommandList) as the mechanism for executing netsh commands.

* Included sample code (test/unused/win-tuncli-actionthread.diff)
  for embedding an ActionThread in TunWin::Client.
2014-03-06 00:27:41 -07:00
James Yonan
9e35e41fb4 Added ActionThread class to allow Action objects to be
executed asynchronously in a worker thread.

Needed to make some changes to logthread as well
to allow log context to be made available to
the worker thread.
2014-03-06 00:27:41 -07:00
James Yonan
074dbafa27 Ported minicrypto lib to OS X for PolarSSL optimization.
These scripts

  scripts/mac/build-minicrypto
  scripts/mac/build-polarssl

will now build PolarSSL (on OSX) with libminicrypto linkage.
Currently, only SHA1/256/512 implementations from OpenSSL are
built in libminicrypto.  We leave the current PolarSSL AES
implementation as-is since it now implements AES-NI.

Also added portable openssl/build-openssl script.
2014-03-04 17:42:00 -07:00
James Yonan
ebd47cb635 Updated PolarSSL crypto self-test in the core for PolarSSL 1.3.x
using new shaX method names.  Also updated proto.cpp test suite
to run SelfTest::crypto_self_test on startup.
2014-03-04 10:42:07 -07:00
James Yonan
48fd793c4e Minor changes to test suite test/ssl/proto.cpp:
* On Windows, allow build parameters to be specified in
  protowin.h.

* For client and server, initialize tls_version_min to
  TLSVersion::UNDEF.
2014-03-03 18:43:13 -07:00
James Yonan
b95c7dff1a Core: when tls-version directive is unspecified, internally
represent that as TLSVersion::UNDEF.  For OpenSSL driver,
TLSVersion::UNDEF will trigger legacy TLSv1 connections
using TLSv1_server_method() and TLSv1_client_method().
2014-03-03 18:38:44 -07:00
James Yonan
ce70a32578 Core: implement force_aes_cbc_ciphersuites for OpenSSL. 2014-03-03 16:52:18 -07:00
James Yonan
e1b91621e6 Fixed minor issue with test/ovpncli/cli.cpp on Windows where it
was not draining the keyboard input buffer after every sample
period, potentially causing delays in handling of keyboard events.
2014-03-03 15:48:52 -07:00
James Yonan
12480e2efd Core: ported PolarSSL driver from PolarSSL 1.2.10 -> 1.3.4. 2014-03-03 14:50:52 -07:00
James Yonan
bd02377947 Changes to core self test test/ssl/proto.cpp :
* Fixed compile issue due to need to replace cc.enable_debug()
  with cc.ssl_debug_level = 1.

* Added RENEG var to control number of "virtual seconds" between
  SSL renegotiations.

* Doc changes in README.txt.
2014-03-03 14:43:38 -07:00
James Yonan
4491ce194f Added --google-dns, -g, enable Google DNS fallback option to
cli.cpp frontend.
2014-03-03 14:41:25 -07:00
James Yonan
5975b4b53c Core build script changes:
* Added new cross-platform boost/build-boost script.

* Added new LINK_MODE var (static|shared) that is
  used by Boost, PolarSSL, and OpenSSL (Linux) builds.

* More DEP_DIR flexibility:
  (a) DEP_DIR can be defined prior to call of build-all scripts.
  (b) On Linux, vars-linux script will not override DEP_DIR.
2014-03-03 14:34:39 -07:00
James Yonan
a76c67f63c On Mac OS X, build now defaults to utun-only and
BOOST_ASIO_DISABLE_KQUEUE is left undefined.  To enable
fallback to Mac TunTap driver, MAC_TUNTAP_FALLBACK
and BOOST_ASIO_DISABLE_KQUEUE must be defined.
2014-02-27 23:05:11 -07:00
James Yonan
fbf3f82ee0 Removed the first two parameters from tun_builder_reroute_gw
(const std::string& server_address and bool server_address_ipv6)
because they are redundant.  The same info is passed via
tun_builder_set_remote_address.
2014-02-27 21:51:28 -07:00
James Yonan
7d4201a853 Added utun implementation for Mac OS X. If the current config
is layer 3 and the utun device is available, try to use it.
Otherwise, fall back to Mac OS X tuntap device.
2014-02-27 21:23:56 -07:00
James Yonan
6900658a39 Fixed issue where OPENVPN_SIMPLE_EXCEPTION_INHERIT
instantiation was failing due to lack of a default constructor.
2014-02-27 21:21:54 -07:00
James Yonan
28bf9b2a15 Added full support for OpenVPN 3 on Mac OS X (10.6 and higher)
including DNS and IPv6 support.
2014-02-27 18:34:17 -07:00
James Yonan
611cf24a38 Misc improvements to Apple CF (Core Foundation) wrappers:
* More flexible type casting.
* Support C++11 move constructors.
* Added some additional dictionary and array methods.
* mutable_dict_copy now verifies that passed src dictionary
  is defined.
2014-02-27 18:09:03 -07:00
James Yonan
d36ce05b23 Changed cli build doc to reflect the fact that HYBRID=1 build fails
on Mac OS X 10.6.  Going forward on OS X, we will probably need to
move away from HYBRID model to pure PolarSSL.  AES-NI support in
PolarSSL 1.3 helps us here.
2014-02-27 18:01:16 -07:00
James Yonan
382f8a2828 Mac OS X build script changes to allow building "fat" 32/64-bit
binaries with minimum deployment target of OS X 10.6.
2014-02-27 17:57:38 -07:00
James Yonan
5c77bb1c10 Forgot to add inline modifier to a standalone method
in Windows tunutil.hpp.
2014-02-24 14:27:55 -07:00
James Yonan
d1f8591422 Removed spurious #include <process.h> from Windows
tuncli.hpp, which is no longer needed because
CreateProcess is now used.
2014-02-24 13:41:33 -07:00
James Yonan
282556997c Added TunIO callback tun_error_handler() to inform parent
of errors.  Use this callback to detect STATUS_CANCELLED
returns from Windows TAP driver which translates to
ERROR_OPERATION_ABORTED 995 (0x3E3) from userspace.
This will trigger a fatal error in the client
Error::TUN_IFACE_DISABLED ("TAP adapter is disabled").
2014-02-21 12:47:03 -07:00
James Yonan
aa92a7a522 When exceptions occur in TUN interface setup, make sure to
call close method on tun_persist object rather than merely
deleting the smart pointer (because other references could
still exist, preventing immediate close).
2014-02-21 12:28:18 -07:00
James Yonan
aa26213b3e Modified Win::call() method to use SHGetFolderPath
instead of SHGetKnownFolderPath when built on
pre-Vista.
2014-02-21 12:22:39 -07:00
James Yonan
3c28461021 Windows build script changes:
* Raised minimum deployment target to Vista (from XP).

* Added shell32.lib and ole32.lib to link path to
  accommodate calls to SHGetKnownFolderPath.
2014-02-20 17:27:55 -07:00
James Yonan
8b3dd0b8d5 Added Win::call() method for executing system commands from Windows
in a way that is path-safe and usable in non-console apps.

Modified WinCommandList to use Win::call().
2014-02-20 17:17:56 -07:00
James Yonan
86ed980149 Added ScopedHANDLE::ref() method. 2014-02-20 17:12:38 -07:00
James Yonan
33f6153f34 Added ScopedPtr<T>::ref() method. 2014-02-20 17:10:57 -07:00
James Yonan
b84b48fb75 Ported to Windows.
Implemented full TunClient class for Windows with TAP driver
support.  For now, we use netsh (rather than TAP driver DHCP)
to set all tunnel adapter properties, as this appears to work
great on Windows 7.

IPv6 is fully supported.

Known isues:

* netsh doesn't have a command for adding DNS search domains, so
  we don't support them yet.

* While we always try to remove routes and added properties from
  TAP adapter instance when we close out the session, for robustness,
  when we bring up TAP adapter, we should try to delete any stale
  routes on interface left over from previous session.

* Right now we call netsh with system().  For security and
  compatibility with Windows apps (not only console apps),
  we should use CreateProcess instead.
2014-02-16 01:13:26 -07:00
James Yonan
9ee894a427 Added cli option to enable tunPersist:
--persist-tun, -j    : keep TUN interface open across reconnects
2014-02-16 01:04:19 -07:00
James Yonan
f14ace5ed0 Core: Fixed issue where ClientConnect::reconnect(seconds) method
was not sending explicit_exit_notify message on the session being
closed out.
2014-02-16 00:57:52 -07:00
James Yonan
541a9f89d2 Core: Relax check when topology net30 is mixed with ifconfig-ipv6.
Previously we threw an exception that "only topology 'subnet'
supported with IPv6".  Now we just ignore it because the
topology setting doesn't really affect IPv6.
2014-02-16 00:52:52 -07:00
James Yonan
7063c2355d Minor formatting change to TunBuilderCapture. 2014-02-16 00:47:53 -07:00
James Yonan
e8be2d6956 Added operator()() convenience method to ScopedPtr to return
raw pointer.
2014-02-16 00:44:49 -07:00
James Yonan
daf46e1052 Added some new methods to IP::Addr and IPv4::Addr that are needed
by Windows.
2014-02-16 00:42:24 -07:00
James Yonan
c91beca441 Moved OPENVPN_STRINGIZE(x), a macro that puts double-quotes
around x, into its own source file in common.  Modified
exception.hpp to reference it.
2014-02-16 00:37:50 -07:00
James Yonan
7c0329b5b3 Added support for "dhcp-option WINS" directives, and added
tun_builder_add_wins_server method to TunBuilderBase.
2014-02-16 00:30:49 -07:00
James Yonan
4f4571ee30 More additions to TunPersist for Windows:
* Allow DestructorBase object to be bound to TunPersist-owned
  SCOPED_OBJ object, so that DestructorBase::destroy() is guaranteed
  to be called before SCOPED_OBJ destruction.  This is used as a
  mechanism to remove routes and other properties of the Windows
  TAP adapter that must be unwound when the TAP adapter is closed.

* Added ScopedAsioStream to allow an Asio stream object to
  be managed by a TunPersist object.

* Added TunPersistAsioStream which supports that subset of the Asio
  stream interface required by TunIO, and is intended to wrap a
  ScopedAsioStream embedded in a TunPersist object.
  It is used primarily on Windows to wrap the TAP interface HANDLE
  in way that plays well with Windows I/O completion ports (once
  a HANDLE is bound to an I/O completion port it cannot be unbound).
2014-02-16 00:14:36 -07:00
James Yonan
544164ecad Made a new directory "persist" under "tun" and moved tunpersist.hpp there. 2014-02-15 23:57:09 -07:00
James Yonan
7539c4e0d1 Added gateway parameter to tun_builder_add_address for Windows and other
platforms that lack a VPN API.
2014-02-15 23:34:33 -07:00
James Yonan
3089e6551a Made TunUnixBase template completely portable (supports all Unix
variants, Mobile, and Windows) and renamed it to TunIO.
2014-02-15 16:31:32 -07:00