Merge pull request #1543 from dinger1986/develop
Update troubleshoot_server.sh
This commit is contained in:
		@@ -3,6 +3,7 @@
 | 
				
			|||||||
# Tactical RMM install troubleshooting script
 | 
					# Tactical RMM install troubleshooting script
 | 
				
			||||||
# Contributed by https://github.com/dinger1986
 | 
					# Contributed by https://github.com/dinger1986
 | 
				
			||||||
# v1.1 1/21/2022 update to include all services
 | 
					# v1.1 1/21/2022 update to include all services
 | 
				
			||||||
 | 
					# v 1.2 6/24/2023 changed to add date, easier readability and ipv4 addresses only for checks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This script asks for the 3 subdomains, checks they exist, checks they resolve locally and remotely (using google dns for remote), 
 | 
					# This script asks for the 3 subdomains, checks they exist, checks they resolve locally and remotely (using google dns for remote), 
 | 
				
			||||||
# checks services are running, checks ports are opened. The only part that will make the script stop is if the sub domains dont exist, theres literally no point in going further if thats the case
 | 
					# checks services are running, checks ports are opened. The only part that will make the script stop is if the sub domains dont exist, theres literally no point in going further if thats the case
 | 
				
			||||||
@@ -12,21 +13,39 @@ YELLOW='\033[1;33m'
 | 
				
			|||||||
RED='\033[0;31m'
 | 
					RED='\033[0;31m'
 | 
				
			||||||
NC='\033[0m'
 | 
					NC='\033[0m'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Set date at the top of the troubleshooting script
 | 
				
			||||||
 | 
					now=$(date)
 | 
				
			||||||
 | 
					echo -e -------------- $now -------------- | tee -a checklog.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Resolve Locally used DNS server
 | 
					# Resolve Locally used DNS server
 | 
				
			||||||
