System PreparationRequirementsTo build all of the Moonshot components, you need various packages installed. To install all of these, see below. Get Xcode for macOSTo get all of the requirements on your macOS platform, you will need to install Xcode and the Xcode command-line extensions: Install Xcode from the Mac App Store. 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
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 macOSThe 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 macOSYou will need to install several GNU tools: Install GNU m4: bash
Install GNU Autoconf: bash
Install GNU Automake: bash
Install GNU Libtool: bash
Install pkg-config bash
Install JSON from CPANUpdate CPAN and install JSON: bash
Setting build parameters and locationsJust 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: - 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. - 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. - 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). These instructions should generally be backward-compatible.
Download and build the required external dependenciesGettextbashPCREPCRE is required during the build of some later dependencies. Libffi is one of these. bashLibffiLibffi is a dependency of the Glib library that in turn is used by the Moonshot library for some Dbus functionality bashOpenSSLbashHeimdalHeimdal 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. bashLibConfusebashLibEvent Libevent requires OpenSSL. Once OpenSSL has built successfully, build Libevent. bashDbusDbus is used by the macOS client to communicate with the Moonshot mechanism. bashGlibGlib is required by the Moonshot library. bashJanssonJansson is used by the Moonshot libraries. bashlibxml2libxml2 is used to parse assertions bashCheckout the Moonshot sourceThe Moonshot source code is all stored in a GIT repository at https://github.com/janetuk. Build MoonshotLibradsecLibradsec is used by the Moonshot libraries. bash
The Moonshot UIThe 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: Clone the Moonshot UI project: bash
Apple Developer Team ID supportOptionally, 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
Build Libmoonshot: bashPay attention to the output the sudo make install command provides and double-check that the library exists in /usr/local/moonshot/lib . Build the Identity Selector: bash
- 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 signingCurrently 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: 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
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
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 mechanismbash
Configure script parametersThere 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 MoonshotTo test this build of Moonshot, you will need to make some privileged changes to the system you built this on: In /etc , create a gss directory: bash
Copy the mech file from the Moonshot mech_eap build directory to /etc/gss bash
- As the privileged user, edit the
/etc/gss/mech file:- 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 - Save the file.
Copy the Identity Selector app (Moonshot.app) you built in Step 2 of Section 5.2 above into the /Applications folder. - Run the Identity Selector app from the Launch Pad, then add a new Moonshot identity to the app.
Run an SSH command to a Moonshot-enabled system that the credentials you added in the previous step will be valid for: bash
Jisc AssentIf 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.
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 AssentOn the Jisc Assent Test SSH Service, the final output for success will be this: bash
Distribute and install MoonshotTo 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 buildThe macos-ui directory in the moonshot-ui/ tree has a Makefile that will automatically run all the build steps in Section 7.2. - Change to the
macos-ui directory, run make installer . - 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 buildCreate the distribution archive for the mechanismMake 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 utilityThe Uninstaller utility is an Xcode project. Build the Uninstaller utility: bash
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
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
Verify the signing with the following command; you should have lines like these: bash
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 InstallerThe Moonshot installer contains the distribution archive, the uninstaller utility, and the Moonshot identity selector. Change to the Installer folder: bash
- Copy the Moonshot identity selector app from the Applications folder to the
LatestBuild directory - Copy the Uninstall Moonshot app from the
ui/macos-ui/Uninstaller/build/Release directory to the LatestBuild directory - Copy the distribution archive you created in Section 8.1 to this directory, replacing the existing
local.tar.gz file. Build the installer: bash
Create the Moonshot distribution disk image: bash
- Copy the resulting
Moonshot.dmg to your distribution point. Generate a checksum for Moonshot.dmg with the following command: bash
IssuesCurrent 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. |