-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitialize.sh
More file actions
43 lines (34 loc) · 810 Bytes
/
initialize.sh
File metadata and controls
43 lines (34 loc) · 810 Bytes
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
#!/bin/bash
# <UDF name="USERNAME" Label="Username" />
# <UDF name="PASSWORD" Label="Password" />
# <UDF name="HOSTNAME" Label="Hostname" />
exec >/root/stackscript.log 2>&1
# import StackScript Bash Library
source <ssinclude StackScriptID=1>
system_set_hostname $HOSTNAME
# setup user & sudo
echo "Setup users"
user_add_sudo $USERNAME $PASSWORD
ssh_disable_root
echo "updating system"
system_update
apt-get -y install software-properties-common fail2ban
goodstuff
sleep 5
echo "Firewall setup"
ufw allow 22
ufw allow 80
ufw allow 443
ufw disable
ufw enable
ufw status verbose
echo "nginx"
apt -y install nginx
echo "certbot"
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get -y install python-certbot-nginx
echo "Restarting stuff"
restartServices
echo "done"