summaryrefslogtreecommitdiffstats
path: root/openssh/bin/ssh-ca
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2022-01-03 13:27:43 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2022-03-15 17:38:42 +0000
commit3a529129641b6fa7e4c0db720e7b5964989bfa43 (patch)
tree8f3d001b895a7f53fcc0b894d94b704b4a33156c /openssh/bin/ssh-ca
parentAdding postgresql-tools (WIP). (diff)
downloadservice-tools-3a529129641b6fa7e4c0db720e7b5964989bfa43.tar.xz
service-tools-3a529129641b6fa7e4c0db720e7b5964989bfa43.zip
Adding openssh-tools (WIP).
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rwxr-xr-xopenssh/bin/ssh-ca40
1 files changed, 40 insertions, 0 deletions
diff --git a/openssh/bin/ssh-ca b/openssh/bin/ssh-ca
new file mode 100755
index 0000000..675a2cf
--- /dev/null
+++ b/openssh/bin/ssh-ca
@@ -0,0 +1,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