-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeys.tftpl
45 lines (38 loc) · 1.12 KB
/
keys.tftpl
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
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Default User Keys
touch /home/ubuntu/.ssh/authorized_keys
%{for ssh_key in ssh_keys~}
echo "${ssh_key}" >> /home/ubuntu/.ssh/authorized_keys
%{endfor~}
chown ubuntu: /home/ubuntu/.ssh/authorized_keys
chmod 0600 /home/ubuntu/.ssh/authorized_keys
# User Keys
%{for user, resource in users~}
adduser --disabled-password --gecos "" ${user}
mkdir -p /home/${user}/.ssh
touch /home/${user}/.ssh/authorized_keys
%{for key in resource.ssh-keys~}
echo "${key}" >> /home/${user}/.ssh/authorized_keys
%{endfor~}
chown -R ${user}:${user} /home/${user}/.ssh
chmod -R go-rx /home/${user}/.ssh
%{endfor~}
#install amazon-efs-utils
apt update -y
apt-get -y install git binutils
git clone https://github.com/aws/efs-utils
cd efs-utils
./build-deb.sh
apt-get -y install ./build/amazon-efs-utils*deb
#install botocore
apt-get -y install python3-distutils
wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py
python3 /tmp/get-pip.py
pip3 install botocore
#mount efs
%{for filesystem, mount_path in efs_mounts~}
mkdir -p ${mount_path.mount_path}
mount -t efs -o tls ${filesystem}:/ ${mount_path.mount_path}
%{endfor~}
# Userdata
${userdata}