forked from koding/koding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-kite-keys.sh
More file actions
executable file
·34 lines (27 loc) · 1.08 KB
/
Copy pathgenerate-kite-keys.sh
File metadata and controls
executable file
·34 lines (27 loc) · 1.08 KB
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
#!/bin/bash
set -euo pipefail
REPO_HOME=${KONFIG_PROJECTROOT:-$(git rev-parse --show-toplevel)}
# TODO(rjeczalik): GEN-2535
KONTROL_URL=${KONFIG_KONTROL_URL:-"http://127.0.0.1:3000/kite"}
KONTROL_DIR="${REPO_HOME}/generated/private_keys/kontrol"
KLOUD_DIR="${REPO_HOME}/generated/private_keys/kloud"
KITE_DIR="${REPO_HOME}/generated/kite_home/koding"
if [[ ! -f "${KONTROL_DIR}/kontrol.pem" ]]; then
mkdir -p "${KONTROL_DIR}"
openssl genrsa -out "${KONTROL_DIR}/kontrol.pem" 2048 &>/dev/null
openssl rsa -in "${KONTROL_DIR}/kontrol.pem" -outform PEM -pubout -out "${KONTROL_DIR}/kontrol.pub" &>/dev/null
fi
if [[ ! -f "${KLOUD_DIR}/kloud.pem" ]]; then
mkdir -p "${KLOUD_DIR}"
ssh-keygen -q -N "" -t rsa -C hello@koding.com -f "${KLOUD_DIR}/kloud.pem"
mv "${KLOUD_DIR}"/kloud{.pem,}.pub
fi
if [[ ! -f "${KITE_DIR}/kite.key" ]]; then
mkdir -p "${KITE_DIR}"
go run "${REPO_HOME}/go/src/koding/kites/kloud/scripts/kitekey/main.go" \
-pem "${KONTROL_DIR}/kontrol.pem" \
-pub "${KONTROL_DIR}/kontrol.pub" \
-kontrolurl "${KONTROL_URL}" \
-username koding \
-file "${KITE_DIR}/kite.key"
fi