#!/bin/sh # cassh - Manager for an OpenSSH Certification Authority # # Written in 2022 by Lucas # # To the extent possible under law, the author(s) have dedicated all # copyright and related and neighboring rights to this software to the # public domain worldwide. This software is distributed without any # warranty. # You should have received a copy of the CC0 Public Domain Dedication # along with this software. If not, see # . usage() { cat - <&2 Usage: ${0##*/} private_key cassh_command [options ...] EOF exit 1 } if [ $# -lt 2 ]; then usage fi cassh_command=$2 needs_agent=false case $cassh_command in issue) needs_agent=true ;; esac if $needs_agent; then ssh-agent sh -s "$@" <<'EOF' ssh-add -q "$1" && shift && cassh "$@" rc=$? ssh-agent -k >/dev/null exit $rc EOF else shift cassh "$@" fi