locdns=$(resolvectl | grep 'Current DNS Server:' | cut -d: -f2 | awk '{ print $1}')
 | 
					resolvestatus=$(systemctl is-active systemd-resolved.service)
 | 
				
			||||||
 | 
					if [ $resolvestatus = active ]; then
 | 
				
			||||||
 | 
					    locdns=$(resolvectl | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
 | 
					    echo -e $locdns
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						while ! [[ $resolveconf ]]; do
 | 
				
			||||||
 | 
					    resolveconf=$(sudo systemctl status systemd-resolved.service | grep "Active: active (running)")
 | 
				
			||||||
 | 
					    sudo systemctl start systemd-resolved.service
 | 
				
			||||||
 | 
					    echo -ne "DNS Resolver not ready yet...${NC}\n"
 | 
				
			||||||
 | 
					    sleep 3
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					    locdns=$(resolvectl | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
 | 
					    echo -e $locdns
 | 
				
			||||||
 | 
					    sudo systemctl stop systemd-resolved.service
 | 
				
			||||||
 | 
					fi 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
while [[ $rmmdomain != *[.]*[.]* ]]
 | 
					while [[ $rmmdomain != *[.]*[.]* ]]
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
echo -ne "${YELLOW}Enter the subdomain for the backend (e.g. api.example.com)${NC}: "
 | 
					echo -e "${YELLOW}Enter the subdomain for the backend (e.g. api.example.com)${NC}: "
 | 
				
			||||||
read rmmdomain
 | 
					read rmmdomain
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ping -c 1 $rmmdomain &> /dev/null
 | 
					if ping -c 1 $rmmdomain &> /dev/null
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
    echo -ne ${GREEN} Verified $rmmdomain | tee -a checklog.log
 | 
					    echo -e ${GREEN} Verified $rmmdomain | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  echo -ne ${RED} $rmmdomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
					  echo -e ${RED} $rmmdomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
				
			||||||
  printf >&2 "\n\n"
 | 
					  printf >&2 "\n\n"
 | 
				
			||||||
  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
					  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
				
			||||||
  printf >&2 "\n\n"
 | 
					  printf >&2 "\n\n"
 | 
				
			||||||
@@ -35,16 +54,16 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
while [[ $frontenddomain != *[.]*[.]* ]]
 | 
					while [[ $frontenddomain != *[.]*[.]* ]]
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
echo -ne "${YELLOW}Enter the subdomain for the frontend (e.g. rmm.example.com)${NC}: "
 | 
					echo -e "${YELLOW}Enter the subdomain for the frontend (e.g. rmm.example.com)${NC}: "
 | 
				
			||||||
read frontenddomain
 | 
					read frontenddomain
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ping -c 1 $frontenddomain &> /dev/null
 | 
					if ping -c 1 $frontenddomain &> /dev/null
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
    echo -ne ${GREEN} Verified $frontenddomain | tee -a checklog.log
 | 
					    echo -e ${GREEN} Verified $frontenddomain | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  echo -ne ${RED} $frontenddomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
					  echo -e ${RED} $frontenddomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
				
			||||||
  printf >&2 "\n\n"
 | 
					  printf >&2 "\n\n"
 | 
				
			||||||
  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
					  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
				
			||||||
  printf >&2 "\n\n"
 | 
					  printf >&2 "\n\n"
 | 
				
			||||||
@@ -53,16 +72,16 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
while [[ $meshdomain != *[.]*[.]* ]]
 | 
					while [[ $meshdomain != *[.]*[.]* ]]
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
echo -ne "${YELLOW}Enter the subdomain for meshcentral (e.g. mesh.example.com)${NC}: "
 | 
					echo -e "${YELLOW}Enter the subdomain for meshcentral (e.g. mesh.example.com)${NC}: "
 | 
				
			||||||
read meshdomain
 | 
					read meshdomain
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ping -c 1 $meshdomain &> /dev/null
 | 
					if ping -c 1 $meshdomain &> /dev/null
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
    echo -ne ${GREEN} Verified $meshdomain | tee -a checklog.log
 | 
					    echo -e ${GREEN} Verified $meshdomain | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  echo -ne ${RED} $meshdomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
					  echo -e ${RED} $meshdomain doesnt exist please create it or check for a typo | tee -a checklog.log
 | 
				
			||||||
  printf >&2 "\n\n" | tee -a checklog.log
 | 
					  printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
					  printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
				
			||||||
  printf >&2 "\n\n"
 | 
					  printf >&2 "\n\n"
 | 
				
			||||||
@@ -71,60 +90,60 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
while [[ $domain != *[.]* ]]
 | 
					while [[ $domain != *[.]* ]]
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
echo -ne "${YELLOW}Enter yourdomain used for letsencrypt (e.g. example.com)${NC}: "
 | 
					echo -e "${YELLOW}Enter yourdomain used for letsencrypt (e.g. example.com)${NC}: "
 | 
				
			||||||
read domain
 | 
					read domain
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Checking IPs | tee -a checklog.log 
 | 
						echo -e ${YELLOW} Checking IPs | tee -a checklog.log 
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check rmmdomain IPs
 | 
					# Check rmmdomain IPs
 | 
				
			||||||
locapiip=`dig @"$locdns" +short $rmmdomain`
 | 
					locapiip=$(dig @"$locdns" +short $rmmdomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
remapiip=`dig @8.8.8.8 +short $rmmdomain`
 | 
					remapiip=$(dig @8.8.8.8 +short $rmmdomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$locapiip" = "$remapiip" ]; then
 | 
					if [ "$locapiip" = "$remapiip" ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success $rmmdomain is Locally Resolved: "$locapiip"  Remotely Resolved: "$remapiip" | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success $rmmdomain is Locally Resolved: "$locapiip"  Remotely Resolved: "$remapiip" | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	echo -ne ${RED} Locally Resolved: "$locapiip"  Remotely Resolved: "$remapiip" | tee -a checklog.log
 | 
						echo -e ${RED} Locally Resolved: "$locapiip"  Remotely Resolved: "$remapiip" | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED} Your Local and Remote IP for $rmmdomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
					    echo -e ${RED} Your Local and Remote IP for $rmmdomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check Frontenddomain IPs
 | 
					# Check Frontenddomain IPs
 | 
				
			||||||
locrmmip=`dig @"$locdns" +short $frontenddomain`
 | 
					locrmmip=$(dig @"$locdns" +short $frontenddomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
remrmmip=`dig @8.8.8.8 +short $frontenddomain`
 | 
					remrmmip=$(dig @8.8.8.8 +short $frontenddomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$locrmmip" = "$remrmmip" ]; then
 | 
					if [ "$locrmmip" = "$remrmmip" ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success $frontenddomain is Locally Resolved: "$locrmmip"  Remotely Resolved: "$remrmmip"| tee -a checklog.log
 | 
					    echo -e ${GREEN} Success $frontenddomain is Locally Resolved: "$locrmmip"  Remotely Resolved: "$remrmmip"| tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	echo -ne ${RED}  Locally Resolved: "$locrmmip"  Remotely Resolved: "$remrmmip" | tee -a checklog.log
 | 
						echo -e ${RED}  Locally Resolved: "$locrmmip"  Remotely Resolved: "$remrmmip" | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED} echo Your Local and Remote IP for $frontenddomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
					    echo -e ${RED} echo Your Local and Remote IP for $frontenddomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check meshdomain IPs
 | 
					# Check meshdomain IPs
 | 
				
			||||||
locmeship=`dig @"$locdns" +short $meshdomain`
 | 
					locmeship=$(dig @"$locdns" +short $meshdomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
remmeship=`dig @8.8.8.8 +short $meshdomain`
 | 
					remmeship=$(dig @8.8.8.8 +short $meshdomain | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$locmeship" = "$remmeship" ]; then
 | 
					if [ "$locmeship" = "$remmeship" ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success $meshdomain is Locally Resolved: "$locmeship"  Remotely Resolved: "$remmeship" | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success $meshdomain is Locally Resolved: "$locmeship"  Remotely Resolved: "$remmeship" | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	echo -ne ${RED} Locally Resolved: "$locmeship"  Remotely Resolved: "$remmeship" | tee -a checklog.log
 | 
						echo -e ${RED} Locally Resolved: "$locmeship"  Remotely Resolved: "$remmeship" | tee -a checklog.log
 | 
				
			||||||
    printf >&2 "\n\n" | tee -a checklog.log
 | 
					    printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED} Your Local and Remote IP for $meshdomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
					    echo -e ${RED} Your Local and Remote IP for $meshdomain all agents will require non-public DNS to find TRMM server | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Checking Services | tee -a checklog.log 
 | 
						echo -e ${YELLOW} Checking Services | tee -a checklog.log 
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check if services are running
 | 
					# Check if services are running
 | 
				
			||||||
@@ -142,146 +161,152 @@ redisserverstatus=$(systemctl is-active redis-server)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# RMM Service
 | 
					# RMM Service
 | 
				
			||||||
if [ $rmmstatus = active ]; then
 | 
					if [ $rmmstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success RMM Service is Running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success RMM Service is Running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'RMM Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'RMM Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# daphne Service
 | 
					# daphne Service
 | 
				
			||||||
if [ $daphnestatus = active ]; then
 | 
					if [ $daphnestatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success daphne Service is Running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success daphne Service is Running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'daphne Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'daphne Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# celery Service
 | 
					# celery Service
 | 
				
			||||||
if [ $celerystatus = active ]; then
 | 
					if [ $celerystatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success celery Service is Running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success celery Service is Running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'celery Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'celery Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# celerybeat Service
 | 
					# celerybeat Service
 | 
				
			||||||
if [ $celerybeatstatus = active ]; then
 | 
					if [ $celerybeatstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success celerybeat Service is Running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success celerybeat Service is Running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'celerybeat Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'celerybeat Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nginx Service
 | 
					# nginx Service
 | 
				
			||||||
if [ $nginxstatus = active ]; then
 | 
					if [ $nginxstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success nginx Service is Running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success nginx Service is Running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'nginx Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'nginx Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nats Service
 | 
					# nats Service
 | 
				
			||||||
if [ $natsstatus = active ]; then
 | 
					if [ $natsstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success nats Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success nats Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'nats Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'nats Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nats-api Service
 | 
					# nats-api Service
 | 
				
			||||||
if [ $natsapistatus = active ]; then
 | 
					if [ $natsapistatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success nats-api Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success nats-api Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'nats-api Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'nats-api Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# meshcentral Service
 | 
					# meshcentral Service
 | 
				
			||||||
if [ $meshcentralstatus = active ]; then
 | 
					if [ $meshcentralstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success meshcentral Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success meshcentral Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'meshcentral Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'meshcentral Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# mongod Service
 | 
					# mongod Service
 | 
				
			||||||
if [ $mongodstatus = active ]; then
 | 
					if [ $mongodstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success mongod Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success mongod Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'mongod Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'mongod Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# postgresql Service
 | 
					# postgresql Service
 | 
				
			||||||
if [ $postgresqlstatus = active ]; then
 | 
					if [ $postgresqlstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success postgresql Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success postgresql Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'postgresql Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'postgresql Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# redis-server Service
 | 
					# redis-server Service
 | 
				
			||||||
if [ $redisserverstatus = active ]; then
 | 
					if [ $redisserverstatus = active ]; then
 | 
				
			||||||
    echo -ne ${GREEN} Success redis-server Service is running | tee -a checklog.log
 | 
					    echo -e ${GREEN} Success redis-server Service is running | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	printf >&2 "\n\n" | tee -a checklog.log
 | 
						printf >&2 "\n\n" | tee -a checklog.log
 | 
				
			||||||
    echo -ne ${RED}  'redis-server Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
					    echo -e ${RED}  'redis-server Service isnt running (Tactical wont work without this)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Checking Open Ports | tee -a checklog.log 
 | 
						echo -e ${YELLOW} Checking Open Ports | tee -a checklog.log 
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Get WAN IP
 | 
					#Get WAN IP
 | 
				
			||||||
wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
 | 
					wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo -ne ${GREEN} WAN IP is $wanip | tee -a checklog.log
 | 
					echo -e ${GREEN} WAN IP is $wanip | tee -a checklog.log
 | 
				
			||||||
printf >&2 "\n\n"
 | 
					printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ! which nc >/dev/null
 | 
				
			||||||
 | 
					then
 | 
				
			||||||
 | 
					    echo "netcat is not installed, installing now"
 | 
				
			||||||
 | 
					    sudo apt-get install netcat -y
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Check if HTTPs Port is open
 | 
					#Check if HTTPs Port is open
 | 
				
			||||||
if ( nc -zv $wanip 443 2>&1 >/dev/null ); then
 | 
					if ( nc -zv $wanip 443 2>&1 >/dev/null ); then
 | 
				
			||||||
    echo -ne ${GREEN} 'HTTPs Port is open' | tee -a checklog.log
 | 
					    echo -e ${GREEN} 'HTTPs Port is open' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    echo -ne ${RED} 'HTTPs port is closed (you may want this if running locally only)' | tee -a checklog.log
 | 
					    echo -e ${RED} 'HTTPs port is closed (you may want this if running locally only)' | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Checking For Proxy | tee -a checklog.log 
 | 
						echo -e ${YELLOW} Checking For Proxy | tee -a checklog.log 
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
	echo -ne ${YELLOW} ......this might take a while!!
 | 
						echo -e ${YELLOW} ......this might take a while!!
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Detect Proxy via cert
 | 
					# Detect Proxy via cert
 | 
				
			||||||
@@ -289,41 +314,41 @@ proxyext=$(openssl s_client -showcerts -servername $remapiip -connect $remapiip:
 | 
				
			|||||||
proxyint=$(openssl s_client -showcerts -servername 127.0.0.1 -connect 127.0.0.1:443 2>/dev/null | openssl x509 -inform pem -noout -text)
 | 
					proxyint=$(openssl s_client -showcerts -servername 127.0.0.1 -connect 127.0.0.1:443 2>/dev/null | openssl x509 -inform pem -noout -text)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $proxyext == $proxyint ]]; then
 | 
					if [[ $proxyext == $proxyint ]]; then
 | 
				
			||||||
    echo -ne ${GREEN} No Proxy detected using Certificate | tee -a checklog.log
 | 
					    echo -e ${GREEN} No Proxy detected using Certificate | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    echo -ne ${RED} Proxy detected using Certificate | tee -a checklog.log
 | 
					    echo -e ${RED} Proxy detected using Certificate | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Detect Proxy via IP
 | 
					# Detect Proxy via IP
 | 
				
			||||||
if [ $wanip != $remrmmip ]; then
 | 
					if [ $wanip != $remrmmip ]; then
 | 
				
			||||||
    echo -ne ${RED} Proxy detected using IP | tee -a checklog.log
 | 
					    echo -e ${RED} Proxy detected using IP | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    echo -ne ${GREEN} No Proxy detected using IP | tee -a checklog.log
 | 
					    echo -e ${GREEN} No Proxy detected using IP | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Checking SSL Certificate is up to date | tee -a checklog.log 
 | 
						echo -e ${YELLOW} Checking SSL Certificate is up to date | tee -a checklog.log 
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#SSL Certificate check
 | 
					#SSL Certificate check
 | 
				
			||||||
cert=$(sudo certbot certificates)
 | 
					cert=$(sudo certbot certificates)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ "$cert" != *"INVALID"* ]]; then
 | 
					if [[ "$cert" != *"INVALID"* ]]; then
 | 
				
			||||||
    echo -ne ${GREEN} SSL Certificate for $domain is fine  | tee -a checklog.log
 | 
					    echo -e ${GREEN} SSL Certificate for $domain is fine  | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    echo -ne ${RED} SSL Certificate has expired or doesnt exist for $domain  | tee -a checklog.log
 | 
					    echo -e ${RED} SSL Certificate has expired or doesnt exist for $domain  | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get List of Certbot Certificates
 | 
					# Get List of Certbot Certificates
 | 
				
			||||||
sudo certbot certificates | tee -a checklog.log
 | 
					sudo certbot certificates | tee -a checklog.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo -ne ${YELLOW} Getting summary output of logs | tee -a checklog.log  
 | 
						echo -e ${YELLOW} Getting summary output of logs | tee -a checklog.log  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tail /rmm/api/tacticalrmm/tacticalrmm/private/log/django_debug.log  | tee -a checklog.log
 | 
					tail /rmm/api/tacticalrmm/tacticalrmm/private/log/django_debug.log  | tee -a checklog.log
 | 
				
			||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
@@ -331,6 +356,6 @@ tail /rmm/api/tacticalrmm/tacticalrmm/private/log/error.log  | tee -a checklog.l
 | 
				
			|||||||
	printf >&2 "\n\n"
 | 
						printf >&2 "\n\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf >&2 "\n\n"
 | 
					printf >&2 "\n\n"
 | 
				
			||||||
echo -ne ${YELLOW} 
 | 
					echo -e ${YELLOW} 
 | 
				
			||||||
printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
					printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"
 | 
				
			||||||
echo -ne ${NC}
 | 
					echo -e ${NC}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user