#!/bin/sh
set -eu

if [ "$1" != "--pubkey" ]; then
    echo "This mock only supports the --pubkey operation" >&2
    exit 1
fi

# recognize --port, but ignore it
if [ "$2" = "--port" ]; then
    shift 2
fi

# if the host does not match, don't print anything
# sss_ssh_knownhostsproxy still succeeds in this case
if [ "$2" = "$COCKPIT_MOCK_SSS_KNOWN_HOSTS_HOST" ]; then
    echo "$COCKPIT_MOCK_SSS_KNOWN_HOSTS_KEY"
fi
