Skip to content

Instantly share code, notes, and snippets.

@cyberdelia
Last active March 23, 2023 23:03
Show Gist options
  • Select an option

  • Save cyberdelia/91f7ec06a745310cec0615820ead8652 to your computer and use it in GitHub Desktop.

Select an option

Save cyberdelia/91f7ec06a745310cec0615820ead8652 to your computer and use it in GitHub Desktop.
Secure Agent — Authentication agent using the Secure Enclave
function start_ssh_agent() {
secure-agent daemon | sed 's/^echo/#echo/' >! $ssh_environment
chmod 600 $ssh_environment
source $ssh_environment > /dev/null
}
ssh_environment="$HOME/.ssh/environment"
if [[ -f "$ssh_environment" ]]; then
source $ssh_environment > /dev/null
ps x | grep secure-agent | grep -q $SSH_AGENT_PID || {
start_ssh_agent
}
else
start_ssh_agent
fi
unset ssh_environment
unfunction start_ssh_agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment