Skip to content

Instantly share code, notes, and snippets.

@smj10j
Last active October 13, 2016 15:59
Show Gist options
  • Save smj10j/621adbac7a8069a519218ec193d1b948 to your computer and use it in GitHub Desktop.
Save smj10j/621adbac7a8069a519218ec193d1b948 to your computer and use it in GitHub Desktop.
Fix Sandbox Child Path on OSX for OpenSSH's sshd 7.3p1
#!/bin/bash
#
# Patch for error message:
# ssh_sandbox_child: sandbox_init: @PREFIX@/share/openssh/org.openssh.sshd.sb: profile not found [preauth]
#
# Fix based on https://github.com/Homebrew/homebrew-dupes/issues/641
#
set -e
#set -x
OPENSSH_DIR=$(brew --cellar openssh)'/7.3p1'
rm -f /usr/local/Cellar/openssh/7.3p1/sbin/sshd.patched
bspatch "${OPENSSH_DIR}/sbin/sshd" "${OPENSSH_DIR}/sbin/sshd.patched" "osx-openssh-7.3p1-sandbox-dir.patch"
chmod +x-w "${OPENSSH_DIR}/sbin/sshd.patched"
rm -f "$(brew --prefix)/sbin/sshd"
ln -s "${OPENSSH_DIR}/sbin/sshd.patched" "$(brew --prefix)/sbin/sshd"
@mattmartini
Copy link

This fix is not working for me. The patched sshd just dies:

$ /usr/local/Cellar/openssh/7.3p1/sbin/sshd.patched -d
Killed: 9

Wouldn't it be easier to just change
@PREFIX@/share/openssh/org.openssh.sshd.sb to
/System/Library/Sandbox/Profiles/org.openssh.sshd.sb
in the source code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment