This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
108 lines (84 loc) · 3.08 KB
/
setup.sh
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
#!/bin/bash
# $1 = IP of setup server
# $2 = Remote SSH port to bind to for AutoSSH reverse proxy
# THIS WILL NEED EDITING FOR ARM
## Install Prerequsites
echo -e "\e[33mInstalling required packages \e[39m"
#wget "$1:5000/clone/sources.list"
#sudo mv sources.list /etc/apt/sources.list
# wget wget https://repo.zabbix.com/zabbix/4.0/raspbian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb
# sudo dpkg -i zabbix-release_4.0-2+bionic_all.deb
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y python3 python iperf3 python-pip python3-pip speedtest-cli golang-go autossh moreutils openvpn git
sudo pip3 install iperf3 pingparsing jsonmerge
sudo pip install yoctopuce
# ## SSH setup
# echo -e "\e[33mSetting up SSH config \e[39m"
# cd ~/.ssh/
# wget "$1:5000/clone/authorized_keys"
# wget "$1:5000/clone/config"
# wget "$1:5000/clone/id_rsa"
# wget "$1:5000/clone/id_rsa.pub"
## Make Working directories
echo -e "\e[33mMaking working directories \e[39m"
cd ~/
mkdir clone
mkdir perf
ls -al
cd clone
# ## Generate autossh service file
# echo -e "\e[33mgenerating AutoSSH service files \e[39m"
# FILE="autossh.service"
# /bin/cat <<EOM >$FILE
# [Unit]
# Description=AutoSSH tunnel service
# After=network.target
# [Service]
# Environment="AUTOSSH_GATETIME=0"
# User=arisaie
# ExecStart=/usr/bin/autossh -N -F /home/arisaie/.ssh/config -i /home/arisaie/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -R $2:localhost:22 athena
# [Install]
# WantedBy=multi-user.target
# EOM
# cat autossh.service
## Install AutoSSH Service
# echo -e "\e[33mInstalling AutoSSH server files \e[39m"
# sudo cp -v autossh.service /etc/systemd/system/autossh.service
# sudo systemctl daemon-reload
# sudo systemctl enable autossh.service
# sudo systemctl start autossh.service
# ## Get HTTP server file
# echo -e "\e[33mGetting HTTP server service files \e[39m"
# wget "$1:5000/clone/simplehttp.service"
# ## Install HTTP Server Service
# echo -e "\e[33mInstalling HTTP server service files \e[39m"
# sudo cp -v simplehttp.service /etc/systemd/system/simplehttp.service
# sudo systemctl daemon-reload
# sudo systemctl enable simplehttp.service
# sudo systemctl start simplehttp.service
## Generate Hostname var
HOSTNAME= hostname
# Get VPN conf file
echo -e "\e[33mGetting VPN files \e[39m"
wget "$1:5000/clone/$HOSTNAME.ovpn"
## Install VPN service
echo -e "\e[33minstalling VPN files \e[39m"
sudo cp -v $HOSTNAME.ovpn /etc/openvpn/sixtimes.conf
sudo systemctl daemon-reload
sudo systemctl enable [email protected]
sudo systemctl start [email protected]
# ## Configure Zabbix
# echo -e "\e[33mConfiguring Zabbix\e[39m"
# wget "$1:5000/clone/zabbix_agentd.conf"
# sed -i "150s/.*/Hostname=$HOSTNAME/" zabbix_agentd.conf
# sudo cp -v zabbix_agentd.conf /etc/zaybbix/zabbix_agentd.conf
# sudo systemctl enable zabbix-agent
# sudo systemctl restart zabbix-agent
## Clone repos and install crontab
echo -e "\e[33mCloning repositories...\e[39m"
cd ~/perf
git clone https://github.com/mavi0/upgraded-rotary-telephone.git
sudo crontab upgraded-rotary-telephone/cronjobs
# echo -e "\e[33m$2\e[39m"
ifconfig