Building From Source
There are three things you need to build Cascade: a C toolchain, OpenSSL, and Rust. You can run Cascade on any operating system and CPU architecture where you can fulfil these requirements.
Dependencies
To get started, you need a C toolchain and OpenSSL because the cryptographic primitives used by Cascade require it. You also need Rust, because that’s the programming language that Cascade has been written in. Additionally, you need a few tools used by Cascade. However, they are installed together with Cascade in the steps below.
C Toolchain
Some of the libraries Cascade depends on require a C toolchain to be present. Your system probably has some easy way to install the minimum set of packages to build from C sources. For example, this command will install everything you need on Debian/Ubuntu:
apt install build-essential
If you are unsure, try to run cc on a command line. If there is a complaint about missing input files, you are probably good to go.
OpenSSL
Your system will likely have a package manager that will allow you to install OpenSSL in a few easy steps. On Debian and Ubuntu this is usually libssl-dev. You will also need pkg-config for discovery of system libraries. On Red Hat Enterprise (RHEL) you will most likely need to install openssl-devel.
On Debian-like Linux distributions it should be as simple as running:
apt install libssl-dev pkg-config
Rust
The Rust compiler runs on, and compiles to, a great number of platforms, though not all of them are equally supported. The official Rust Platform Support page provides an overview of the various support levels.
While some system distributions include Rust as system packages, Cascade relies on a relatively new version of Rust, currently {‘workspace’: True} or newer. We therefore suggest using the canonical Rust installation via a tool called rustup.
Assuming you already have curl installed, you can install rustup and Rust by simply entering:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Alternatively, visit the Rust website for other installation methods.
Tip
During installation rustup will attempt to configure the
PATH. Modifications to PATH may not take effect until the console
is restarted, or the user is logged out, or it may not succeed at all. If,
after installation, running rustc --version in the console
fails, this is the most likely reason.
Building
In Rust, a library or executable program such as Cascade is called a crate. Crates are published on crates.io, the Rust package registry. Cargo is the Rust package manager. It is a tool that allows Rust packages to declare their various dependencies and ensure that you’ll always get a repeatable build.
Cargo fetches and builds Cascade’s dependencies into an executable binary for your platform. By default, you install from crates.io, but you can for example also install from a specific Git URL, as explained below.
Installing the latest Cascade (and dnst, a runtime dependency) is as simple as running:
cargo install --locked --git https://github.com/nlnetlabs/cascade cascade cascaded
cargo install --locked --bin dnst --git https://github.com/nlnetlabs/dnst dnst
The command will build Cascade and install it in the same directory that
Cargo itself lives in, likely $HOME/.cargo/bin. Ensure this directory is
in your PATH so you can run Cascade immediately.
If you want to use a PKCS#11 compatible Hardware Security Module (HSM) with Cascade, also install the cascade-hsm-bridge with:
cargo install --locked --git https://github.com/nlnetlabs/cascade-hsm-bridge
Finally, before running Cascade you will need to create a few directories and
Cascade’s config file. Create the directory where you want to store the config
(let’s say ./cascade for this example), and generate an example
config file:
mkdir ./cascade
cascade template config > ./cascade/config.toml
Then update the config.toml to use the appropriate paths.
Updating
Tip
Read the general updating instructions first.
If you want to update to the latest version of Cascade, it’s recommended to update Rust itself as well, using:
rustup update
Use the --force option to overwrite an existing version with the latest
Cascade release:
cargo install --locked --force --git https://github.com/nlnetlabs/cascade cascade cascaded
cargo install --locked --force --bin dnst --git https://github.com/nlnetlabs/dnst
If you are using cascade-hsm-bridge, update it with:
cargo install --locked --force --git https://github.com/nlnetlabs/cascade-hsm-bridge
Installing Specific Versions
If you want to install a specific version of Cascade using Cargo, explicitly
use the --version option. If needed, use the --force option to
overwrite an existing version:
cargo install --locked --force --git https://github.com/nlnetlabs/cascade --tag 0.1.0-alpha3 cascade cascaded
Make sure to install a compatible version of dnst.
All new features of Cascade are built on a branch and merged via a pull
request, allowing you to
easily try them out using Cargo. If you want to try a specific branch from
the repository you can use the --git and --branch options:
cargo install --git https://github.com/NLnetLabs/cascade.git --branch main cascade cascaded
See also
For more installation options refer to the Cargo book.