-
Notifications
You must be signed in to change notification settings - Fork 104
/
pi-secure-wifi-ssh.json
38 lines (38 loc) · 1.08 KB
/
pi-secure-wifi-ssh.json
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
{
"variables": {
"wifi_name": "",
"wifi_password": "",
"home": "{{env `HOME`}}"
},
"builders": [{
"type": "arm-image",
"iso_url": "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2020-02-14/2020-02-13-raspbian-buster-lite.zip",
"iso_checksum": "sha256:12ae6e17bf95b6ba83beca61e7394e7411b45eba7e6a520f434b0748ea7370e8",
"last_partition_extra_size": 1073741824
}],
"provisioners": [
{
"type": "shell",
"inline": ["touch /boot/ssh"]
},
{
"type": "shell",
"inline": [
"wpa_passphrase \"{{user `wifi_name`}}\" \"{{user `wifi_password`}}\" | sed -e 's/#.*$//' -e '/^$/d' >> /etc/wpa_supplicant/wpa_supplicant.conf"
]
},
{
"type": "file",
"source": "{{user `home`}}/.ssh/id_rsa.pub",
"destination": "/home/pi/.ssh/authorized_keys"
},
{
"type": "shell",
"inline": [
"sed '/PasswordAuthentication/d' -i /etc/ssh/sshd_config",
"echo >> /etc/ssh/sshd_config",
"echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config"
]
}
]
}