Find a file
Sergei Gunchenko 81979d2380 Pull request #72: Rename license file
Merge in ADGUARD-CORE-LIBS/vpn-libs-endpoint from fix/license to master

Squashed commit of the following:

commit 4add6c95c67ca53009d8a878a7b55dc3da9c279e
Author: Sergei Gunchenko <s.gunchenko@adguard.com>
Date:   Fri Jul 14 17:08:34 2023 +0300

    Rename license file
2023-07-14 19:13:47 +03:00
bamboo-specs Pull request #70: Commit Cargo.lock after version increment 2023-07-12 11:05:24 +03:00
bench Pull request #60: Introduce a setup wizard tool 2023-07-05 12:39:16 +03:00
endpoint skipci: Automatic version increment by Bamboo 2023-07-12 08:05:44 +00:00
lib Pull request #69: Fix increment version + get rid of unused rust-crypto 2023-07-11 15:54:22 +03:00
macros Pull request #60: Introduce a setup wizard tool 2023-07-05 12:39:16 +03:00
scripts Pull request #69: Fix increment version + get rid of unused rust-crypto 2023-07-11 15:54:22 +03:00
tools Pull request #60: Introduce a setup wizard tool 2023-07-05 12:39:16 +03:00
.gitignore Pull request #67: Track Cargo.lock for binaries 2023-07-07 16:43:18 +03:00
Cargo.lock skipci: Automatic version increment by Bamboo 2023-07-12 08:05:44 +00:00
Cargo.toml Pull request #60: Introduce a setup wizard tool 2023-07-05 12:39:16 +03:00
CHANGELOG.md skipci: Automatic version increment by Bamboo 2023-06-26 16:26:51 +00:00
LICENSE Pull request #72: Rename license file 2023-07-14 19:13:47 +03:00
README.md Pull request #60: Introduce a setup wizard tool 2023-07-05 12:39:16 +03:00

AdGuard VPN endpoint

Building

Execute the following commands in the Terminal:

cargo build

to build the debug version, or

cargo build --release

to build the release version.

Endpoint configuration

Library configuration

An endpoint can be configured using a couple of TOML files:

  1. The main library settings reflect (struct Settings in settings.rs).
  2. The TLS hosts library settings reflect (struct TlsHostsSettings in settings.rs). These settings may be reloaded dynamically (see here for details).

All of them may be generated using the setup wizard tool. To configure the most basic options, execute the following command in the Terminal:

cargo run --bin setup_wizard

To see the full set of available options, execute the following command in the Terminal:

cargo run --bin setup_wizard -- -h

Endpoint executable features

Configuration

Some options reside on the application level. Such options can be configured via command line arguments. For example:

  • Sentry DSN is configured by specifying --sentry_dsn <url>
  • Logging level is configured by [--log_level|-l] [info|debug|trace] (info - default)
  • Logging file is configured by --log_file <path>. If not specified, the instance logs to stdout.

To see the full set of available options, execute the following command in the Terminal:

cargo run --bin vpn_endpoint -- -h

Dynamic reloading of TLS hosts settings

The executable is able to reload TLS hosts settings dynamically. To trigger this, send the SIGHUP signal to the process. After receiving, it reparses the TLS hosts settings file that was passed in arguments and applies the new settings.

IMPORTANT: the file paths passed through the settings must remain valid until the process exit or until the next reloading.

Running

To run the binary through cargo, execute the following commands in the Terminal:

cargo run --bin vpn_endpoint -- <path/to/vpn.config> <path/to/tls_hosts.config>

To run the binary directly, execute the following commands in the Terminal:

<path/to/target>/vpn_endpoint <path/to/vpn.config> <path/to/tls_hosts.config>

where <path/to/target> is determined by the build command (by default it is ./target/debug or ./target/release depending on the build type).

Testing with Google Chrome

  1. 2 options:
    • Add the generated certificate to the trusted store and run the Google Chrome
    • Run the Google Chrome from Terminal like this:
    google-chrome --ignore-certificate-errors
    
    IMPORTANT: the second option should be used just for testing, it removes the first line of defence against malicious resources
  2. Set up the endpoint as an HTTPS proxy server in the browser (either via browser settings or using an extension like Proxy SwitchyOmega)

Collecting metrics

Common ways:

  • As plain text: send a GET request to <ip>:<port>/metrics, for example, using CURL or a web browser
  • Set up Prometheus:
    1. Configure the instance to monitor the endpoint metrics (see here)
    2. Use the graph interface

License

Apache 2.0