Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Numberedheadings

System Preparation

Requirements

To build all of the Moonshot components, you need various packages installed. To install all of these, see below.

Get Xcode for macOS

To get all of the requirements on your macOS platform, you will need to install Xcode and the Xcode command-line extensions:

  1. Install Xcode from the Mac App Store.

  2. Open a Terminal, then install the Xcode Command Line Tools. You will be prompted with a dialog to install the Command Line Tools after a 130MB download.

    bash


  3. If you have never launched Xcode before, do so at least once, or run the following command in your Terminal window.

    bash


Get Packages for macOS

The Moonshot installer is built using Packages (http://s.sudre.free.fr/Software/Packages/about.html). Install it before trying to build the installer.

Install the GNU tools for macOS

You will need to install several GNU tools:

  1. Install GNU m4:

    bash


  2. Install GNU Autoconf:

    bash


  3. Install GNU Automake:

    bash


  4. Install GNU Libtool:

    bash


  5. Install pkg-config

    bash


Install JSON from CPAN

  1. Update CPAN and install JSON:

    bash


Setting build parameters and locations

Just like on Linux, build and installation locations matter, with one vital difference. On macOS, the /usr tree itself is locked down and inaccessible, even for the privileged (root) user. However, locations like /usr/local are open, and with newer versions of the OS, expect this to change.

For the purposes of this set of instructions, we recommend the following:

  1. For all the Moonshot dependencies, including Moonshot itself, the --prefix parameter should be set to /usr/local/moonshot.
    If you decide to change this location, you should appropriately change the locations in the commands in Sections 3 and 5 to your preference.
  2. We recommend that you build all libraries with the -rpath parameter enabled for all libraries to avoid any clashes with other libraries (such as the older version of OpenSSL that macOS ships for compatibility reasons). We have been assured by macOS developers that the clang and libtool tools for macOS support this.
  3. We do NOT recommend using the Apple-provided sources for some libraries (such as Heimdal) as they have various customisations that may negatively impact how Moonshot works, and because Apple categorically WILL NOT support any of their own source sets (we've tried through a Platinum support path and had the support ticket closed and refunded).
    If you DO try using Apple's OpenSource sources and find that things build and function fine, please let us know by commenting on this document (with instructions that we can update this document with).
  4. These instructions should generally be backward-compatible.

Download and build the required external dependencies

Gettext

bash

PCRE

PCRE is required during the build of some later dependencies. Libffi is one of these.

bash

Libffi

Libffi is a dependency of the Glib library that in turn is used by the Moonshot library for some Dbus functionality

bash

OpenSSL

bash

Heimdal

Heimdal requires OpenSSL. Once OpenSSL has built successfully, build Heimdal.

We can safely use an old version (7.3.0) since runtime GSS libraries are taken from the system installation, and newer versions seem to generate invalid moonshot binaries.

bash

LibConfuse

bash

LibEvent 

Libevent requires OpenSSL. Once OpenSSL has built successfully, build Libevent.

bash

Dbus

Dbus is used by the macOS client to communicate with the Moonshot mechanism.

bash

Glib

Glib is required by the Moonshot library.

bash

Jansson

Jansson is used by the Moonshot libraries.

bash

libxml2

libxml2 is used to parse assertions

bash

Checkout the Moonshot source

The Moonshot source code is all stored in a GIT repository at https://github.com/janetuk.

Build Moonshot

Libradsec

Libradsec is used by the Moonshot libraries.

bash


The Moonshot UI

The Moonshot UI contains two components, libmoonshot, which is the interface between the Moonshot mechanism and the Identity Selector, and the Identity Selector itself. Libmoonshot and the Identity Selector can be built together:

  1. Clone the Moonshot UI project:

    bash


    Apple Developer Team ID support

    Optionally, if you have multiple Apple Developer ID certificates for different teams installed, use the optional --with-apple-developer-id=DeveloperTeamID parameter to specify the ID that is shown in brackets in the certificates. The build currently does not support Mac Developer certificates.

    To disable Apple Developer Team ID checks and signing, specify --with-apple-developer-id=no


  2. Build Libmoonshot:

    bash

    Pay attention to the output the sudo make install command provides and double-check that the library exists in /usr/local/moonshot/lib.

  3. Build the Identity Selector:

    bash


  4. The Moonshot app will be in the ui/macos-ui/build/Release directory. You can then copy it from there to the /Applications folder.


Identity Selector app signing

Currently the Identity Selector is not signed. This is to avoid limitations with macOS sandboxing. However, once we enable signing for the Identity Selector, you should see follow these additional steps:

  1. Pay attention to the output the make app-bundle command provides. You should see something similar to this to show that the build has copied the entitlements and has signed the application:

    bash


  2. If Xcode did not sign the code and you did not disable Apple Developer ID checks and signing in Step 2, sign it manually:

    bash


  3. If you disabled Apple Developer ID checks in Step 2, skip this step. Otherwise verify the signing with the following command; you should have lines like these:

    bash


The Moonshot mechanism

bash


Configure script parameters

There are several parameters in the command above that rely on locations noted down previously:

COMPILE_ET contains the full path to the compile_et binary that will be in your Heimdal build tree. You noted this down in the last step of Section 3.1.5.


You should now have a mech_eap.so file in /usr/local/moonshot/lib/gss.

Test Moonshot

To test this build of Moonshot, you will need to make some privileged changes to the system you built this on:

  1. In /etc, create a gss directory:

    bash


  2. Copy the mech file from the Moonshot mech_eap build directory to /etc/gss

    bash


  3. As the privileged user, edit the /etc/gss/mech file:
    1. Change the mech_eap.so entry on each line to the full path of the library, e.g. /usr/local/moonshot/lib/gss/mech_eap.so
    2. Save the file.
  4. Copy the Identity Selector app (Moonshot.app) you built in Step 2 of Section 5.2 above into the /Applications folder.

  5. Run the Identity Selector app from the Launch Pad, then add a new Moonshot identity to the app.
  6. Run an SSH command to a Moonshot-enabled system that the credentials you added in the previous step will be valid for:

    bash


    Jisc Assent

    If you have an identity provider on the Jisc Assent network, you can use ssh -Kv moonshot@test-sp.infr.assent.ti.ja.net to test whether your macOS Moonshot mechanism worked successfully.


  7. You should be prompted for an identity the first time you do this, and then successfully connect to the service. You should see several lines like this in the output:

    bash


    Jisc Assent

    On the Jisc Assent Test SSH Service, the final output for success will be this:

    bash



Distribute and install Moonshot

To distribute this binary set, you will need to trim down the binaries you have built to include only the dynamic libraries and only bare essentials needed to run the mechanism:

Automatic build

The macos-ui directory in the moonshot-ui/ tree has a Makefile that will automatically run all the build steps in Section 7.2.

  1. Change to the macos-ui directory, run make installer.
  2. The final result should be a signed (if you chose to use Apple Developer ID support) Moonshot.dmg file in the macos-ui directory.

Manual build

Create the distribution archive for the mechanism

  1. Make a tarball with the required libraries and binaries from the /usr/local/moonshot directory into the Installer directory as the privileged user. The filemanifest.txt file contains the full list of required files.

    bash


The Moonshot Uninstaller utility

The Uninstaller utility is an Xcode project.

  1. Build the Uninstaller utility:

    bash


  2. Pay attention to the output the make uninstaller-bundle command provides. You should see something similar to this to show that the build has copied the entitlements and has signed the application:

    bash


  3. If Xcode did not sign the code and you did not disable Apple Developer ID checks in Section 5.2, Step 2, sign it manually:

    bash


  4. Verify the signing with the following command; you should have lines like these:

    bash


  5. The Uninstall Moonshot app will be in the ui/macos-ui/Uninstaller/build/Release directory. You can then copy it from there to the /Applications folder.

The Moonshot Installer

The Moonshot installer contains the distribution archive, the uninstaller utility, and the Moonshot identity selector.

  1. Change to the Installer folder:

    bash


  2. Copy the Moonshot identity selector app from the Applications folder to the LatestBuild directory
  3. Copy the Uninstall Moonshot app from the ui/macos-ui/Uninstaller/build/Release directory to the LatestBuild directory
  4. Copy the distribution archive you created in Section 8.1 to this directory, replacing the existing local.tar.gz file.
  5. Build the installer:

    bash


  6. Create the Moonshot distribution disk image:

    bash


  7. Copy the resulting Moonshot.dmg to your distribution point.
  8. Generate a checksum for Moonshot.dmg with the following command:

    bash


Issues

Current issues with this build include that the macOS SSH client abandons any gssapi-with-mic conversations if the first mechanism it chooses, fails.

In a domain environment, this usually involves a Kerberos interaction, i.e. where you have received a Kerberos ticket before by logging in or by running kinit. Other ssh clients (or a custom build of the ssh client) may not exhibit this behaviour.

On macOS Sierra and later, the native SSH client is sandboxed when run from its default location in /usr/bin. Making a copy of the binary in /usr/local/bin enables it to authenticate with Moonshot. Adjust /etc/paths to load binaries in /usr/local/bin first, then restart your sessions.

Currently the Moonshot Identity Manager (Moonshot.app) is not signed during the automatic build. This is due to Apple sandboxing the app when it is signed, making it impossible for it to communicate with Dbus (and by extension, the Moonshot mechanism). Not signing the app allows Moonshot authentication to proceed.

On MacOS BIg Sur and later, besides moving the binary you would also need to remove the signature, since signed binaries are sandboxed as well. Use codesign --remove-signature /usr/local/bin/ssh to do so.