Skip to content
The magma server daemon, is an encrypted email system with support for SMTP, POP, IMAP, HTTP and MOLTEN,. Additional support for DMTP and DMAP is currently in active development.
C Objective-C Shell C++ Python Makefile
Branch: develop
Clone or download


Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings Sender added to message forwarding. Concurrent auth attempts limited. Aug 30, 2017
check Updated the time printing unit test to account for the system timezone. May 22, 2019
lib Updated to OpenSSL 1.0.2s. May 29, 2019
res Altow unicode customer names. Sep 5, 2019
sandbox Updated the magma sandbox config to use console logging (again). May 22, 2019
src Fixed spelling inside error message. Sep 4, 2019
tools Major code cleanup to allow smoother gcc compilation using alt options. Feb 9, 2017
web Added a start and limit params to messages.list camelface function. Nov 16, 2018
.cproject Minor improvements intended to make profiling magma easier. Aug 6, 2018
.gitattributes Avoid profiling the static web content. Jun 10, 2016
.gitignore Updated ClamAV to 0.100.1 and Zlib to 1.2.11. Aug 26, 2018
.project Fixed leaks stemming from the change to the message header struct. Aug 4, 2018
.pydevproject Working realm encryption/decryption in Oct 7, 2016
COPYRIGHT Grammar fixes. Jan 24, 2017
INSTALL fix error message in Install Apr 11, 2018
LICENSE One project to rule them all. One repository to find them. One makefile Dec 11, 2015
Makefile Only look for a TTY if TERM is missing. Mar 23, 2019 Fixed broken link: -> May 1, 2020


Magma was originally designed and developed by Ladar Levison for The current release is currently under heavy development, and some of the features and functions contained herein are unstable. The SMTP, POP, and IMAP protocol handlers are reasonably mature. The DMTP, DMAP and HTTP implementations (along with the bundled webmail system) are still in development. Happy hacking.



Magma Development Machine, v1.0.0

The development machine is a pre-built virtual machine with a graphical desktop and various development tools, and dependencies installed.


Magma Build Machines

For those looking for a slim virtual machine pre-configured to build and run magma, consider the following Vagrant boxes which have been created specifically for that purpose. Images have been created to support the VirtualBox, Hyper-V, VMware, and libvirt Vagrant providers. An official Docker image is on the roadmap, but for the time being you might want to consider one of the community supported images. Use the appropriate command below to download and provision a Vagrant instance.

# VMware
vagrant init lavabit/magma; vagrant up --provider vmware_desktop

# VirtualBox
vagrant init lavabit/magma; vagrant up --provider virtualbox

# libvirt
vagrant init lavabit/magma; vagrant up --provider libvirt

# Hyper-V
vagrant init lavabit/magma; vagrant up --provider hyperv

Images are available for alternate platforms here.


  • Ladar Levison
  • Greg Brown
  • Ivan Tolkachev
  • Princess Levison
  • Ryan Crites
  • Sean Benson
  • Stephen Watt
  • Jacob Adkins

And the army of Kickstarter supporters who contributed to this project.

Tarball Contents


Installation Instructions

These instructions are targeted at systems running CentOS 6.


Install the dependencies (make sure that EPEL is enabled):

yum -y install gcc make autoconf automake binutils bison flex gcc-c++ gettext libtool make patch pkgconfig mysql-server memcached gettext-devel patch perl perl-Time-HiRes check check-devel ncurses-devel libbsd-devel zlib-devel valgrind valgrind-devel


To start MySQL and configure the magma username run the commands below. The supplied password should be replaced with value unique to your environment. You may also want to limit the permissions of the magma database user to the database it will need to access. The global permission is only needed to setup the table schema.

chkconfig mysqld on && service mysqld start

echo "CREATE USER 'magma'@'localhost' IDENTIFIED BY 'volcano';" | mysql -u root
echo "GRANT ALL PRIVILEGES ON *.* TO 'magma'@'localhost' WITH GRANT OPTION;" | mysql -u root


To start Memcached run the commands below.

chkconfig memcached on && service memcached start

Compiling (The Short Way)

make all

Compiling (The Long Way)

To link up the development and build scripts run the This will create a bin folder in your home directory, if it doesn't already exist, and create symbolic links to the scripts and tools used to build, run and test magma. The commands below assume the bin directory is in your PATH. If it isn't, or you simply don't want to create the symbolic links, you can also run the shell scripts directly from their location in the dev/scripts folder. To execute the script:


To build the dependencies and create the library separately, run the build.lib script. Run the script without any parameters to see the possible command line options. To compile and combine all of dependencies in a single operation:

build.lib all

The bundled Makefile can be used to compile magma. It will detect when the dependencies haven't been compiled and run the preceeding step automatically, if necessary, as the Makefile looks for required header files in folders created by the previous step. If the Makefile has trouble finding the necessary include files, odds are its because the previous step didn't run properly. Assuming the dependencies are available, you can compile magmad and magmad.check using:


To setup a sandbox database which can be used to run the unit tests, or experiment with magma, run (assuming the development userid is setup with permission to your database):


To launch the magma unit tests, or magma using the sandbox configuration, run:

To download the ClamAV virus definitions into the sandbox environment, run:



To deploy magma, run the INSTALL script. Note the INSTALL script is out of date, and will need to tweaking to operate perfectly against a copy of the current magma development branch cloned directly via git. Pull requests welcome.

./INSTALL -d ~/ -u magma -p volcano -s Lavabit


The best way to get an issue fixed is to create a pull request with a unit test added to the check folder which reproduces the issue and checks for the expected output. In general, please be sure to run the and scripts before creating a pull request to make sure the newly submitted code doesn't introduce a memory leak, or invalid memory operation.


Inside the res/pages/webmail directory is a compiled copy of the webmail code. Locate script.js file and change the magma.portalUrl = true variable to false, and it will use a set of hard coded test requests/responses. These hard coded requests, and responses are useful for checking/developing the webmail code without a running version of the magma server. Currently the files are configured to access the JSON-RPC interface using the hostname "localhost" and the HTTP port 10000. This should work using the default magma.config and magma.sandbox.config files.

The static files inside the res/pages/webmail folder are compiled using the files inside the web directory. See the web/ file for details.

You can’t perform that action at this time.