Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
securesocketfunneling committed Nov 16, 2017
2 parents c674c22 + bcf976f commit e7eadd8
Show file tree
Hide file tree
Showing 497 changed files with 20,187 additions and 11,812 deletions.
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/build
/build-no-security
/build32
/build64
/third_party
/src/framework/tests/proxy/proxy.json
.build*
src/framework/tests/proxy/proxy.json
15 changes: 12 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[submodule "third_party/cmake-build-system"]
path = third_party/cmake-build-system
url = https://github.com/securesocketfunneling/cmake-build-system.git
[submodule "third_party/http-parser/http-parser"]
path = third_party/http-parser/http-parser
url = https://github.com/nodejs/http-parser.git
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
[submodule "third_party/msgpack/msgpack-c"]
path = third_party/msgpack/msgpack-c
url = https://github.com/msgpack/msgpack-c.git
[submodule "third_party/spdlog/spdlog"]
path = third_party/spdlog/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "third_party/cxxopts"]
path = third_party/cxxopts
url = https://github.com/jarro2783/cxxopts.git
67 changes: 67 additions & 0 deletions BUILD_CROSS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Cross compiling SSF
===================

Toolchain
---------

First you need to obtain the toolchain for the target architecture. Choosing
or building the right toolchain is outside of the scope of this document.

In the rest of this document we will use the `arm-linux-gnueabihf` toolchain
which can be used to cross-compile applications for the Raspberry Pi 2/3
platform. On Debian/Ubuntu you can install it using the package manager.

```
# apt-get install g++-arm-linux-gnueabihf
```

Building dependencies
---------------------

SSF depends on Boost and OpenSSL, these need to be cross-compiled separately.
To make your life easier, use the scripts provided in `builddeps/`.

```
$ CROSS_PREFIX=arm-linux-gnueabihf- /path/to/ssf/source/builddeps/build_openssl.sh /path/to/openssl-1.0.2m.tar.gz 1.0.2m /path/to/openssl/prefix/
$ CROSS_PREFIX=arm-linux-gnueabihf- /path/to/ssf/source/builddeps/build_boost.sh /path/to/boost_1_65_1.tar.bz2 1_65_1 /path/to/boost/prefix
```

Building SSF
------------

To cross-compile SSF, you need to tell CMake how to cross-compile. Use the
`cmake/arm-linux-gnueabihf.cmake` configuration file, or customize it
according to your needs.

The toolchain configuration file needs to look like this (adjust the toolchain
tuple `arm-linux-gnueabihf`):

```
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Linux)
CMAKE_FORCE_C_COMPILER(arm-linux-gnueabihf-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(arm-linux-gnueabihf-g++ GNU)
set(CMAKE_SIZEOF_VOID_P 4)
```

**NOTE**: Due to an apparent bug in CMake depending on which version of GCC
the toolchain is using, CMake can choose to ignore the `CMAKE_CXX_STANDARD`
variable. You might want to add the following line to the toolchain
configuration file:

```
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
```

Then, from the build directory, invoke `cmake` specifying your toolchain
configuration file using the `-DCMAKE_TOOLCHAIN_FILE` parameter:

```
$ cmake /path/to/ssf/source -DUSE_STATIC_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=arm-linux-gnueabihf.cmake -DBOOST_ROOT=/path/to/boost/prefix -DOPENSSL_ROOT_DIR=/path/to/openssl/prefix
```

Then proceed to build SSF:

```
$ make
```
77 changes: 77 additions & 0 deletions BUILD_UNIX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Building SSF for Unix
=====================

Get build dependencies
----------------------

SSF depends on Boost and OpenSSL libraries, as well as Kerberos headers.
Install development packages for these using your distro's package manager.

**NOTE**: Boost ASIO appears to be incompatible with OpenSSL 1.1, be sure
to install OpenSSL 1.0.2.

For example, on Debian/Ubuntu:

```
# apt-get install libssl1.0-dev libboost1.62 libboost-dev libkrb5-dev
```

As an alternative, you can also build OpenSSL and/or Boost yourself from
source. The `build_openssl.sh` and `build_boost.sh` scripts in the
`builddeps` folder can be used for that.

Building SSF
------------

Building SSF requires CMake and a C++ compiler.

On Debian/Ubuntu, these can be obtained using apt:

```
# apt-get install cmake g++
```

If you obtained the source for the git repository, make sure the submodules
are checked out:

```
$ git clone https://github.com/securesocketfunnelling/ssf.git
$ git submodule update --init
```

Create a build directory and generate the projet makefiles in it.

