summaryrefslogtreecommitdiffstats
path: root/openssh/bin/ssh-ca
blob: 675a2cf6e4189fa3ae8f28a1d43d67e16010c385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

set -e

HOST="$(cat /etc/hostname)"

Init ()
{
	echo "Init: creating CA key..."

	if [ -e "/etc/ssh-ca/keys/ssh-ca@${HOST}" ] || [ -e "/etc/ssh-ca/keys/ssh-ca@${HOST}.pub" ]
	then
		echo "/etc/ssh-ca/keys/ssh-ca@${HOST} key already exists"
		exit 1
	fi

	mkdir -p /etc/ssh-ca/keys
	ssh-keygen -f "/etc/ssh-ca/keys/ssh-ca@${HOST}" -t ed25519 -C ssh-ca@${HOST} -N ""
}

Sign ()
{
	FILE="${1}"

}

case "${1}" in
	init)
		Init
		;;

	sign)
		Sign
		;;

	*)
		echo "Usage: ${0} {init}"
		exit 1
		;;
esac