File: kxc-cryptsetup

package info (click to toggle)
kxd 0.13%2Bgit20170730.6182dc8-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 244 kB
  • ctags: 113
  • sloc: python: 386; sh: 193; makefile: 67
file content (29 lines) | stat: -rwxr-xr-x 768 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

# Script to use as a crypttab keyscript, to automatically get keys with kxc.
# It will use the configuration from /etc/kxc/.
#
# The only argument is the base name of the configuration.

CONFIG_BASE="/etc/kxc"

CLIENT_CERT="${CONFIG_BASE}/cert.pem"
CLIENT_KEY="${CONFIG_BASE}/key.pem"
SERVER_CERT="${CONFIG_BASE}/${1}.server_cert.pem"
SERVER_URL=$(cat "${CONFIG_BASE}/${1}.url")

# Find the binary. We search because it can be in one place in the initramfs,
# and in another in the normal distribution, and we want to support both
# easily.
for KXC in /bin/kxc /sbin/kxc /usr/bin/kxc /usr/sbin/kxc; do
	if [ -x $KXC ]; then
		break;
	fi
done

exec $KXC \
	--client_cert=$CLIENT_CERT \
	--client_key=$CLIENT_KEY \
	--server_cert=$SERVER_CERT \
	$SERVER_URL