| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
modprobe brd rd_size=1024000 max_part=2 rd_nr=1 |
| 6 |
passphrase=$(head /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 32 | head -n 1) |
| 7 |
certs_path=$(grep base_cert_dir /etc/octavia/amphora-agent.conf | awk '{print $3}') |
| 8 |
if [ -z "${certs_path}" ] ; then |
| 9 |
certs_path=/var/lib/octavia/certs |
| 10 |
fi |
| 11 |
mkdir -p "${certs_path}" |
| 12 |
chown octavia:octavia ${certs_path} |
| 13 |
echo -n "${passphrase}" | cryptsetup luksFormat /dev/ram0 - |
| 14 |
echo -n "${passphrase}" | cryptsetup luksOpen /dev/ram0 certfs-ramfs - |
| 15 |
mkfs.ext2 /dev/mapper/certfs-ramfs |
| 16 |
mount /dev/mapper/certfs-ramfs ${certs_path} |
| 17 |
chown octavia:octavia ${certs_path} |