Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorToby Humphrey <toby00001@users.noreply.github.com>2017-06-05 22:55:30 +0300
committerDaniel Hansson <daniel@techandme.se>2017-06-05 22:55:30 +0300
commitacccb8a8e1b4dd8b81f1de45b234b95cfa63170f (patch)
treeab572530c47dfa32ae4a06e2b899316abe6193c3 /apps
parent671f71c7a0f3e7663244d9986d89ce578adaadc1 (diff)
Nmap retention model (#252)
Diffstat (limited to 'apps')
-rw-r--r--apps/collabora.sh32
-rw-r--r--apps/onlyoffice.sh32
2 files changed, 54 insertions, 10 deletions
diff --git a/apps/collabora.sh b/apps/collabora.sh
index 6ca34592..faf97fbb 100644
--- a/apps/collabora.sh
+++ b/apps/collabora.sh
@@ -70,29 +70,51 @@ else
exit 1
fi
-# Check if 443 is open using nmap, if not notify the user
+# Check to see if user already has nmap installed on their system
+if [ "$(dpkg-query -s nmap 2> /dev/null | grep -c "ok installed")" == "1" ]
+then
+ NMAPSTATUS=preinstalled
+fi
+
apt update -q4 & spinner_loading
-if [ "$(dpkg-query -W -f='${Status}' nmap 2>/dev/null | grep -c "ok installed")" == "1" ]
+if [ "$NMAPSTATUS" = "preinstalled" ]
then
echo "nmap is already installed..."
else
apt install nmap -y
fi
+
+# Check if 443 is open using nmap, if not notify the user
if [ "$(nmap -sS -p 443 "$WANIP4" | grep -c "open")" == "1" ]
then
printf "${Green}Port 443 is open on $WANIP4!${Color_Off}\n"
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
else
echo "Port 443 is not open on $WANIP4. We will do a second try on $SUBDOMAIN instead."
any_key "Press any key to test $SUBDOMAIN... "
if [[ "$(nmap -sS -PN -p 443 "$SUBDOMAIN" | grep -m 1 "open" | awk '{print $2}')" = "open" ]]
then
printf "${Green}Port 443 is open on $SUBDOMAIN!${Color_Off}\n"
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
else
whiptail --msgbox "Port 443 is not open on $SUBDOMAIN. Please follow this guide to open ports in your router: https://www.techandme.se/open-port-80-443/" "$WT_HEIGHT" "$WT_WIDTH"
any_key "Press any key to exit... "
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
exit 1
fi
fi
diff --git a/apps/onlyoffice.sh b/apps/onlyoffice.sh
index 03903dd3..c71467d9 100644
--- a/apps/onlyoffice.sh
+++ b/apps/onlyoffice.sh
@@ -78,29 +78,51 @@ else
exit 1
fi
-# Check if 443 is open using nmap, if not notify the user
+# Check to see if user already has nmap installed on their system
+if [ "$(dpkg-query -s nmap 2> /dev/null | grep -c "ok installed")" == "1" ]
+then
+ NMAPSTATUS=preinstalled
+fi
+
apt update -q4 & spinner_loading
-if [ "$(dpkg-query -W -f='${Status}' nmap 2>/dev/null | grep -c "ok installed")" == "1" ]
+if [ "$NMAPSTATUS" = "preinstalled" ]
then
echo "nmap is already installed..."
else
apt install nmap -y
fi
+
+# Check if 443 is open using nmap, if not notify the user
if [ "$(nmap -sS -p 443 "$WANIP4" | grep -c "open")" == "1" ]
then
printf "${Green}Port 443 is open on $WANIP4!${Color_Off}\n"
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
else
echo "Port 443 is not open on $WANIP4. We will do a second try on $SUBDOMAIN instead."
any_key "Press any key to test $SUBDOMAIN... "
if [[ "$(nmap -sS -PN -p 443 "$SUBDOMAIN" | grep -m 1 "open" | awk '{print $2}')" = "open" ]]
then
printf "${Green}Port 443 is open on $SUBDOMAIN!${Color_Off}\n"
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
else
whiptail --msgbox "Port 443 is not open on $SUBDOMAIN. Please follow this guide to open ports in your router: https://www.techandme.se/open-port-80-443/" "$WT_HEIGHT" "$WT_WIDTH"
any_key "Press any key to exit... "
- apt remove --purge nmap -y
+ if [ "$NMAPSTATUS" = "preinstalled" ]
+ then
+ echo "nmap was previously installed, not removing"
+ else
+ apt remove --purge nmap -y
+ fi
exit 1
fi
fi