```
$ mkdir build
$ cd build
$ cmake /path/to/ssf/source -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=
```

Various parameters can be customized when generating the project files:

* `CMAKE_BUILD_TYPE`: `Debug`, `RelWithDebInfo`, `Release` or `MinSizeRel`. Build type.
* `CMAKE_INSTALL_PREFIX`: Install directory prefix.
* `USE_STATIC_LIBS`: `ON` or `OFF` to enable/disable linking statically against
boost and OpenSSL. It is recommended to set this to `ON` if you intend to build
and run SSF on different environments. The default is `OFF`.
* `USE_STATIC_RUNTIME`: `ON` or `OFF` to enable/disable linking statically
against libstdc++. This is set automatically to the same value as
`USE_STATIC_LIBS`.
* `BUILD_UNIT_TESTS`: `ON` or `OFF` to enable/disable building SSF unit tests.
* `DISABLE_RTTI`: `ON` or `OFF` to disable/enable C++ Run-Time Type Information.
RTTI is enabled by default. SSF does not currently build on Unix without RTTI.
* `DISABLE_TLS`: `ON` or `OFF` to disable/enable TLS layer. Network traffic will
use raw TCP and be left unsecured. Provided for testing purpose only.

Proceed to build SSF:

```
$ make
```

You can install SSF on your system using `make install`. The full install
directory is the content of `CMAKE_INSTALL_PREFIX` prepended to `DESTDIR`.

```
$ make install DESTDIR=/install_path
```
137 changes: 137 additions & 0 deletions BUILD_WIN32.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
Building SSF for Windows
========================

Get build dependencies
----------------------

SSF depends on Boost and OpenSSL libraries. You can choose to build
dependencies yourself, or install prebuilt library packages.

### Using prebuilt packages

Obtain installers for the libraries and install them:

* Boost 1.65.1:

Install `boost_1_65_1-msvc-14.1-32.exe` (32-bit) or
`boost_1_65_1-msvc-14.1-32.exe` (64-bit) from
http://sourceforge.net/projects/boost/files/boost-binaries.
Replace `msvc-14.1` with your version of Visual Studio.

You will then need to point the cmake `BOOST_ROOT` variable to the location
of the boost install (By default: `C:\local\boost_1_65_1`).

* OpenSSL 1.0.2m:

Install `Win32OpenSSL-1_0_2m.exe` (32-bit) or `Win64OpenSSL-1_0_2m.exe` (64-bit)
from https://slproweb.com/products/Win32OpenSSL.html

*NOTE*: OpenSSL versions 1.1 is currently incompatible with Boost.
The latest compatible prebuilt version of OpenSSL is 1.0.2l.

If you have not installed OpenSSL in the default directory (`C:\OpenSSL-Win32`
for `C:\OpenSSL-Win64`), you will need to point the cmake variable
`OPENSSL_ROOT_DIR` to the install location.

### Building dependencies yourself

Boost and OpenSSL dependencies will need to be built manually. Convenience
scripts for automatically building these can be found in the `builddeps`
directory.

7-Zip is required to decompress the source tarballs.

First prepare a build directory, download boost and openssl source and place
them inside the build directory:

```
C:\Users\user> mkdir C:\build
C:\Users\user> cd C:\build
```

Boost 1.65.1 can be downloaded from https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
and OpenSSL 1.0.2m from https://www.openssl.org/source/openssl-1.0.2m.tar.gz

### Building boost

Build Boost using `build_boost.bat`

```
C:\build> C:\path_to_ssf_source\builddeps\build_boost.bat C:\Users\user\Downloads\boost_1_65_1.tar.bz2 1_65_1 32 C:\boost
```

Pass `32` for 32-bit or `64` for 64-bit builds. Boost headers and
libraries will be installed in `C:\boost`

**NOTE**: `build_boost.bat` will build a version of Boost without C++ RTTI
support, when generating the project files prior to building SSF, make sure
`DISABLE_RTTI` is set to `ON`.

**NOTE**: `build_boost.bat` will only build static/runtime static versions of
the boost libraries.

### Building OpenSSL

A Perl distribution is required for building OpenSSL, you can get
Strawberry Perl 5.26.0.2 from http://strawberryperl.com.

The netwide assembler is also required for building OpenSSL. Grab and
install NASM from http://www.nasm.us/.

Make sure `perl.exe` and `nasm.exe` can be found in your environment before
running the following commands (adjust `Path` if needed).

```
C:\build> C:\path_to_ssf_source\builddeps\build_openssl.bat C:\Users\user\Downloads\openssl-1.0.2m.tar.gz 1.0.2m 32 C:\openssl
```

