Skip to content

pimalaya/sirup

Repository files navigation

Sirup Matrix Mastodon

CLI to spawn pre-authenticated IMAP/SMTP sessions and expose them via Unix sockets

Table of contents

Features

  • IMAP support (requires imap cargo features)
  • SMTP support (requires smtp cargo features)
  • TLS support:
    • Native TLS support via native-tls crate (requires native-tls feature)
    • Rust TLS support via rustls crate with:
      • AWS crypto support (requires rustls-aws feature)
      • Ring crypto support (requires rustls-ring feature)
  • SASL support:
  • Pre-authenticated IMAP/SMTP session redirected to Unix sockets via sirup start
  • REPL that can interact with the Unix socket-based IMAP/SMTP session via sirup repl
  • Partial JSON support with --json

Sirup CLI is written in Rust, and relies on cargo features to enable or disable functionalities. Default features can be found in the features section of the Cargo.toml, or on docs.rs.

Installation

Pre-built binary

Sirup CLI can be installed with the installer:

As root:

curl -sSL https://raw.githubusercontent.com/pimalaya/sirup/master/install.sh | sudo sh

As a regular user:

curl -sSL https://raw.githubusercontent.com/pimalaya/sirup/master/install.sh | PREFIX=~/.local sh

These commands install the latest binary from the GitHub releases section.

If you want a more up-to-date version than the latest release, check out the releases GitHub workflow and look for the Artifacts section. You should find a pre-built binary matching your OS. These pre-built binaries are built from the master branch, using default features.

Cargo

Sirup CLI can be installed with cargo:

cargo install sirup

You can also use the git repository for a more up-to-date (but less stable) version:

cargo install --locked --git https://github.com/pimalaya/sirup.git

Nix

Sirup CLI can be installed with Nix:

nix-env -i sirup

You can also use the git repository for a more up-to-date (but less stable) version:

nix-env -if https://github.com/pimalaya/sirup/archive/master.tar.gz

Or, from within the source tree checkout:

nix-env -if .

If you have the Flakes feature enabled:

nix profile install sirup

Or, from within the source tree checkout:

nix profile install

You can also run Sirup directly without installing it:

nix run sirup

Configuration

The wizard is not yet available (it should come soon), meanwhile you can manually edit your own configuration from scratch:

  • Copy the content of the documented ./config.sample.toml
  • Paste it into a new file ~/.config/sirup/config.toml
  • Edit, then comment or uncomment the options you want

Usage

Start an IMAP daemon

$ sirup start

This command spawns a blocking daemon than connects to your IMAP server, performs the TLS negociations if necessary, authenticates yourself, then exposes this session via a Unix socket.

Any client that can connect to, read IMAP response from and write IMAP commands into Unix sockets can interact with your session.

The greeting is replaced by a * PREAUTH [CAPABILITY…] Sirup IMAP pre-auth session ready.

Launch an IMAP REPL

$ sirup repl

S: * PREAUTH [CAPABILITY…] Sirup IMAP pre-auth session ready

C: <Enter your IMAP raw command>

The REPL is just a simple client that connects to the Unix socket and allows you to send raw IMAP commands. It mostly stands for testing purpose, and as a demonstration on how to implement clients.

FAQ

How to debug Sirup CLI?

The simplest way is to use --debug and/or --trace arguments.

The advanced way is based on environment variables:

  • RUST_LOG=<level>: determines the log level filter, can be one of off, error, warn, info, debug and trace.
  • RUST_BACKTRACE=1: enables the full error backtrace, which include source lines where the error originated from.

Logs are written to the stderr, which means that you can redirect them easily to a file:

sirup start example --debug 2>/tmp/sirup.log

Social

Sponsoring

nlnet

Special thanks to the NLnet foundation and the European Commission that have been financially supporting the project for years:

If you appreciate the project, feel free to donate using one of the following providers:

GitHub Ko-fi Buy Me a Coffee Liberapay thanks.dev PayPal