forked from cryptopool-builders/multipool_yiimp_multi
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathssh.sh
56 lines (45 loc) · 1.31 KB
/
ssh.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
#!/usr/bin/env bash
#####################################################
# Source https://mailinabox.email/ https://github.com/mail-in-a-box/mailinabox
# Updated by cryptopool.builders for crypto use...
#####################################################
source /etc/functions.sh
source /etc/multipool.conf
source $STORAGE_ROOT/yiimp/.yiimp.conf
echo -e " Initializing UFW Firewall...$COL_RESET"
if [ -z "${DISABLE_FIREWALL:-}" ]; then
# Install `ufw` which provides a simple firewall configuration.
apt_install ufw;
wait $!
# Allow incoming connections to SSH.
ufw_allow ssh;
wait $!
ufw_allow http;
wait $!
ufw_allow https;
wait $!
ufw_allow mysql;
wait $!
# ssh might be running on an alternate port. Use sshd -T to dump sshd's #NODOC
# settings, find the port it is supposedly running on, and open that port #NODOC
# too. #NODOC
SSH_PORT=$(sshd -T 2>/dev/null | grep "^port " | sed "s/port //") #NODOC
if [ ! -z "$SSH_PORT" ]; then
if [ "$SSH_PORT" != "22" ]; then
echo Opening alternate SSH port $SSH_PORT. #NODOC
ufw_allow $SSH_PORT;
wait $!
ufw_allow http;
wait $!
ufw_allow https;
wait $!
ufw_allow mysql;
wait $!
fi
fi
sudo ufw --force enable;
wait $!
fi #NODOC
echo -e "$GREEN Done...$COL_RESET"
# Installation of remote server completed.... Force rebot server...
sudo reboot