File: create-kxd-config

package info (click to toggle)
kxd 0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: python: 536; sh: 233; makefile: 64
file content (34 lines) | stat: -rwxr-xr-x 756 bytes parent folder | download | duplicates (3)
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
#
# Create a basic but functional kxd configuration.
#
# This script creates the /etc/kxd directory, and generates a certificate for
# the server to use.
#
# It should be run under the same user as kxd itself.

if [ "$1" == "" ]; then
	echo "Usage: $0 <hostname>"
	exit 1
fi

set -e

# Create the base configuration directory.
echo "Creating directories (/etc/kxd/)"
mkdir -p /etc/kxd/

# And the data directory where the keys are stored.
mkdir -p /etc/kxd/data

# Create a private key for the server.
if ! [ -e /etc/kxd/key.pem ]; then
	kxgencert \
		-host "${1?}" \
		-organization "kxd@$HOSTNAME" \
		-key /etc/kxd/key.pem \
		-cert /etc/kxd/cert.pem
	chmod 400 /etc/kxd/key.pem
else
	echo "Private key already exists (/etc/kxd/key.pem)"
fi