(This post is in beta)
So, what all do I install, and why?
- The OpenSSH shipped in El Capitan is partially broken (GSSAPI Key Exchange doesn’t work). So, we build our own, including GSSAPI authentication and GSSAPI Key Exchange.
- MacPorts’ OpenSSH depends on MIT Kerberos, so we install that.
- MacPorts’ remctl also depends on MIT Kerberos.
- OpenSSL is needed because macOS doesn’t give you OpenSSL headers.
- I also do a lot of Perl development.
- Finally, Proxychains is useful for tunneling remctl through SSH.
This assumes that you’re running macOS 10.9 or later, and that you have admin access on your system.
- If you don’t have one, get an Apple account.
- Install Xcode from the App store.
Although it’s possible to download the installer package, it’s easier to just install it from the App Store. The only reason I’d install the package directly is if I was using some sort of system-management platform to push out software.
- Install the Command Line Tools that match your version of Xcode and macOS.
Unfortunately, there is no App Store entry for this.
- Open a Terminal window, and view/accept the Xcode license.
- Download and run the MacPorts installer, for 10.11 El Capitan, 10.10 Yosemite, or 10.9 Mavericks.
- In a Terminal window, update the package lists and build ported sofware:
sudo port selfupdate sudo port install kerberos5 remctl openssl proxychains-ng openssh +kerberos5 +gsskex -xauth
- The MacPorts installer updates your
PATH, but for some reason it doesn’t update your
MANPATH. Add the following line to your
- If you use Eclipse, which ships its own Git implementation, you might want to ensure that it uses the OpenSSH you’ve installed, so add this line to your
- Copy and customize one of the SSH configs from my Stanford web space. Even though the MacPorts version of OpenSSH is used, it’s not acting as the system ssh daemon, so you need to match that with the SSH config you download.
- Pull in BASH customizations:
- Copy all of my BASH files to your home directory, and then add a dot to the start of each filename.
- Make a symlink from
.bash_stanford_mit(if using MacPorts’ kerberos5 package) or
.bash_stanford_heimdal(if using macOS’ built-in Kerberos).
- Finally, update your
.bash_profilefile to run the
- To set up proxychains, create a file at
~/.proxychains/proxychains.conf, with the following content:
strict_chain quiet_mode tcp_read_time_out 15000 tcp_connect_time_out 8000 [ProxyList] socks5 127.0.0.1 1080
- If you do a lot of Perl work, consider installing Perlbrew. But, if you do, be sure to read my warning! Also, consider if you want to enable Perlbrew in your
.bash_profilebefore or after you set the
PATHfor MacPorts. MacPorts can also install Perl, and Perl packages, so if you aren’t careful you’ll get weird clashing between your Perl and MacPorts’ Perl.
- If you do anything with PGP/GPG, including signing, encrypting, or authenticating, then install the GPG Suite. In my case, I’m doing package signing (Debian packages) using a hardware key (on a Yubikey 4), so I need the functionality that the GPG Suite provides.
That’s it! Most of the software (like Kerberos and OpenSSH) is documented elsewhere. Here are my specific usage notes for other stuff.
To switch which Kerberos principal you’re using, use the aliases
pag (to switch to regular principal),
rootpag (root principal),
adminpag (admin principal), or
sunetpag (sunet principal). The principal type appears in the command prompt, or the message
(nc) to indicate that you don’t have a principal right now.
Unfortunately, I’ve noticed a tendancy for the OS to switch prinicpals in the background unexpectedly. Send a noop command (that is, just press enter at shell prompt) to see if your active principal’s changed.
Using proxychains is as simple as prefixing your command with
proxychains. For example:
proxychains remctl my-server command subcommand arg1
That routes all network connections through the SOCKS5 proxy at localhost port 1080, which should be set up by the SSH connection to your bastion host.