Currently the only way to install Swiftfire is to download the source code and compile it yourself. It is the intention to also offer an AppStore download starting from version 1.0

  1. Install OpenSSL (including 2 pieces of glue code)
  2. Install Swiftfire
  3. (Optional) Install server/domain certificates and private keys
Installing OpenSSL

Swiftfire depends on OpenSSL 1.1.0.

A compiled version of openSSL is included in the git repository. However you owe it to your users to discard this version and replace it with a version you build yourself from the official sources.

The version included in the Swiftfire repository was compiled for MacOS 10.12. If another target or OS version is needed a recompilation (from original sources) is necessary.

Existing openSSL libraries on your system cannot be used due to some necessary glue code.

OpenSSL must be installed in location that does not clash with tools (like brew or macports) or with existing libraries. This pretty much rules out the default location that is used by the openSSL installer.

If you decide to use the openSSL from the repository you can skip ahead to “Installing Swiftfire”.

The installation process is described in the reference manual for SecureSockets.

Installing Swiftfire

In a console (terminal) window type the following:

$ git clone https://github.com/Balancingrock/Swiftfire
$ cd Swiftfire
$ swift build

This should build the executable.

If it is planned to work on the code inside from Xcode, perform the following step instead of swift build:

$ swift package generate-xcodeproj

This creates an Xcode project that can also be used to create the executable. Be sure to switch the scheme to the executable though (by default it shows a framework target).

Optional: Install server/domain certificates and private keys

A valid server certificate or a valid domain certificate must be installed before the HTTPS server can run. It is possible to install & update the (private) keys and certificates while the server is running, but site visitors could experience an error during the update process (a retry by the visitor should remedy this).

There are multiple options to install certificates and private key’s.

  • If a single domain is hosted: install only a server certificate with the subject name for that domain.
  • If multiple domains are hosted:
    • Install certificates and keys for each domain. There is no need to install a server certificate/key combination.
    • Install a single server certificate that uses the subject alternate name fields for all the hosted domains.

Note: A certificate must always be accompanied by the private key that was created as a pair with the public key that is contained in the certificate. An error will be raised (in the log targets) if that is not the case.

Install server certificate and private key.

The server certificate and private key must be copied to: ~/Library/Application Support/Swiftfire/ssl/server/. The file with the certificate must be called certificate.pem and must be in the pem format. The file with the private key belonging to the certificate must be called private-key.pem and must be in the pem format.

Install domain certificate and private key.

The server certificate and private key must be copied to: ~/Library/Application Support/Swiftfire/domains/<domain-name>/ssl/. The filename with the certificate must contain the string cert and must be in the pem format. The filename with the private key belonging to the certificate must contain the string key and must be in the pem format.