-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·183 lines (150 loc) · 4.07 KB
/
install.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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/sh
# bachir soussi chiadmi
#
# http://www.pontikis.net/blog/debian-9-stretch-rc3-web-server-setup-php7-mariadb
# http://web-74.com/blog/reseaux/gerer-le-deploiement-facilement-avec-git/
#
echo -e '\033[35m
____ __ _ _____
/ __ \___ / /_ (_)___ _____ / ___/___ ______ _____ _____
/ / / / _ \/ __ \/ / __ `/ __ \ \__ \/ _ \/ ___/ | / / _ \/ ___/
/ /_/ / __/ /_/ / / /_/ / / / / ___/ / __/ / | |/ / __/ /
/_____/\___/_.___/_/\__,_/_/ /_/ /____/\___/_/ |___/\___/_/
\033[0m'
echo -e "\033[35;1mThis script has been tested only on Linux Debian 10 \033[0m"
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
echo -n "Should we start? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" != "y" ]; then
echo "aborting script!"
exit
fi
# get the current position
_cwd="$(pwd)"
. bin/upgrade.sh
. bin/misc.sh
. bin/firewall.sh
. bin/fail2ban.sh
# . bin/knockd.sh
. bin/user.sh
. bin/email.sh
while [ "$securssh" != "yes" ] && [ "$securssh" != "no" ]
do
echo -n "Securing ssh (disabling root login)? [yes|no] "
read securssh
# securssh=${securssh:-y}
done
if [ "$securssh" = "yes" ]; then
. bin/ssh.sh
else
echo 'root user can still conect through ssh'
fi
echo -n "Should we install ftp server? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" = "y" ]; then
. bin/ftp.sh
else
echo 'ftp server not installed'
fi
while [ "$lemp" != "yes" ] && [ "$lemp" != "no" ]
do
echo -n "Should we install lemp ? [yes|no] "
read lemp
done
if [ "$lemp" = "yes" ]; then
. bin/lemp.sh
else
echo 'lemp server not installed'
fi
while [ "$_install_vhost" != "yes" ] && [ "$_install_vhost" != "no" ]
do
echo -n "Should we install a vhost ? [yes|no] "
read _install_vhost
done
if [ "$_install_vhost" = "yes" ]; then
. bin/vhost.sh
else
echo 'no vhost installed'
fi
while [ "$_install_zabbix_agent" != "yes" ] && [ "$_install_zabbix_agent" != "no" ]
do
echo -n "Should we install zabbix-agent ? [yes|no] "
read _install_zabbix_agent
done
if [ "$_install_zabbix_agent" = "yes" ]; then
. bin/zabbix.sh
else
echo 'zabbix-agent not installed'
fi
while [ "$_install_urbackup" != "yes" ] && [ "$_install_urbackup" != "no" ]
do
echo -n "Should we install urbackup client ? [yes|no] "
read _install_urbackup
done
if [ "$_install_urbackup" = "yes" ]; then
. bin/urbackup.sh
else
echo 'urbackup client not installed'
fi
# ./install.sh: line 109: bin/dotfiles.sh: No such file or directory
. bin/dotfiles.sh
# . bin/autoupdate.sh
# echo -e '\033[35m
# ______________ _______
# /_ __/ ____/ |/ / __ \
# / / / __/ / /|_/ / /_/ /
# / / / /___/ / / / ____/
# /_/ /_____/_/ /_/_/
# \033[0m'
# function check_tmp_secured {
# temp1=`grep -w "/var/tempFS /tmp ext3 loop,nosuid,noexec,rw 0 0" /etc/fstab | wc -l`
# temp2=`grep -w "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" /etc/fstab | wc -l`
# if [ $temp1 -gt 0 ] || [ $temp2 -gt 0 ]; then
# return 1
# else
# return 0
# fi
# } # End function check_tmp_secured
# function secure_tmp_tmpfs {
# cp /etc/fstab /etc/fstab.bak
# # Backup /tmp
# cp -Rpf /tmp /tmpbackup
# rm -rf /tmp
# mkdir /tmp
# mount -t tmpfs -o rw,noexec,nosuid tmpfs /tmp
# chmod 1777 /tmp
# echo "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" >> /etc/fstab
# # Restore /tmp
# cp -Rpf /tmpbackup/* /tmp/ >/dev/null 2>&1
# #Remove old tmp dir
# rm -rf /tmpbackup
# # Backup /var/tmp and link it to /tmp
# mv /var/tmp /var/tmpbackup
# ln -s /tmp /var/tmp
# # Copy the old data back
# cp -Rpf /var/tmpold/* /tmp/ >/dev/null 2>&1
# # Remove old tmp dir
# rm -rf /var/tmpbackup
# echo -e "\033[35;1m /tmp and /var/tmp secured using tmpfs. \033[0m"
# } # End function secure_tmp_tmpfs
# check_tmp_secured
# if [ $? = 0 ]; then
# secure_tmp_tmpfs
# else
# echo -e "\033[35;1mFunction canceled. /tmp already secured. \033[0m"
# fi
# TODO add warning message on ssh connection if system needs updates
# TODO install and configure tmux
echo -e '\033[35m
__
___ ____ ____/ /
/ _ \/ __ \/ __ /
/ __/ / / / /_/ /
\___/_/ /_/\__,_/
\033[0m'
echo -e "\033[35;1m* * script done * * \033[0m"