forked from nsacyber/goSecure
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcloud-config.client.j2
165 lines (148 loc) · 4.31 KB
/
cloud-config.client.j2
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#cloud-config
{%- set cloud_config = 'https://github.com/davedittrich/goSecure/blob/master/cloud-config.client.j2' %}
# See: https://cloudinit.readthedocs.io/en/latest/topics/examples.html
hostname: gosecure-client
manage_etc_hosts: false
groups:
- gosecure: [pi,pirate]
users:
- name: pi
gecos: "goSecure pi"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
groups: users,docker,video,netdev,gosecure
plain_text_passwd: "{{ gosecure_pi_password }}"
lock_passwd: false
ssh-import-id: None
ssh-authorized-keys:
- {{ gosecure_pi_pubkey }}
ssh_pwauth: true
chpasswd: { expire: false }
- name: pirate
gecos: "pirate"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
groups: users,docker,video,netdev,gosecure
plain_text_passwd: "{{ gosecure_pi_password }}"
lock_passwd: false
ssh-import-id: None
ssh_pwauth: true
ssh-authorized-keys:
- {{ gosecure_pi_pubkey }}
chpasswd: { expire: false }
package_upgrade: false
# Set the locale of the system
locale: "{{ gosecure_pi_locale }}"
# Set the timezone
# Value of 'timezone' must exist in /usr/share/zoneinfo
timezone: "{{ gosecure_pi_timezone }}"
write_files:
- content: |
# File created by {{ cloud_config }}
127.0.1.1 gosecure-client.localdomain gosecure-client
127.0.0.1 localhost
192.168.50.1 setup client
# For development and network reconfiguration via Ansible
192.168.50.2 server
::1 ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
path: /etc/hosts
- content: |
{{ gosecure_vpn_client_id }} : PSK {{ gosecure_vpn_client_psk }}
path: /etc/ipsec.secrets
owner: root:root
permissions: '0600'
- content: |
net.ipv6.conf.all.disable_ipv6=1
path: /etc/sysctl.d/local.conf
- content: |
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
path: /etc/network/interfaces.d/wlan0
- content: |
country={{ gosecure_pi_wifi_country }}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="{{ gosecure_client_ssid }}"
psk="{{ gosecure_client_psk }}"
}
path: /etc/wpa_supplicant/wpa_supplicant.conf
owner: root:root
permissions: '0600'
- content: |
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="{{ gosecure_pi_keyboard_model }}"
XKBLAYOUT="{{ gosecure_pi_keyboard_layout }}"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
path: /etc/default/keyboard
- content: |
hostname
clientid
persistent
slaac private
option rapid_commit
option domain_name_servers,domain_name,domain_search,host_name
option classless_static_routes
option ntpservers
option interface_mtu
require dhcp_server_identifier
path: /etc/dhcpcd.conf
- content: |
domain-needed
bogus-priv
server=8.8.8.8
server=8.8.4.4
cache-size=4096
local=/home/
expand-hosts
domain=gosecure
dhcp-range=192.168.50.101,192.168.50.200,255.255.255.0,14d
dhcp-option=option:router,192.168.50.1
dhcp-option=252,"\n"
log-facility=/var/log/dnsmasq.log
log-async
log-dhcp
path: /etc/dnsmasq.conf
- content: |
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.50.1
netmask 255.255.255.0
auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet dhcp
path: /etc/network/interfaces.d/eth0
# Install any additional apt packages you need here
packages:
- ntp
- curl
- nginx
- dnsmasq
- rng-tools
- rpi-update
# These commands will be only be run once on first boot
runcmd:
- 'systemctl enable rng-tools'
- 'service networking restart'
- 'systemctl restart avahi-daemon'
- 'ifdown eth0'
- 'ifup eth0'
- 'sleep 20'
- 'rpi-update'
- 'sudo -u pi wget -P /home/pi https://davedittrich.github.io/goSecure/files/install_scripts/gosecure_client_install.py'
- 'systemctl status dnsmasq'
- 'ifconfig -a'
- 'echo "[+] Setup completed: log in and reboot after recording SSH key fingerprint information"'
- 'sleep 5'
# vim: syntax=yaml