-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
58 lines (46 loc) · 1.73 KB
/
setup.sh
File metadata and controls
58 lines (46 loc) · 1.73 KB
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
#!/bin/bash
source helper.sh
osname=$(os_name)
if [[ "$osname" == "Linux" ]]; then
# Initial Update
sudo apt update
# upgrade installed packages
sudo apt upgrade -y
# ------------------ Install Essentials ------------------
# install basic packages
sudo apt install -y build-essential curl git unzip vim vim-gui-common
# ------------------ Firewall & Security ------------------
# install and configure firewall (ufw)
sudo apt install -y ufw
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
# set up fail2ban for SSH protection [Optional]
sudo apt install -y fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
# **Configure Fail2ban to protect SSH from brute-force attacks
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo sed -i 's/# bantime = 10m/bantime = 1h/' /etc/fail2ban/jail.local
sudo sed -i 's/# maxretry = 5/maxretry = 3/' /etc/fail2ban/jail.local
sudo systemctl restart fail2ban
# SSL certificates with Let's Encrypt
add-apt-repository -y ppa:certbot/certbot
sudo apt-get update
sudo apt-get install -y certbot python3-certbot-nginx
# ------------------ Timezone ------------------
# Timezone for India
timedatectl set-timezone Asia/Kolkata
# cleanup
sudo apt autoremove -y
sudo apt clean
echo "Basic Setup Done..."
# Note:
echo "---------------------+++++++ NOTE +++++++------------------------------"
echo "VIM:: Add 'syntax on' to ~/.vimrc to enable syntax."
echo "------------------+++++++ NOTE :END +++++++----------------------------"
elif [[ "$osname" == "macOS" ]]; then
brew install vim
echo "Basic Setup Done..."
fi