Pass `32` for 32-bit or `64` for 64-bit builds. OpenSSL headers and
libraries will be installed in `C:\openssl`

**NOTE**: `build_openssl.bat` will only build the static/runtime static version
of OpenSSL.

Building SSF
------------

SSF requires CMake and Visual Studio 2017 (2015 should work as well)

If you obtained the source for the git repository, make sure the submodules
are checked out:

```
C:\path_to_ssf_source> git submodule update --init
```

Generate the project files with CMake in your build directory. Point the
`BOOST_ROOT` and `OPENSSL_ROOT_DIR` variables to the correct location
(or leave empty for default settings).

```
C:\build> cmake C:\path_to_ssf_source -DBOOST_ROOT=C:\local\boost_1_65_1 -DOPENSSL_ROOT_DIR=C:\OpenSSL-Win32 -DUSE_STATIC_LIBS=ON
```

Various parameters can be customized when generating the project files:

* `USE_STATIC_LIBS`: `ON` or `OFF` to enable/disable linking statically against
boost and OpenSSL. On windows, you want this to be `ON` in most of the cases.
* `USE_STATIC_RUNTIME`: `ON` or `OFF` to enable/disable linking statically
against the C++ runtime library (msvcrt). This is set automatically to the same
value as `USE_STATIC_LIBS`.
* `BUILD_UNIT_TESTS`: `ON` or `OFF` to enable/disable building SSF unit tests.
* `DISABLE_RTTI`: `ON` or `OFF` to disable/enable C++ Run-Time Type Information.
RTTI is enabled by default. Only disable RTTI if boost libraries have been built
without RTTI.
* `DISABLE_TLS`: `ON` or `OFF` to disable/enable TLS layer. Network traffic will
use raw TCP and be left unsecured. Provided for testing purpose only.

Proceed to build SSF:

```
C:\build> cmake --build . --config Release
```

Binaries are located in: `src\client\Release\ssf.exe`, `src\client\Release\ssfcp.exe`
and `src\server\Release\ssfd.exe`.

Replace `Release` with `Debug` for debug binaries.
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Change Log

## 3.0.0

/!\ BC break with version 2.\*.\*

Features:
* Rename executables:
- `ssfc` -> `ssf`
- `ssfs` -> `ssfd`
* #46 Automatic client reconnection:
- Max unsuccessful connection attempts before stopping (`--max-connect-attemps`)
- Time to wait before attempting to reconnect (`--reconnect-delay`)
- Do not try to reconnect client if connection is interrupted (`--no-reconnect`)
* #39 Windows XP support (use `-T vXXX_xp` CMake option)
* #14 SOCKS proxy support (no authentication), cf. configuration file
* Refactor `ssfcp`:
- Attempt to resume file transfer if the destination file exists (`--resume`)
- Copy files recursively (`-r`)
- Max transfers in parallel (`--max-transfers`)
- Check file integrity at the end of the transfer (`--check-integrity`)
* Refactor logs (use `spdlog` library)
* Refactor command line (use `cxxopts` library)
* Remove `-b` client command line option (replaced by `circuit` configuration file key)
* Compatibility with `boost-1.65.1` and `openssl-1.0.2m`
* Improve build system (cf. [BUILD_WIN32.md](BUILD_WIN32.md), [BUILD_UNIX.md](BUILD_UNIX.md), [BUILD_CROSS.md](BUILD_CROSS.md))
* Use `msgpack` library instead of boost serialization

Fixed bugs:
* #32 SOCKS v5 microservice
* #35 Use `reuse_addr` socket option on `ssfd` and listener microservices (`stream_listener`, `datagram_listener`)
* Improve memory management
* Improve client and server stability

[Configuration file](README.md#configuration-file):
* #41 Add user agent configuration for HTTP proxy (`http_proxy.user_agent` key)
* Allow TLS parameters as buffers (`tls.ca_cert_buffer`, `tls.cert_buffer`, `tls.key_buffer`, `tls.dh_buffer` keys)
* Move circuit configuration into configuration file (`circuit` key)
* Add an option to save command line arguments (`arguments` key)

## 2.2.0

Features:
Expand All @@ -14,7 +52,7 @@ Fixed bugs:
* #25 Fix server DOS on bogus connection
* #26 Fix a hang when the client stops during the connection stage

File configuration:
[Configuration file](README.md#configuration-file):
* `http_proxy.credentials.reuse_ntlm` and `http_proxy.credentials.reuse_kerb`: boolean instead of string

## 2.1.0
Expand Down
Loading

0 comments on commit e7eadd8

Please sign in to comment.