From e179c8d3b5e2882fb25ac727050a93ef91a7a8b4 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 27 Apr 2022 19:17:38 -0400 Subject: [PATCH 01/55] Update README.md --- README.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index 5a6a2fa..fa0bc31 100644 --- a/README.md +++ b/README.md @@ -1,10 +1 @@ -# dvis - -Dinger's Various Scripts - -Written to make my life easier! - -Shall release any scripts I have written on here, most are powershell for tactical - -Probably not the neatest script writer but they do the job!! - +Install Script to install ITFlow From c7ce5365da8e6f1b80b52f3c611743afd4f43cc8 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 27 Apr 2022 19:26:22 -0400 Subject: [PATCH 02/55] Updated script to work only with Ubuntu 22.04 and some other minor changes --- itflowcrminstall.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/itflowcrminstall.sh b/itflowcrminstall.sh index 4a849bd..4fc0956 100644 --- a/itflowcrminstall.sh +++ b/itflowcrminstall.sh @@ -1,7 +1,7 @@ -#check if running on ubuntu 20.04 -UBU20=$(grep 20.04 "/etc/"*"release") +#Check if running on ubuntu 22.04 +UBU20=$(grep 22.04 "/etc/"*"release") if ! [[ $UBU20 ]]; then - echo -ne "\033[0;31mThis script will only work on Ubuntu 20.04\e[0m\n" + echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04\e[0m\n" exit 1 fi @@ -25,7 +25,7 @@ sudo apt-get update && sudo apt-get -y upgrade sudo apt-get install -y apache2 sudo apt-get install -y mariadb-server sudo mariadb_secure_installation -sudo apt-get install -y php libapache2-mod-php php-mysql php-mbstring php-curl +sudo apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl sudo apt-get install -y rewrite libapache2-mod-md sudo apt-get install -y certbot python3-certbot-apache sudo apt-get install -y git @@ -68,8 +68,8 @@ sudo certbot --apache #Go to webroot cd /var/www/${domain} -#Clone IT Flow CRM -git clone https://github.com/johnnyq/itflow.git . +#Clone ITFlow +git clone https://github.com/itflow-org/itflow.git . #Set permissions chown -R www-data:www-data /var/www/ From ea72bad879d6766e85ce292344fd9a799cf98a4f Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 27 Apr 2022 19:58:56 -0400 Subject: [PATCH 03/55] Automate LetsEncrypt, Use less stricter password for Mysql Password A-Za-z0-9 --- itflowcrminstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/itflowcrminstall.sh b/itflowcrminstall.sh index 4fc0956..3e3ccd0 100644 --- a/itflowcrminstall.sh +++ b/itflowcrminstall.sh @@ -13,7 +13,7 @@ read domain done #Generate mysql password -mysqlpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9%&+?@^~' | fold -w 20 | head -n 1) +mysqlpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) echo ${mysqlpwd} pause @@ -62,8 +62,8 @@ sudo a2ensite ${domain}.conf sudo a2dissite 000-default.conf sudo systemctl restart apache2 -#run certification -sudo certbot --apache +#Run certbot to get Free Lets Encrypt TLS Certificate +sudo certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} #Go to webroot cd /var/www/${domain} From ee729c875c55cea33e70468e2596be7511ed77da Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 27 Apr 2022 20:09:13 -0400 Subject: [PATCH 04/55] Renamed script --- itflowcrminstall.sh => itflow_install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename itflowcrminstall.sh => itflow_install.sh (100%) diff --git a/itflowcrminstall.sh b/itflow_install.sh similarity index 100% rename from itflowcrminstall.sh rename to itflow_install.sh From 1f4074bfff45eba597979d907ca15b6018f228b5 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 27 Apr 2022 20:15:26 -0400 Subject: [PATCH 05/55] Removed unnessesary code renamed mysql words with mariadb --- itflow_install.sh | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3e3ccd0..2039ccd 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,6 +1,6 @@ #Check if running on ubuntu 22.04 -UBU20=$(grep 22.04 "/etc/"*"release") -if ! [[ $UBU20 ]]; then +UBU22=$(grep 22.04 "/etc/"*"release") +if ! [[ $UBU22 ]]; then echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04\e[0m\n" exit 1 fi @@ -12,16 +12,13 @@ echo -ne "Enter your Domain${NC}: " read domain done -#Generate mysql password -mysqlpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) - -echo ${mysqlpwd} -pause +#Generate mariadb password +mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) #run update sudo apt-get update && sudo apt-get -y upgrade -#Install apache2 & mysql +#Install apache2 & mariadb sudo apt-get install -y apache2 sudo apt-get install -y mariadb-server sudo mariadb_secure_installation @@ -76,20 +73,10 @@ chown -R www-data:www-data /var/www/ #Create MySQl DB mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" - mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mysqlpwd}';" + mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" mysql -e "FLUSH PRIVILEGES;" printf >&2 "Please go to admin url: https://${domain}" printf >&2 "\n\n" -printf >&2 "Enter itflow as database user and database name. Enter '${mysqlpwd}' as MySQL Password\n\n" - -echo "Press any key to finish install" -while [ true ] ; do -read -t 3 -n 1 -if [ $? = 0 ] ; then -exit ; -else -echo "waiting for the keypress" -fi -done +printf >&2 "Enter itflow as database user and database name. Enter ${mariadbpwd} as database Password\n\n" From 1f148c66aee684bd7ef0fbf11238ca2816940b6b Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:27:54 +0000 Subject: [PATCH 06/55] Update README.md Add direction to run script as root - from telemetry feedback --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fa0bc31..a5194fa 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ Install Script to install ITFlow + +- Run the script as root From 37b66a1e94e546e45fe7185ae06ae08a66b35bfd Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Tue, 31 Jan 2023 23:42:11 +0000 Subject: [PATCH 07/55] Update itflow_install.sh Add php-imap & php-mailparse extensions to installer --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 2039ccd..8923a69 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -22,7 +22,7 @@ sudo apt-get update && sudo apt-get -y upgrade sudo apt-get install -y apache2 sudo apt-get install -y mariadb-server sudo mariadb_secure_installation -sudo apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl +sudo apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse sudo apt-get install -y rewrite libapache2-mod-md sudo apt-get install -y certbot python3-certbot-apache sudo apt-get install -y git From c92101702564a9a2e46afd12e590554e67696e8c Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 19:50:43 -0400 Subject: [PATCH 08/55] Added cron jobs during install and automatically generate cronkey --- itflow_install.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 8923a69..be2bec3 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -15,6 +15,9 @@ done #Generate mariadb password mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) +#Generate Cron Key +cronkey=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) + #run update sudo apt-get update && sudo apt-get -y upgrade @@ -68,6 +71,13 @@ cd /var/www/${domain} #Clone ITFlow git clone https://github.com/itflow-org/itflow.git . +#Add Cronjobs +(crontab -l 2>/dev/null; echo "0 2 * * * php -u www-data /var/www/${domain}/cron.php ${cronkey}") | crontab - +(crontab -l 2>/dev/null; echo "* * * * * php -u www-data /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - + +#Create temp file with the cronkey that setup will read and use +echo "${cronkey}" > /var/www/${domain}/uploads/tmp/cronkey.php + #Set permissions chown -R www-data:www-data /var/www/ @@ -79,4 +89,7 @@ chown -R www-data:www-data /var/www/ printf >&2 "Please go to admin url: https://${domain}" printf >&2 "\n\n" -printf >&2 "Enter itflow as database user and database name. Enter ${mariadbpwd} as database Password\n\n" +printf >&2 "In database setup enter the following:\n\n" +printf >&2 "Database User: itflow\n" +printf >&2 "Database Name: itflow\n" +prinff >&2 "Database Password: ${mariadbpwd} as database Password\n\n" From 4ee3e50dd29c6c9cdf047f6347ab0223d697b5cd Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 19:56:32 -0400 Subject: [PATCH 09/55] small update to use a php var instead of just the key itself --- itflow_install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index be2bec3..a3bc088 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -76,7 +76,9 @@ git clone https://github.com/itflow-org/itflow.git . (crontab -l 2>/dev/null; echo "* * * * * php -u www-data /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - #Create temp file with the cronkey that setup will read and use -echo "${cronkey}" > /var/www/${domain}/uploads/tmp/cronkey.php +echo " /var/www/${domain}/uploads/tmp/cronkey.php +echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php +echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php #Set permissions chown -R www-data:www-data /var/www/ From d8c55a6c52348d15e2048d1e4e904988c3eb96f0 Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 20:50:02 -0400 Subject: [PATCH 10/55] fix printf syntax --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index a3bc088..e327f0c 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -94,4 +94,4 @@ printf >&2 "\n\n" printf >&2 "In database setup enter the following:\n\n" printf >&2 "Database User: itflow\n" printf >&2 "Database Name: itflow\n" -prinff >&2 "Database Password: ${mariadbpwd} as database Password\n\n" +printf >&2 "Database Password: ${mariadbpwd} as database Password\n\n" From 79fbce7e42323a21d22d203d9ab7a379be1fb440 Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 20:55:04 -0400 Subject: [PATCH 11/55] remove extra wording --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index e327f0c..cb0b83d 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -94,4 +94,4 @@ printf >&2 "\n\n" printf >&2 "In database setup enter the following:\n\n" printf >&2 "Database User: itflow\n" printf >&2 "Database Name: itflow\n" -printf >&2 "Database Password: ${mariadbpwd} as database Password\n\n" +printf >&2 "Database Password: ${mariadbpwd} \n\n" From 1e536b75401b64194d3882ac2060f237b0e6beaa Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 21:10:42 -0400 Subject: [PATCH 12/55] fixed cronjob incorrect syntax must use sudo to run as www user --- itflow_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index cb0b83d..fd2d020 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -72,8 +72,8 @@ cd /var/www/${domain} git clone https://github.com/itflow-org/itflow.git . #Add Cronjobs -(crontab -l 2>/dev/null; echo "0 2 * * * php -u www-data /var/www/${domain}/cron.php ${cronkey}") | crontab - -(crontab -l 2>/dev/null; echo "* * * * * php -u www-data /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - +(crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - +(crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - #Create temp file with the cronkey that setup will read and use echo " /var/www/${domain}/uploads/tmp/cronkey.php From 5c0f84a14f0fb599b6f449c7a8cc23aab4462482 Mon Sep 17 00:00:00 2001 From: Johnny Date: Sat, 3 Jun 2023 21:22:00 -0400 Subject: [PATCH 13/55] Fix wording --- itflow_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index fd2d020..5f47f4c 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -18,7 +18,7 @@ mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) #Generate Cron Key cronkey=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) -#run update +#Get the latest OS updates sudo apt-get update && sudo apt-get -y upgrade #Install apache2 & mariadb @@ -89,9 +89,9 @@ chown -R www-data:www-data /var/www/ mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" mysql -e "FLUSH PRIVILEGES;" -printf >&2 "Please go to admin url: https://${domain}" +printf >&2 "Please go to https://${domain} to finish setting up ITFlow" printf >&2 "\n\n" -printf >&2 "In database setup enter the following:\n\n" +printf >&2 "In database setup section enter the following:\n\n" printf >&2 "Database User: itflow\n" printf >&2 "Database Name: itflow\n" printf >&2 "Database Password: ${mariadbpwd} \n\n" From d0be0a6193a9cab62d4adf6efac58d8b563c57a2 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 7 Jul 2023 17:06:08 -0400 Subject: [PATCH 14/55] Added cron_mail_queue, Removed Ubuntu 22.04 requirement, this should work with Debian 12 or Ubuntu 22.04 --- itflow_install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 5f47f4c..1588d04 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,9 +1,9 @@ #Check if running on ubuntu 22.04 -UBU22=$(grep 22.04 "/etc/"*"release") -if ! [[ $UBU22 ]]; then - echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04\e[0m\n" - exit 1 -fi +#UBU22=$(grep 22.04 "/etc/"*"release") +#if ! [[ $UBU22 ]]; then +# echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04\e[0m\n" +# exit 1 +#fi #Enter domain while [[ $domain != *[.]*[.]* ]] @@ -74,6 +74,7 @@ git clone https://github.com/itflow-org/itflow.git . #Add Cronjobs (crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - +(crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - #Create temp file with the cronkey that setup will read and use echo " /var/www/${domain}/uploads/tmp/cronkey.php From 45e382bb157aea1726ccb7654fc13c15566521c5 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 7 Jul 2023 17:17:21 -0400 Subject: [PATCH 15/55] Removed UFW Firewall rule set as this is not compatible with Debian 12 and should be set at the hardware Firewall level, also added Debian 12 Compatibility, basic tidy as well --- itflow_install.sh | 65 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 1588d04..348a450 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,27 +1,27 @@ -#Check if running on ubuntu 22.04 -#UBU22=$(grep 22.04 "/etc/"*"release") -#if ! [[ $UBU22 ]]; then -# echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04\e[0m\n" -# exit 1 -#fi - -#Enter domain +# Check if running on Ubuntu 22.04 or Debian 12 +OS_Check=$(grep -E "22.04|Debian 12" "/etc/"*"release") +if ! [[ $OS_Check ]]; then + echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04 or Debian 12\e[0m\n" + exit 1 +fi + +# Enter domain while [[ $domain != *[.]*[.]* ]] do -echo -ne "Enter your Domain${NC}: " -read domain + echo -ne "Enter your Domain${NC}: " + read domain done -#Generate mariadb password +# Generate mariadb password mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) -#Generate Cron Key +# Generate Cron Key cronkey=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) -#Get the latest OS updates +# Get the latest OS updates sudo apt-get update && sudo apt-get -y upgrade -#Install apache2 & mariadb +# Install apache2 & mariadb sudo apt-get install -y apache2 sudo apt-get install -y mariadb-server sudo mariadb_secure_installation @@ -32,20 +32,20 @@ sudo apt-get install -y git sudo a2enmod md sudo a2enmod ssl -#Restart apache2 +# Restart apache2 sudo systemctl restart apache2 -#Set firewall -sudo ufw allow OpenSSH -sudo ufw allow 'Apache Full' -sudo ufw enable +# Set firewall +# sudo ufw allow OpenSSH +# sudo ufw allow 'Apache Full' +# sudo ufw enable -#Create and set permissions on webroot +# Create and set permissions on webroot mkdir /var/www/${domain} chown -R www-data:www-data /var/www/ -#Set Apache2 config file +# Set Apache2 config file apache2="$(cat << EOF ServerAdmin webmaster@localhost @@ -62,34 +62,35 @@ sudo a2ensite ${domain}.conf sudo a2dissite 000-default.conf sudo systemctl restart apache2 -#Run certbot to get Free Lets Encrypt TLS Certificate +# Run certbot to get Free Lets Encrypt TLS Certificate sudo certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} -#Go to webroot +# Go to webroot cd /var/www/${domain} -#Clone ITFlow +# Clone ITFlow git clone https://github.com/itflow-org/itflow.git . -#Add Cronjobs +# Add Cronjobs (crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - -#Create temp file with the cronkey that setup will read and use +# Create temp file with the cronkey that setup will read and use echo " /var/www/${domain}/uploads/tmp/cronkey.php echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php -#Set permissions +# Set permissions chown -R www-data:www-data /var/www/ -#Create MySQl DB - mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" - mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" - mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" - mysql -e "FLUSH PRIVILEGES;" +# Create MySQL DB +mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" +mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" +mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" +mysql -e "FLUSH PRIVILEGES;" +# Print URL/DB/User info for end user to finish the setup process printf >&2 "Please go to https://${domain} to finish setting up ITFlow" printf >&2 "\n\n" printf >&2 "In database setup section enter the following:\n\n" From ac2938fa5c8393e583f81df1e158c1427bbfe3b9 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 7 Jul 2023 17:57:20 -0400 Subject: [PATCH 16/55] Check to make sure your root before running, fixed Debian 12 check, removed sudo before commands as its running as root --- itflow_install.sh | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 348a450..180a6c5 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,5 +1,11 @@ +# Check to make sure your root +if [[ $EUID -ne 0 ]]; then + echo -ne "\033[0;31mThis script must be run as root.\e[0m\n" + exit 1 +fi + # Check if running on Ubuntu 22.04 or Debian 12 -OS_Check=$(grep -E "22.04|Debian 12" "/etc/"*"release") +OS_Check=$(grep -E "22.04|12" "/etc/"*"release") if ! [[ $OS_Check ]]; then echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04 or Debian 12\e[0m\n" exit 1 @@ -19,26 +25,27 @@ mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) cronkey=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) # Get the latest OS updates -sudo apt-get update && sudo apt-get -y upgrade +apt-get update && apt-get -y upgrade # Install apache2 & mariadb -sudo apt-get install -y apache2 -sudo apt-get install -y mariadb-server -sudo mariadb_secure_installation -sudo apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse -sudo apt-get install -y rewrite libapache2-mod-md -sudo apt-get install -y certbot python3-certbot-apache -sudo apt-get install -y git -sudo a2enmod md -sudo a2enmod ssl +apt-get install -y apache2 +apt-get install -y mariadb-server +mariadb_secure_installation +apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse +apt-get install -y rewrite libapache2-mod-md +apt-get install -y certbot python3-certbot-apache +apt-get install -y git +apt-get install -y sudo +a2enmod md +a2enmod ssl # Restart apache2 -sudo systemctl restart apache2 +systemctl restart apache2 # Set firewall -# sudo ufw allow OpenSSH -# sudo ufw allow 'Apache Full' -# sudo ufw enable +# ufw allow OpenSSH +# ufw allow 'Apache Full' +# ufw enable # Create and set permissions on webroot mkdir /var/www/${domain} @@ -58,12 +65,12 @@ EOF )" echo "${apache2}" > /etc/apache2/sites-available/${domain}.conf -sudo a2ensite ${domain}.conf -sudo a2dissite 000-default.conf -sudo systemctl restart apache2 +a2ensite ${domain}.conf +a2dissite 000-default.conf +systemctl restart apache2 # Run certbot to get Free Lets Encrypt TLS Certificate -sudo certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} +certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} # Go to webroot cd /var/www/${domain} From 0a4c86d5a70335b39ea4ca5fa5c645b1d03d28d8 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 7 Jul 2023 18:13:53 -0400 Subject: [PATCH 17/55] Change wording from domain to Fully Qualified domain along with an example --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 180a6c5..3352e7a 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -14,7 +14,7 @@ fi # Enter domain while [[ $domain != *[.]*[.]* ]] do - echo -ne "Enter your Domain${NC}: " + echo -ne "Enter your Fully Qualified Domain -- example (itflow.domain.com)${NC}: " read domain done From 57b9c1b05783713485312f186de3589adc5f4e5b Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:14:28 -0400 Subject: [PATCH 18/55] Restructure script to use function calls, improve error handling and easier readability, also added 500M Upload limits to the php.ini configuration file --- itflow_install.sh | 219 +++++++++++++++++++++++++--------------------- 1 file changed, 118 insertions(+), 101 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3352e7a..0f52eab 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,106 +1,123 @@ -# Check to make sure your root -if [[ $EUID -ne 0 ]]; then - echo -ne "\033[0;31mThis script must be run as root.\e[0m\n" - exit 1 -fi - -# Check if running on Ubuntu 22.04 or Debian 12 -OS_Check=$(grep -E "22.04|12" "/etc/"*"release") -if ! [[ $OS_Check ]]; then - echo -ne "\033[0;31mThis script will only work on Ubuntu 22.04 or Debian 12\e[0m\n" - exit 1 -fi - -# Enter domain -while [[ $domain != *[.]*[.]* ]] -do - echo -ne "Enter your Fully Qualified Domain -- example (itflow.domain.com)${NC}: " - read domain -done - -# Generate mariadb password -mariadbpwd=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) - -# Generate Cron Key -cronkey=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 20 | head -n 1) - -# Get the latest OS updates -apt-get update && apt-get -y upgrade - -# Install apache2 & mariadb -apt-get install -y apache2 -apt-get install -y mariadb-server -mariadb_secure_installation -apt-get install -y php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse -apt-get install -y rewrite libapache2-mod-md -apt-get install -y certbot python3-certbot-apache -apt-get install -y git -apt-get install -y sudo -a2enmod md -a2enmod ssl - -# Restart apache2 -systemctl restart apache2 - -# Set firewall -# ufw allow OpenSSH -# ufw allow 'Apache Full' -# ufw enable - -# Create and set permissions on webroot -mkdir /var/www/${domain} - -chown -R www-data:www-data /var/www/ - -# Set Apache2 config file -apache2="$(cat << EOF - +#!/bin/bash + +check_root() { + if [[ $EUID -ne 0 ]]; then + echo -e "\033[0;31mThis script must be run as root.\e[0m" + exit 1 + fi +} + +check_os() { + if ! grep -E "22.04|12" "/etc/"*"release" &>/dev/null; then + echo -e "\033[0;31mThis script will only work on Ubuntu 22.04 or Debian 12\e[0m" + exit 1 + fi +} + +get_domain() { + while [[ $domain != *[.]*[.]* ]]; do + echo -ne "Enter your Fully Qualified Domain -- example (itflow.domain.com): " + read domain + done +} + +generate_passwords() { + mariadbpwd=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) + cronkey=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) +} + +install_packages() { + apt-get update && apt-get -y upgrade + apt-get install -y apache2 mariadb-server php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse rewrite libapache2-mod-md certbot python3-certbot-apache git sudo + + mariadb_secure_installation + + a2enmod md + a2enmod ssl +} + +modify_php_ini() { + local PHP_INI_PATH="/etc/php/php.ini" + sed -i 's/^;\?upload_max_filesize =.*/upload_max_filesize = 500M/' $PHP_INI_PATH + sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' $PHP_INI_PATH +} + +setup_firewall() { + # Uncomment the lines below if you want to enable UFW + # ufw allow OpenSSH + # ufw allow 'Apache Full' + # ufw enable +} + +setup_webroot() { + mkdir -p /var/www/${domain} + chown -R www-data:www-data /var/www/ +} + +setup_apache() { + apache2_conf=" ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} ErrorLog /\${APACHE_LOG_DIR}/error.log CustomLog /\${APACHE_LOG_DIR}/access.log combined - -EOF -)" -echo "${apache2}" > /etc/apache2/sites-available/${domain}.conf - -a2ensite ${domain}.conf -a2dissite 000-default.conf -systemctl restart apache2 - -# Run certbot to get Free Lets Encrypt TLS Certificate -certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} - -# Go to webroot -cd /var/www/${domain} - -# Clone ITFlow -git clone https://github.com/itflow-org/itflow.git . - -# Add Cronjobs -(crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - -(crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - -(crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - - -# Create temp file with the cronkey that setup will read and use -echo " /var/www/${domain}/uploads/tmp/cronkey.php -echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php -echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php - -# Set permissions -chown -R www-data:www-data /var/www/ - -# Create MySQL DB -mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" -mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" -mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" -mysql -e "FLUSH PRIVILEGES;" - -# Print URL/DB/User info for end user to finish the setup process -printf >&2 "Please go to https://${domain} to finish setting up ITFlow" -printf >&2 "\n\n" -printf >&2 "In database setup section enter the following:\n\n" -printf >&2 "Database User: itflow\n" -printf >&2 "Database Name: itflow\n" -printf >&2 "Database Password: ${mariadbpwd} \n\n" +" + + echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf + + a2ensite ${domain}.conf + a2dissite 000-default.conf + systemctl restart apache2 + + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} +} + +clone_itflow() { + git clone https://github.com/itflow-org/itflow.git /var/www/${domain} +} + +setup_cronjobs() { + (crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - + (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - + (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - +} + +generate_cronkey_file() { + mkdir -p /var/www/${domain}/uploads/tmp + echo " /var/www/${domain}/uploads/tmp/cronkey.php + echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php + echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php + chown -R www-data:www-data /var/www/ +} + +setup_mysql() { + mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" + mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" + mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" + mysql -e "FLUSH PRIVILEGES;" +} + +print_final_instructions() { + echo "Please go to https://${domain} to finish setting up ITFlow" + echo "" + echo "In database setup section enter the following:" + echo "Database User: itflow" + echo "Database Name: itflow" + echo "Database Password: ${mariadbpwd}" +} + +# Execution begins here +check_root +check_os +get_domain +generate_passwords +install_packages +modify_php_ini +setup_firewall +setup_webroot +setup_apache +clone_itflow +setup_cronjobs +generate_cronkey_file +setup_mysql +print_final_instructions From 973dad98f4018a7e9b89493a67ddca474edacb2a Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:19:44 -0400 Subject: [PATCH 19/55] Comment out Firewall --- itflow_install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 0f52eab..604351a 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -43,10 +43,9 @@ modify_php_ini() { } setup_firewall() { - # Uncomment the lines below if you want to enable UFW - # ufw allow OpenSSH - # ufw allow 'Apache Full' - # ufw enable + ufw allow OpenSSH + ufw allow 'Apache Full' + ufw enable } setup_webroot() { @@ -113,7 +112,8 @@ get_domain generate_passwords install_packages modify_php_ini -setup_firewall +# Uncomment the line below if you want to enable UFW Firewall +#setup_firewall setup_webroot setup_apache clone_itflow From efa9cd32d91d0f1ce44caeb85c778210feb39e00 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:29:40 -0400 Subject: [PATCH 20/55] Package install fix --- itflow_install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 604351a..652b765 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -28,7 +28,10 @@ generate_passwords() { install_packages() { apt-get update && apt-get -y upgrade - apt-get install -y apache2 mariadb-server php libapache2-mod-php php-intl php-mysqli php-curl php-imap php-mailparse rewrite libapache2-mod-md certbot python3-certbot-apache git sudo + apt-get install -y apache2 mariadb-server \ + php libapache2-mod-php php-intl php-mysqli \ + php-curl php-imap php-mailparse libapache2-mod-md \ + certbot python3-certbot-apache git sudo rewrite mariadb_secure_installation From de5f849a8995df3d9c32337f743fa7f23dfecc85 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:38:05 -0400 Subject: [PATCH 21/55] Remove Firewall Config remove rewrite package as it was a mistake --- itflow_install.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 652b765..19c2f5b 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -31,7 +31,7 @@ install_packages() { apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli \ php-curl php-imap php-mailparse libapache2-mod-md \ - certbot python3-certbot-apache git sudo rewrite + certbot python3-certbot-apache git sudo mariadb_secure_installation @@ -45,12 +45,6 @@ modify_php_ini() { sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' $PHP_INI_PATH } -setup_firewall() { - ufw allow OpenSSH - ufw allow 'Apache Full' - ufw enable -} - setup_webroot() { mkdir -p /var/www/${domain} chown -R www-data:www-data /var/www/ @@ -115,8 +109,6 @@ get_domain generate_passwords install_packages modify_php_ini -# Uncomment the line below if you want to enable UFW Firewall -#setup_firewall setup_webroot setup_apache clone_itflow From ddcd57a0cc12e2d4dea943f70e3333b97ee988df Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:45:08 -0400 Subject: [PATCH 22/55] Add some UI/UX improvement to the install script --- itflow_install.sh | 56 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 19c2f5b..64d8cce 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,24 +1,33 @@ #!/bin/bash +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# Check if the user is root check_root() { if [[ $EUID -ne 0 ]]; then - echo -e "\033[0;31mThis script must be run as root.\e[0m" + echo -e "${RED}Error: This script must be run as root.${NC}" exit 1 fi } +# Check OS check_os() { if ! grep -E "22.04|12" "/etc/"*"release" &>/dev/null; then - echo -e "\033[0;31mThis script will only work on Ubuntu 22.04 or Debian 12\e[0m" + echo -e "${RED}Error: This script only supports Ubuntu 22.04 or Debian 12.${NC}" exit 1 fi } +# Get domain name from user get_domain() { while [[ $domain != *[.]*[.]* ]]; do - echo -ne "Enter your Fully Qualified Domain -- example (itflow.domain.com): " + echo -ne "Step 1: Please enter your Fully Qualified Domain (e.g., itflow.domain.com): " read domain done + echo -e "${GREEN}Domain set to: $domain${NC}" } generate_passwords() { @@ -102,17 +111,56 @@ print_final_instructions() { echo "Database Password: ${mariadbpwd}" } +# Welcome Message +clear +echo "############################################" +echo "# Welcome to the ITFlow Installation Script #" +echo "############################################" +echo "" +echo "Please follow the prompts to complete the installation." +echo "" + # Execution begins here check_root check_os get_domain generate_passwords + +echo -e "\n${GREEN}Step 2: Installing necessary packages...${NC}" install_packages + +echo -e "\n${GREEN}Step 3: Modifying PHP configurations...${NC}" modify_php_ini + +echo -e "\n${GREEN}Step 4: Setting up webroot...${NC}" setup_webroot + +echo -e "\n${GREEN}Step 5: Configuring Apache...${NC}" setup_apache + +echo -e "\n${GREEN}Step 6: Cloning ITFlow...${NC}" clone_itflow + +echo -e "\n${GREEN}Step 7: Setting up cron jobs...${NC}" setup_cronjobs + +echo -e "\n${GREEN}Step 8: Generating cron key file...${NC}" generate_cronkey_file + +echo -e "\n${GREEN}Step 9: Setting up MySQL...${NC}" setup_mysql -print_final_instructions + +# Final message with clear instructions +clear +echo "######################################################" +echo "# Installation Completed Successfully! #" +echo "######################################################" +echo "" +echo -e "Visit: ${GREEN}https://${domain}${NC} to complete the ITFlow setup." +echo "" +echo "Database setup details:" +echo -e "Database User: ${GREEN}itflow${NC}" +echo -e "Database Name: ${GREEN}itflow${NC}" +echo -e "Database Password: ${GREEN}${mariadbpwd}${NC}" +echo "" +echo "Thank you for using our script!" From f9127a2dcd63701216e393a6d508b7a9ebfa3c2c Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:48:41 -0400 Subject: [PATCH 23/55] UI Cleanup --- itflow_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 64d8cce..de9a9e6 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -113,9 +113,9 @@ print_final_instructions() { # Welcome Message clear -echo "############################################" +echo "#############################################" echo "# Welcome to the ITFlow Installation Script #" -echo "############################################" +echo "#############################################" echo "" echo "Please follow the prompts to complete the installation." echo "" From 51fc3fc5a21ea33916d480ad42291b6d88370dbb Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 11:52:48 -0400 Subject: [PATCH 24/55] More UI --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index de9a9e6..01f1850 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -153,7 +153,7 @@ setup_mysql # Final message with clear instructions clear echo "######################################################" -echo "# Installation Completed Successfully! #" +echo "# Installation Completed Successfully! #" echo "######################################################" echo "" echo -e "Visit: ${GREEN}https://${domain}${NC} to complete the ITFlow setup." From 49eea0153a95f8c6ecaefe81985d8c7cf0bf53a3 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 12:06:19 -0400 Subject: [PATCH 25/55] Update script to check php version before updating php ini vars --- itflow_install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 01f1850..2116399 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -49,7 +49,12 @@ install_packages() { } modify_php_ini() { - local PHP_INI_PATH="/etc/php/php.ini" + # Get the PHP version + PHP_VERSION=$(php -v | head -n 1 | awk '{print $2}' | cut -d '.' -f 1,2) + + # Set the PHP_INI_PATH + PHP_INI_PATH="/etc/php/${PHP_VERSION}/apache2/php.ini" + sed -i 's/^;\?upload_max_filesize =.*/upload_max_filesize = 500M/' $PHP_INI_PATH sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' $PHP_INI_PATH } From a6480f0909ccfcadd1ae5b7ec52eb21165f6f12d Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 16 Aug 2023 12:11:03 -0400 Subject: [PATCH 26/55] Get rid of the thank you --- itflow_install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 2116399..143729c 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -168,4 +168,3 @@ echo -e "Database User: ${GREEN}itflow${NC}" echo -e "Database Name: ${GREEN}itflow${NC}" echo -e "Database Password: ${GREEN}${mariadbpwd}${NC}" echo "" -echo "Thank you for using our script!" From 28efe668c073fa6f1bb50ebcc552496e591653a5 Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Sat, 30 Sep 2023 17:44:58 +0100 Subject: [PATCH 27/55] Add files via upload GNU GPL --- LICENSE.txt | 621 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 621 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ed990f8 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS \ No newline at end of file From c011a60c999a8af548c19c020aa72f699d6ff9b8 Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Sun, 26 May 2024 16:34:10 +0100 Subject: [PATCH 28/55] Update itflow_install.sh - Add php-gd --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 143729c..3708bde 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -38,7 +38,7 @@ generate_passwords() { install_packages() { apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ - php libapache2-mod-php php-intl php-mysqli \ + php libapache2-mod-php php-intl php-mysqli php-gd \ php-curl php-imap php-mailparse libapache2-mod-md \ certbot python3-certbot-apache git sudo From 14ed560c12f4d4f33875b627c8945cf9e3b461bc Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 31 May 2024 18:44:39 -0400 Subject: [PATCH 29/55] Force Timezone Change when installing via script and add Ubuntu 24.04 Support --- itflow_install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3708bde..3249b4e 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -15,12 +15,17 @@ check_root() { # Check OS check_os() { - if ! grep -E "22.04|12" "/etc/"*"release" &>/dev/null; then - echo -e "${RED}Error: This script only supports Ubuntu 22.04 or Debian 12.${NC}" + if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then + echo -e "${RED}Error: This script only supports Ubuntu 22.04, Ubuntu 24.04 or Debian 12.${NC}" exit 1 fi } +# Set Correct Timezone +set_timezone() { + dpkg-reconfigure tzdata +} + # Get domain name from user get_domain() { while [[ $domain != *[.]*[.]* ]]; do @@ -128,6 +133,7 @@ echo "" # Execution begins here check_root check_os +set_timezone get_domain generate_passwords From 101b89daac043826cbddea218176f3722ebae12a Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 3 Jun 2024 21:16:43 -0400 Subject: [PATCH 30/55] Add whois to the packages to install --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3249b4e..645d7b9 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -45,7 +45,7 @@ install_packages() { apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ php-curl php-imap php-mailparse libapache2-mod-md \ - certbot python3-certbot-apache git sudo + certbot python3-certbot-apache git sudo whois mariadb_secure_installation From 8b3c4e3c9f29426f89271ec4ca88127ddd405ca6 Mon Sep 17 00:00:00 2001 From: Johnnyq Date: Tue, 25 Jun 2024 12:53:22 -0400 Subject: [PATCH 31/55] Only allow Debian 12 installs as Ubuntu 24.04 has a bug with php mail-parse and ubuntu 22.04 PHP is too old and needs to be php 8.2 or above, also added cron to the install incase its not included removed unused print final screen --- itflow_install.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 645d7b9..acf250b 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -15,8 +15,8 @@ check_root() { # Check OS check_os() { - if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then - echo -e "${RED}Error: This script only supports Ubuntu 22.04, Ubuntu 24.04 or Debian 12.${NC}" + if ! grep -E "12" "/etc/"*"release" &>/dev/null; then + echo -e "${RED}Error: This script only supports Debian 12 at the moment, ubuntu 24.04 has a bug with mail-parse.${NC}" exit 1 fi } @@ -24,6 +24,7 @@ check_os() { # Set Correct Timezone set_timezone() { dpkg-reconfigure tzdata + clear } # Get domain name from user @@ -45,7 +46,7 @@ install_packages() { apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ php-curl php-imap php-mailparse libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois + certbot python3-certbot-apache git sudo whois cron mariadb_secure_installation @@ -112,15 +113,6 @@ setup_mysql() { mysql -e "FLUSH PRIVILEGES;" } -print_final_instructions() { - echo "Please go to https://${domain} to finish setting up ITFlow" - echo "" - echo "In database setup section enter the following:" - echo "Database User: itflow" - echo "Database Name: itflow" - echo "Database Password: ${mariadbpwd}" -} - # Welcome Message clear echo "#############################################" From 0a2d858218487d1fd2ba7272156975b4ec6a136b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 25 Jun 2024 16:13:48 -0400 Subject: [PATCH 32/55] Remove php extensions php-imap and php-mailparse as we rely on the WEBKLEX PHP-IMAP library and add back ubuntu 24.04 support --- itflow_install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index acf250b..81bc0b0 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -15,8 +15,8 @@ check_root() { # Check OS check_os() { - if ! grep -E "12" "/etc/"*"release" &>/dev/null; then - echo -e "${RED}Error: This script only supports Debian 12 at the moment, ubuntu 24.04 has a bug with mail-parse.${NC}" + if ! grep -E "24.04|12" "/etc/"*"release" &>/dev/null; then + echo -e "${RED}Error: This script only supports Ubuntu 24.04 or Debian 12.${NC}" exit 1 fi } @@ -45,8 +45,8 @@ install_packages() { apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois cron + php-curl libapache2-mod-md \ + certbot python3-certbot-apache git sudo whois cron dnsutils mariadb_secure_installation From f1f602e9b55c925f97e8bd943d32120fcd387f1f Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Jun 2024 13:04:37 -0400 Subject: [PATCH 33/55] Add Back php-imap and php-mailparse just in case we decide to move away from Webklex php-imap --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 81bc0b0..3d1fd92 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -45,7 +45,7 @@ install_packages() { apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl libapache2-mod-md \ + php-curl php-imap php-mailparse libapache2-mod-md \ certbot python3-certbot-apache git sudo whois cron dnsutils mariadb_secure_installation From 3a1fc5018743f71902dce6c6d025a4469d6d6bee Mon Sep 17 00:00:00 2001 From: SyNode <97973228+SyNode-IT@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:51:33 +0200 Subject: [PATCH 34/55] Update itflow_install.sh --- itflow_install.sh | 218 +++++++++++++++++++++++++++++++++------------- 1 file changed, 157 insertions(+), 61 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3d1fd92..601cdae 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,60 +1,105 @@ #!/bin/bash -# Colors +# Colors for terminal output RED='\033[0;31m' GREEN='\033[0;32m' +YELLOW='\033[1;33m' NC='\033[0m' # No Color +# Log file path +LOG_FILE="/var/log/itflow_install.log" +# Clear previous installation log +rm -f "$LOG_FILE" # Delete the previous log file + +# Function to log messages +log() { + echo "$(date): $1" >> "$LOG_FILE" +} + +# Function to show progress messages +show_progress() { + echo -e "${GREEN}$1${NC}" +} + # Check if the user is root check_root() { if [[ $EUID -ne 0 ]]; then + log "Error: This script must be run as root." echo -e "${RED}Error: This script must be run as root.${NC}" exit 1 fi } -# Check OS +# Check if the OS is supported check_os() { - if ! grep -E "24.04|12" "/etc/"*"release" &>/dev/null; then + if ! grep -E "24.04|12" "/etc/"*"release" &>/dev/null; then + log "Error: This script only supports Ubuntu 24.04 or Debian 12." echo -e "${RED}Error: This script only supports Ubuntu 24.04 or Debian 12.${NC}" exit 1 fi } -# Set Correct Timezone +# Function to install required packages +install_packages() { + log "Installing packages" + show_progress "1. Installing packages..." + apt-get update >> "$LOG_FILE" 2>&1 && apt-get -y upgrade >> "$LOG_FILE" 2>&1 + apt-get install -y apache2 mariadb-server \ + php libapache2-mod-php php-intl php-mysqli php-gd \ + php-curl php-imap php-mailparse libapache2-mod-md \ + certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 +} + +# Function to check for required binaries +check_required_binaries() { + log "Check packages" + show_progress "2. Check packages..." + + local binaries=("dpkg-reconfigure" "a2ensite" "a2dissite" "a2enmod") + + for bin in "${binaries[@]}"; do + if ! command -v $bin &> /dev/null; then + if [ -x "/usr/sbin/$bin" ]; then + export PATH="$PATH:/usr/sbin" + else + log "Error: $bin not found in PATH or /usr/sbin" + echo -e "${RED}Error: $bin not found. Please make sure it is installed and in your PATH or in /usr/sbin.${NC}" + exit 1 + fi + fi + done +} + +# Set the correct timezone set_timezone() { + log "Configuring timezone" + show_progress "3. Configuring timezone..." dpkg-reconfigure tzdata - clear } # Get domain name from user get_domain() { while [[ $domain != *[.]*[.]* ]]; do - echo -ne "Step 1: Please enter your Fully Qualified Domain (e.g., itflow.domain.com): " + echo -ne "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}" read domain done + log "Domain set to: $domain" echo -e "${GREEN}Domain set to: $domain${NC}" } +# Generate random passwords generate_passwords() { + log "Generating passwords" + show_progress "5. Generating passwords..." + MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) mariadbpwd=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) cronkey=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) } -install_packages() { - apt-get update && apt-get -y upgrade - apt-get install -y apache2 mariadb-server \ - php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois cron dnsutils - - mariadb_secure_installation - - a2enmod md - a2enmod ssl -} - +# Modify PHP configuration modify_php_ini() { + log "Modifying php.ini" + show_progress "6. Configuring PHP..." # Get the PHP version PHP_VERSION=$(php -v | head -n 1 | awk '{print $2}' | cut -d '.' -f 1,2) @@ -65,12 +110,22 @@ modify_php_ini() { sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' $PHP_INI_PATH } +# Setup web root directory setup_webroot() { + log "Setting up webroot" + show_progress "7. Setting up webroot..." mkdir -p /var/www/${domain} chown -R www-data:www-data /var/www/ } +# Configure Apache setup_apache() { + log "Configuring Apache" + show_progress "8. Configuring Apache..." + + a2enmod md >> "$LOG_FILE" 2>&1 + a2enmod ssl >> "$LOG_FILE" 2>&1 + apache2_conf=" ServerAdmin webmaster@localhost ServerName ${domain} @@ -81,24 +136,33 @@ setup_apache() { echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf - a2ensite ${domain}.conf - a2dissite 000-default.conf - systemctl restart apache2 + a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 + a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 + systemctl restart apache2 >> "$LOG_FILE" 2>&1 - certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 } +# Clone ITFlow repository clone_itflow() { - git clone https://github.com/itflow-org/itflow.git /var/www/${domain} + log "Cloning ITFlow" + show_progress "9. Cloning ITFlow..." + git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 } +# Setup cron jobs setup_cronjobs() { + log "Setting up cron jobs" + show_progress "10. Setting up cron jobs..." (crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - } +# Generate cron key file generate_cronkey_file() { + log "Generating cron key file" + show_progress "11. Generating cron key file..." mkdir -p /var/www/${domain}/uploads/tmp echo " /var/www/${domain}/uploads/tmp/cronkey.php echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php @@ -106,63 +170,95 @@ generate_cronkey_file() { chown -R www-data:www-data /var/www/ } -setup_mysql() { - mysql -e "CREATE DATABASE itflow /*\!40100 DEFAULT CHARACTER SET utf8 */;" - mysql -e "CREATE USER itflow@localhost IDENTIFIED BY '${mariadbpwd}';" - mysql -e "GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost';" - mysql -e "FLUSH PRIVILEGES;" +# Setup MariaDB +setup_mariadb() { + log "MariaDB installation" + show_progress "12. MariaDB installation..." + + if ! dpkg -l | grep -q mariadb-server || ! systemctl is-active --quiet mariadb; then + log "Error: MariaDB is not installed or not running." + echo -e "${RED}Error: MariaDB is not installed or not running.${NC}" + exit 1 + fi + + # Use expect to automate mysql_secure_installation + expect <> "$LOG_FILE" 2>&1 +spawn mysql_secure_installation +send "\r" +send "n\r" +send "y\r" +send "$MARIADB_ROOT_PASSWORD\r" +send "$MARIADB_ROOT_PASSWORD\r" +send "y\r" +send "y\r" +send "y\r" +send "y\r" +expect eof +EOF + + # Check the previous execution + if [ $? -ne 0 ]; then + log "Error: mysql_secure_installation failed." + echo -e "${RED}Error: mysql_secure_installation failed.${NC}" + exit 1 + fi + + # Create the database and itflow user + mysql -u root -p"$MARIADB_ROOT_PASSWORD" -e " + CREATE DATABASE IF NOT EXISTS itflow CHARACTER SET utf8; + CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; + GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; + FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 + + # Check the previous execution + if [ $? -ne 0 ]; then + log "Error: Failed to configure MariaDB." + echo -e "${RED}Error: Failed to configure MariaDB.${NC}" + exit 1 + fi + + log "MariaDB secured and configured." + echo -e "${GREEN}MariaDB secured and configured.${NC}" } # Welcome Message clear -echo "#############################################" -echo "# Welcome to the ITFlow Installation Script #" -echo "#############################################" -echo "" -echo "Please follow the prompts to complete the installation." -echo "" +echo -e "${GREEN}#############################################${NC}" +echo -e "${GREEN}# Welcome to the ITFlow Installation Script #${NC}" +echo -e "${GREEN}#############################################${NC}" +echo +echo -e "${YELLOW}Please follow the prompts to complete the installation.${NC}" +echo # Execution begins here check_root check_os +install_packages +check_required_binaries set_timezone get_domain generate_passwords - -echo -e "\n${GREEN}Step 2: Installing necessary packages...${NC}" -install_packages - -echo -e "\n${GREEN}Step 3: Modifying PHP configurations...${NC}" modify_php_ini - -echo -e "\n${GREEN}Step 4: Setting up webroot...${NC}" setup_webroot - -echo -e "\n${GREEN}Step 5: Configuring Apache...${NC}" setup_apache - -echo -e "\n${GREEN}Step 6: Cloning ITFlow...${NC}" clone_itflow - -echo -e "\n${GREEN}Step 7: Setting up cron jobs...${NC}" setup_cronjobs - -echo -e "\n${GREEN}Step 8: Generating cron key file...${NC}" generate_cronkey_file +setup_mariadb -echo -e "\n${GREEN}Step 9: Setting up MySQL...${NC}" -setup_mysql - -# Final message with clear instructions -clear -echo "######################################################" -echo "# Installation Completed Successfully! #" -echo "######################################################" -echo "" +# Final message with instructions +echo +echo -e "${GREEN}######################################################${NC}" +echo -e "${GREEN}# Installation Completed Successfully! #${NC}" +echo -e "${GREEN}######################################################${NC}" +echo echo -e "Visit: ${GREEN}https://${domain}${NC} to complete the ITFlow setup." -echo "" +echo echo "Database setup details:" echo -e "Database User: ${GREEN}itflow${NC}" echo -e "Database Name: ${GREEN}itflow${NC}" echo -e "Database Password: ${GREEN}${mariadbpwd}${NC}" -echo "" +echo +echo -e "Database ROOT Password: ${GREEN}${MARIADB_ROOT_PASSWORD}${NC}" +echo +echo -e "A detailed log file is available at: ${GREEN}$LOG_FILE${NC}" From 88b99df242e71d862b2ea991fbbdcebcf1588379 Mon Sep 17 00:00:00 2001 From: SyNode <97973228+SyNode-IT@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:34:19 +0200 Subject: [PATCH 35/55] Update itflow_install.sh --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 601cdae..ff5952c 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -32,7 +32,7 @@ check_root() { # Check if the OS is supported check_os() { - if ! grep -E "24.04|12" "/etc/"*"release" &>/dev/null; then + if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then log "Error: This script only supports Ubuntu 24.04 or Debian 12." echo -e "${RED}Error: This script only supports Ubuntu 24.04 or Debian 12.${NC}" exit 1 From cdc30cd5e4d7ac464437f0eb3a4be5093f46776e Mon Sep 17 00:00:00 2001 From: SyNode <97973228+SyNode-IT@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:34:46 +0200 Subject: [PATCH 36/55] Update itflow_install.sh --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index ff5952c..4b99893 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -34,7 +34,7 @@ check_root() { check_os() { if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then log "Error: This script only supports Ubuntu 24.04 or Debian 12." - echo -e "${RED}Error: This script only supports Ubuntu 24.04 or Debian 12.${NC}" + echo -e "${RED}Error: This script only supports Ubuntu 22.04 and 24.04 or Debian 12.${NC}" exit 1 fi } From 0ef554baa7172c900cebe1663b381bf04e235da7 Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:06:55 +0100 Subject: [PATCH 37/55] Update itflow_install.sh --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3d1fd92..0c46272 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -45,7 +45,7 @@ install_packages() { apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse libapache2-mod-md \ + php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ certbot python3-certbot-apache git sudo whois cron dnsutils mariadb_secure_installation From 3fdc02d3fecc97850592eb9993a68fad82bfbaa3 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:29:21 -0400 Subject: [PATCH 38/55] Instead of adding crons to the contab for the user root add it to the systemwide cron by creating a seperate file in /etc/cron/cron.d/itflow therefore there is no need to use sudo as we can specify the run user www-data in the cron --- itflow_install.sh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index bee4ad5..6ab024a 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -131,8 +131,8 @@ setup_apache() { ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} - ErrorLog /\${APACHE_LOG_DIR}/error.log - CustomLog /\${APACHE_LOG_DIR}/access.log combined + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined " echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf @@ -155,9 +155,31 @@ clone_itflow() { setup_cronjobs() { log "Setting up cron jobs" show_progress "10. Setting up cron jobs..." - (crontab -l 2>/dev/null; echo "0 2 * * * sudo -u www-data php /var/www/${domain}/cron.php ${cronkey}") | crontab - - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}") | crontab - - (crontab -l 2>/dev/null; echo "* * * * * sudo -u www-data php /var/www/${domain}/cron_mail_queue.php ${cronkey}") | crontab - + + CRON_FILE="/etc/cron.d/itflow" + + # Find the PHP binary + PHP_BIN=$(command -v php) + + if [ -z "$PHP_BIN" ]; then + log "PHP binary not found!" + echo -e "${RED}PHP binary not found!${NC}" + exit 1 + fi + + # Write the cron entries into the file + echo "0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/cron.php ${cronkey}" > $CRON_FILE + echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}" >> $CRON_FILE + echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron_mail_queue.php ${cronkey}" >> $CRON_FILE + + # Ensure the cron file has the correct permissions + chmod 644 $CRON_FILE + + # Set ownership to root + chown root:root $CRON_FILE + + log "Cron jobs added to /etc/cron.d/itflow" + echo -e "${GREEN}Cron jobs added to /etc/cron.d/itflow${NC}" } # Generate cron key file From 750e98f447c9aba7c9700baf58a36d945fba6e62 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:39:25 -0400 Subject: [PATCH 39/55] Add a Working spinner so it shows the script is doing something, and some other tidying --- itflow_install.sh | 111 +++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 6ab024a..ffd82c7 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -11,6 +11,20 @@ LOG_FILE="/var/log/itflow_install.log" # Clear previous installation log rm -f "$LOG_FILE" # Delete the previous log file +# Spinner function +spin() { + local pid=$! + local delay=0.1 + local spinner='|/-\' + while [ -d /proc/$pid ]; do + for i in $(seq 0 3); do + printf "\r${GREEN}$1 ${spinner:$i:1}${NC}" + sleep $delay + done + done + printf "\r${GREEN}$1... Done! ${NC}\n" +} + # Function to log messages log() { echo "$(date): $1" >> "$LOG_FILE" @@ -43,17 +57,22 @@ check_os() { install_packages() { log "Installing packages" show_progress "1. Installing packages..." - apt-get update >> "$LOG_FILE" 2>&1 && apt-get -y upgrade >> "$LOG_FILE" 2>&1 - apt-get install -y apache2 mariadb-server \ - php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 + ( + apt-get update >> "$LOG_FILE" 2>&1 + apt-get -y upgrade >> "$LOG_FILE" 2>&1 + apt-get install -y apache2 mariadb-server \ + php libapache2-mod-php php-intl php-mysqli php-gd \ + php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ + certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 + ) & pid=$! + spin "Installing packages" + wait $pid } # Function to check for required binaries check_required_binaries() { - log "Check packages" - show_progress "2. Check packages..." + log "Checking packages" + show_progress "2. Checking packages..." local binaries=("dpkg-reconfigure" "a2ensite" "a2dissite" "a2enmod") @@ -68,6 +87,7 @@ check_required_binaries() { fi fi done + echo -e "${GREEN}All required binaries are present.${NC}" } # Set the correct timezone @@ -79,9 +99,14 @@ set_timezone() { # Get domain name from user get_domain() { - while [[ $domain != *[.]*[.]* ]]; do + while true; do echo -ne "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}" read domain + if [[ $domain == *.*.* ]]; then + break + else + echo -e "${RED}Invalid domain. Please enter a valid Fully Qualified Domain Name.${NC}" + fi done log "Domain set to: $domain" echo -e "${GREEN}Domain set to: $domain${NC}" @@ -94,21 +119,22 @@ generate_passwords() { MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) mariadbpwd=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) cronkey=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) + echo -e "${GREEN}Passwords generated.${NC}" } - # Modify PHP configuration modify_php_ini() { log "Modifying php.ini" show_progress "6. Configuring PHP..." # Get the PHP version - PHP_VERSION=$(php -v | head -n 1 | awk '{print $2}' | cut -d '.' -f 1,2) + PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') # Set the PHP_INI_PATH PHP_INI_PATH="/etc/php/${PHP_VERSION}/apache2/php.ini" sed -i 's/^;\?upload_max_filesize =.*/upload_max_filesize = 500M/' $PHP_INI_PATH sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' $PHP_INI_PATH + echo -e "${GREEN}PHP configuration updated.${NC}" } # Setup web root directory @@ -117,17 +143,18 @@ setup_webroot() { show_progress "7. Setting up webroot..." mkdir -p /var/www/${domain} chown -R www-data:www-data /var/www/ + echo -e "${GREEN}Webroot set up at /var/www/${domain}.${NC}" } # Configure Apache setup_apache() { log "Configuring Apache" show_progress "8. Configuring Apache..." - - a2enmod md >> "$LOG_FILE" 2>&1 - a2enmod ssl >> "$LOG_FILE" 2>&1 - - apache2_conf=" + ( + a2enmod md >> "$LOG_FILE" 2>&1 + a2enmod ssl >> "$LOG_FILE" 2>&1 + + apache2_conf=" ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} @@ -135,20 +162,28 @@ setup_apache() { CustomLog \${APACHE_LOG_DIR}/access.log combined " - echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf + echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf - a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 - a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 - systemctl restart apache2 >> "$LOG_FILE" 2>&1 + a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 + a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 + systemctl restart apache2 >> "$LOG_FILE" 2>&1 - certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 + ) & pid=$! + spin "Configuring Apache" + wait $pid } # Clone ITFlow repository clone_itflow() { log "Cloning ITFlow" show_progress "9. Cloning ITFlow..." - git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 + ( + git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 + chown -R www-data:www-data /var/www/${domain} + ) & pid=$! + spin "Cloning ITFlow" + wait $pid } # Setup cron jobs @@ -179,7 +214,7 @@ setup_cronjobs() { chown root:root $CRON_FILE log "Cron jobs added to /etc/cron.d/itflow" - echo -e "${GREEN}Cron jobs added to /etc/cron.d/itflow${NC}" + echo -e "${GREEN}Cron jobs added to /etc/cron.d/itflow.${NC}" } # Generate cron key file @@ -191,6 +226,7 @@ generate_cronkey_file() { echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php chown -R www-data:www-data /var/www/ + echo -e "${GREEN}Cron key file generated.${NC}" } # Setup MariaDB @@ -205,35 +241,38 @@ setup_mariadb() { fi # Use expect to automate mysql_secure_installation + ( expect <> "$LOG_FILE" 2>&1 spawn mysql_secure_installation +expect "Enter current password for root (enter for none):" send "\r" -send "n\r" -send "y\r" +expect "Set root password? \[Y/n\]" +send "Y\r" +expect "New password:" send "$MARIADB_ROOT_PASSWORD\r" +expect "Re-enter new password:" send "$MARIADB_ROOT_PASSWORD\r" -send "y\r" -send "y\r" -send "y\r" -send "y\r" +expect "Remove anonymous users? \[Y/n\]" +send "Y\r" +expect "Disallow root login remotely? \[Y/n\]" +send "Y\r" +expect "Remove test database and access to it? \[Y/n\]" +send "Y\r" +expect "Reload privilege tables now? \[Y/n\]" +send "Y\r" expect eof EOF - # Check the previous execution - if [ $? -ne 0 ]; then - log "Error: mysql_secure_installation failed." - echo -e "${RED}Error: mysql_secure_installation failed.${NC}" - exit 1 - fi - # Create the database and itflow user mysql -u root -p"$MARIADB_ROOT_PASSWORD" -e " CREATE DATABASE IF NOT EXISTS itflow CHARACTER SET utf8; CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 + ) & pid=$! + spin "Securing MariaDB and setting up database" + wait $pid - # Check the previous execution if [ $? -ne 0 ]; then log "Error: Failed to configure MariaDB." echo -e "${RED}Error: Failed to configure MariaDB.${NC}" From 2fde0582c34ac4e2cb49735caf983b0c7d03dc52 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:42:32 -0400 Subject: [PATCH 40/55] Fix Spinner from breaking after timezone selection --- itflow_install.sh | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index ffd82c7..9d5e102 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -13,16 +13,17 @@ rm -f "$LOG_FILE" # Delete the previous log file # Spinner function spin() { - local pid=$! + local pid=$1 + local message=$2 local delay=0.1 local spinner='|/-\' - while [ -d /proc/$pid ]; do + while kill -0 $pid 2>/dev/null; do for i in $(seq 0 3); do - printf "\r${GREEN}$1 ${spinner:$i:1}${NC}" + printf "\r${GREEN}$message ${spinner:$i:1}${NC}" sleep $delay done done - printf "\r${GREEN}$1... Done! ${NC}\n" + printf "\r${GREEN}$message... Done! ${NC}\n" } # Function to log messages @@ -64,8 +65,9 @@ install_packages() { php libapache2-mod-php php-intl php-mysqli php-gd \ php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 - ) & pid=$! - spin "Installing packages" + ) & + pid=$! + spin $pid "Installing packages" wait $pid } @@ -116,9 +118,9 @@ get_domain() { generate_passwords() { log "Generating passwords" show_progress "5. Generating passwords..." - MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) - mariadbpwd=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) - cronkey=$(tr -dc 'A-Za-z0-9' < /dev/urandom | fold -w 20 | head -n 1) + MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' > "$LOG_FILE" 2>&1 certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 - ) & pid=$! - spin "Configuring Apache" + ) & + pid=$! + spin $pid "Configuring Apache" wait $pid } @@ -181,8 +184,9 @@ clone_itflow() { ( git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 chown -R www-data:www-data /var/www/${domain} - ) & pid=$! - spin "Cloning ITFlow" + ) & + pid=$! + spin $pid "Cloning ITFlow" wait $pid } @@ -246,7 +250,9 @@ setup_mariadb() { spawn mysql_secure_installation expect "Enter current password for root (enter for none):" send "\r" -expect "Set root password? \[Y/n\]" +expect "Switch to unix_socket authentication \[Y/n\]" +send "n\r" +expect "Change the root password? \[Y/n\]" send "Y\r" expect "New password:" send "$MARIADB_ROOT_PASSWORD\r" @@ -269,8 +275,9 @@ EOF CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 - ) & pid=$! - spin "Securing MariaDB and setting up database" + ) & + pid=$! + spin $pid "Securing MariaDB and setting up database" wait $pid if [ $? -ne 0 ]; then From 6dc73b26ff9e1951fa979400238cb3e981209ddc Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:45:51 -0400 Subject: [PATCH 41/55] Fix the script to not use menu method of selecting timezone as it breaks input output after --- itflow_install.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 9d5e102..8854914 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -96,7 +96,21 @@ check_required_binaries() { set_timezone() { log "Configuring timezone" show_progress "3. Configuring timezone..." - dpkg-reconfigure tzdata + + # Prompt user for timezone + echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'):${NC}" + read user_timezone + + # Validate the timezone + if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then + ln -sf "/usr/share/zoneinfo/$user_timezone" /etc/localtime + echo "$user_timezone" > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata >> "$LOG_FILE" 2>&1 + echo -e "${GREEN}Timezone set to $user_timezone.${NC}" + else + echo -e "${RED}Invalid timezone. Please make sure the timezone is correct.${NC}" + exit 1 + fi } # Get domain name from user From 444defcf42d7cd7bd16216cdbcc06ace1a1d46c2 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:49:10 -0400 Subject: [PATCH 42/55] Fix --- itflow_install.sh | 78 +++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 56 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 8854914..9c00385 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -11,21 +11,6 @@ LOG_FILE="/var/log/itflow_install.log" # Clear previous installation log rm -f "$LOG_FILE" # Delete the previous log file -# Spinner function -spin() { - local pid=$1 - local message=$2 - local delay=0.1 - local spinner='|/-\' - while kill -0 $pid 2>/dev/null; do - for i in $(seq 0 3); do - printf "\r${GREEN}$message ${spinner:$i:1}${NC}" - sleep $delay - done - done - printf "\r${GREEN}$message... Done! ${NC}\n" -} - # Function to log messages log() { echo "$(date): $1" >> "$LOG_FILE" @@ -58,17 +43,13 @@ check_os() { install_packages() { log "Installing packages" show_progress "1. Installing packages..." - ( - apt-get update >> "$LOG_FILE" 2>&1 - apt-get -y upgrade >> "$LOG_FILE" 2>&1 - apt-get install -y apache2 mariadb-server \ - php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 - ) & - pid=$! - spin $pid "Installing packages" - wait $pid + apt-get update >> "$LOG_FILE" 2>&1 + apt-get -y upgrade >> "$LOG_FILE" 2>&1 + apt-get install -y apache2 mariadb-server \ + php libapache2-mod-php php-intl php-mysqli php-gd \ + php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ + certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 + echo -e "${GREEN}Packages installed.${NC}" } # Function to check for required binaries @@ -98,8 +79,7 @@ set_timezone() { show_progress "3. Configuring timezone..." # Prompt user for timezone - echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'):${NC}" - read user_timezone + read -p "$(echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'): ${NC}")" user_timezone < /dev/tty # Validate the timezone if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then @@ -116,8 +96,7 @@ set_timezone() { # Get domain name from user get_domain() { while true; do - echo -ne "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}" - read domain + read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain < /dev/tty if [[ $domain == *.*.* ]]; then break else @@ -166,11 +145,10 @@ setup_webroot() { setup_apache() { log "Configuring Apache" show_progress "8. Configuring Apache..." - ( - a2enmod md >> "$LOG_FILE" 2>&1 - a2enmod ssl >> "$LOG_FILE" 2>&1 - - apache2_conf=" + a2enmod md >> "$LOG_FILE" 2>&1 + a2enmod ssl >> "$LOG_FILE" 2>&1 + + apache2_conf=" ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} @@ -178,30 +156,23 @@ setup_apache() { CustomLog \${APACHE_LOG_DIR}/access.log combined " - echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf + echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf - a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 - a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 - systemctl restart apache2 >> "$LOG_FILE" 2>&1 + a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 + a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 + systemctl restart apache2 >> "$LOG_FILE" 2>&1 - certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 - ) & - pid=$! - spin $pid "Configuring Apache" - wait $pid + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 + echo -e "${GREEN}Apache configured and SSL certificate obtained.${NC}" } # Clone ITFlow repository clone_itflow() { log "Cloning ITFlow" show_progress "9. Cloning ITFlow..." - ( - git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 - chown -R www-data:www-data /var/www/${domain} - ) & - pid=$! - spin $pid "Cloning ITFlow" - wait $pid + git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 + chown -R www-data:www-data /var/www/${domain} + echo -e "${GREEN}ITFlow cloned to /var/www/${domain}.${NC}" } # Setup cron jobs @@ -259,7 +230,6 @@ setup_mariadb() { fi # Use expect to automate mysql_secure_installation - ( expect <> "$LOG_FILE" 2>&1 spawn mysql_secure_installation expect "Enter current password for root (enter for none):" @@ -289,10 +259,6 @@ EOF CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 - ) & - pid=$! - spin $pid "Securing MariaDB and setting up database" - wait $pid if [ $? -ne 0 ]; then log "Error: Failed to configure MariaDB." From eed1d5049a44b6075d89e75dccb3ba2ce6dfd052 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:53:15 -0400 Subject: [PATCH 43/55] Fix2 --- itflow_install.sh | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 9c00385..0fd010c 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. # Colors for terminal output RED='\033[0;31m' @@ -43,6 +44,7 @@ check_os() { install_packages() { log "Installing packages" show_progress "1. Installing packages..." + export DEBIAN_FRONTEND=noninteractive apt-get update >> "$LOG_FILE" 2>&1 apt-get -y upgrade >> "$LOG_FILE" 2>&1 apt-get install -y apache2 mariadb-server \ @@ -52,40 +54,18 @@ install_packages() { echo -e "${GREEN}Packages installed.${NC}" } -# Function to check for required binaries -check_required_binaries() { - log "Checking packages" - show_progress "2. Checking packages..." - - local binaries=("dpkg-reconfigure" "a2ensite" "a2dissite" "a2enmod") - - for bin in "${binaries[@]}"; do - if ! command -v $bin &> /dev/null; then - if [ -x "/usr/sbin/$bin" ]; then - export PATH="$PATH:/usr/sbin" - else - log "Error: $bin not found in PATH or /usr/sbin" - echo -e "${RED}Error: $bin not found. Please make sure it is installed and in your PATH or in /usr/sbin.${NC}" - exit 1 - fi - fi - done - echo -e "${GREEN}All required binaries are present.${NC}" -} - # Set the correct timezone set_timezone() { log "Configuring timezone" show_progress "3. Configuring timezone..." # Prompt user for timezone - read -p "$(echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'): ${NC}")" user_timezone < /dev/tty + read -p "$(echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'): ${NC}")" user_timezone # Validate the timezone if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then ln -sf "/usr/share/zoneinfo/$user_timezone" /etc/localtime echo "$user_timezone" > /etc/timezone - dpkg-reconfigure -f noninteractive tzdata >> "$LOG_FILE" 2>&1 echo -e "${GREEN}Timezone set to $user_timezone.${NC}" else echo -e "${RED}Invalid timezone. Please make sure the timezone is correct.${NC}" @@ -96,7 +76,7 @@ set_timezone() { # Get domain name from user get_domain() { while true; do - read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain < /dev/tty + read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain if [[ $domain == *.*.* ]]; then break else From feeec8ae33d379d4c3644379964affa86b021a87 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 15:55:50 -0400 Subject: [PATCH 44/55] Fix3 --- itflow_install.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/itflow_install.sh b/itflow_install.sh index 0fd010c..c3821f7 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -54,6 +54,27 @@ install_packages() { echo -e "${GREEN}Packages installed.${NC}" } +# Function to check for required binaries +check_required_binaries() { + log "Checking packages" + show_progress "2. Checking packages..." + + local binaries=("dpkg-reconfigure" "a2ensite" "a2dissite" "a2enmod") + + for bin in "${binaries[@]}"; do + if ! command -v $bin &> /dev/null; then + if [ -x "/usr/sbin/$bin" ]; then + export PATH="$PATH:/usr/sbin" + else + log "Error: $bin not found in PATH or /usr/sbin" + echo -e "${RED}Error: $bin not found. Please make sure it is installed and in your PATH or in /usr/sbin.${NC}" + exit 1 + fi + fi + done + echo -e "${GREEN}All required binaries are present.${NC}" +} + # Set the correct timezone set_timezone() { log "Configuring timezone" From 9c002480eb19a62c04c1044db44e8d8a998c69a1 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 16:33:41 -0400 Subject: [PATCH 45/55] Set Root Password, remove colors from spinner --- itflow_install.sh | 151 +++++++++++++++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 49 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index c3821f7..789c75d 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -e # Exit immediately if a command exits with a non-zero status. # Colors for terminal output RED='\033[0;31m' @@ -12,6 +11,21 @@ LOG_FILE="/var/log/itflow_install.log" # Clear previous installation log rm -f "$LOG_FILE" # Delete the previous log file +# Spinner function +spin() { + local pid=$! + local delay=0.1 + local spinner='|/-\' + local message=$1 + while kill -0 $pid 2>/dev/null; do + for i in $(seq 0 3); do + printf "\r$message ${spinner:$i:1}" + sleep $delay + done + done + printf "\r$message... Done! \n" +} + # Function to log messages log() { echo "$(date): $1" >> "$LOG_FILE" @@ -33,9 +47,9 @@ check_root() { # Check if the OS is supported check_os() { - if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then - log "Error: This script only supports Ubuntu 24.04 or Debian 12." - echo -e "${RED}Error: This script only supports Ubuntu 22.04 and 24.04 or Debian 12.${NC}" + if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then + log "Error: This script only supports Ubuntu 22.04, 24.04 or Debian 12." + echo -e "${RED}Error: This script only supports Ubuntu 22.04, 24.04 or Debian 12.${NC}" exit 1 fi } @@ -44,14 +58,15 @@ check_os() { install_packages() { log "Installing packages" show_progress "1. Installing packages..." - export DEBIAN_FRONTEND=noninteractive - apt-get update >> "$LOG_FILE" 2>&1 - apt-get -y upgrade >> "$LOG_FILE" 2>&1 - apt-get install -y apache2 mariadb-server \ - php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ - certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 - echo -e "${GREEN}Packages installed.${NC}" + { + export DEBIAN_FRONTEND=noninteractive + apt-get update >> "$LOG_FILE" 2>&1 + apt-get -y upgrade >> "$LOG_FILE" 2>&1 + apt-get install -y apache2 mariadb-server \ + php libapache2-mod-php php-intl php-mysqli php-gd \ + php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ + certbot python3-certbot-apache git sudo whois cron dnsutils expect >> "$LOG_FILE" 2>&1 + } & spin "Installing packages" } # Function to check for required binaries @@ -80,32 +95,64 @@ set_timezone() { log "Configuring timezone" show_progress "3. Configuring timezone..." - # Prompt user for timezone - read -p "$(echo -e "${YELLOW}Please enter your timezone (e.g., 'America/New_York'): ${NC}")" user_timezone + # Get the current timezone + current_timezone=$(cat /etc/timezone 2>/dev/null || echo "UTC") - # Validate the timezone - if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then - ln -sf "/usr/share/zoneinfo/$user_timezone" /etc/localtime - echo "$user_timezone" > /etc/timezone - echo -e "${GREEN}Timezone set to $user_timezone.${NC}" - else - echo -e "${RED}Invalid timezone. Please make sure the timezone is correct.${NC}" - exit 1 - fi + while true; do + # Prompt user for timezone + read -p "$(echo -e "${YELLOW}Current timezone is '${current_timezone}'. Press Enter to keep it or enter a new timezone: ${NC}")" user_timezone + + # If user presses Enter, keep the current timezone + if [ -z "$user_timezone" ]; then + echo -e "${GREEN}Timezone remains set to $current_timezone.${NC}" + user_timezone=$current_timezone + break + fi + + # Validate the timezone + if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then + ln -sf "/usr/share/zoneinfo/$user_timezone" /etc/localtime + echo "$user_timezone" > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata >> "$LOG_FILE" 2>&1 + echo -e "${GREEN}Timezone set to $user_timezone.${NC}" + break + else + echo -e "${RED}Invalid timezone. Please enter a valid timezone from the list below.${NC}" + timedatectl list-timezones + fi + done } # Get domain name from user get_domain() { + # Detect the system's current FQDN + current_fqdn=$(hostname -f 2>/dev/null || echo "") + while true; do - read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain - if [[ $domain == *.*.* ]]; then + if [ -n "$current_fqdn" ]; then + read -p "$(echo -e "${YELLOW}Current FQDN is '${current_fqdn}'. Press Enter to use it or enter a new domain: ${NC}")" new_domain + # If user presses Enter, keep the current FQDN + if [ -z "$new_domain" ]; then + domain=$current_fqdn + echo -e "${GREEN}Domain set to: $domain${NC}" + break + else + domain=$new_domain + fi + else + read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain + fi + + # Validate the domain + if [[ $domain =~ ^([a-zA-Z0-9](-?[a-zA-Z0-9])*\.)+[a-zA-Z]{2,}$ ]]; then + log "Domain set to: $domain" + echo -e "${GREEN}Domain set to: $domain${NC}" break else echo -e "${RED}Invalid domain. Please enter a valid Fully Qualified Domain Name.${NC}" + current_fqdn="" fi done - log "Domain set to: $domain" - echo -e "${GREEN}Domain set to: $domain${NC}" } # Generate random passwords @@ -146,24 +193,26 @@ setup_webroot() { setup_apache() { log "Configuring Apache" show_progress "8. Configuring Apache..." - a2enmod md >> "$LOG_FILE" 2>&1 - a2enmod ssl >> "$LOG_FILE" 2>&1 - - apache2_conf=" - ServerAdmin webmaster@localhost - ServerName ${domain} - DocumentRoot /var/www/${domain} - ErrorLog \${APACHE_LOG_DIR}/error.log - CustomLog \${APACHE_LOG_DIR}/access.log combined -" - - echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf - - a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 - a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 - systemctl restart apache2 >> "$LOG_FILE" 2>&1 - - certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 + { + a2enmod md >> "$LOG_FILE" 2>&1 + a2enmod ssl >> "$LOG_FILE" 2>&1 + + apache2_conf=" + ServerAdmin webmaster@localhost + ServerName ${domain} + DocumentRoot /var/www/${domain} + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + " + + echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf + + a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 + a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 + systemctl restart apache2 >> "$LOG_FILE" 2>&1 + + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 + } & spin "Configuring Apache and obtaining SSL certificate" echo -e "${GREEN}Apache configured and SSL certificate obtained.${NC}" } @@ -171,8 +220,10 @@ setup_apache() { clone_itflow() { log "Cloning ITFlow" show_progress "9. Cloning ITFlow..." - git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 - chown -R www-data:www-data /var/www/${domain} + { + git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 + chown -R www-data:www-data /var/www/${domain} + } & spin "Cloning ITFlow repository" echo -e "${GREEN}ITFlow cloned to /var/www/${domain}.${NC}" } @@ -231,6 +282,7 @@ setup_mariadb() { fi # Use expect to automate mysql_secure_installation + { expect <> "$LOG_FILE" 2>&1 spawn mysql_secure_installation expect "Enter current password for root (enter for none):" @@ -256,10 +308,11 @@ EOF # Create the database and itflow user mysql -u root -p"$MARIADB_ROOT_PASSWORD" -e " - CREATE DATABASE IF NOT EXISTS itflow CHARACTER SET utf8; + CREATE DATABASE IF NOT EXISTS itflow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 + } & spin "Securing MariaDB and setting up database" if [ $? -ne 0 ]; then log "Error: Failed to configure MariaDB." @@ -309,6 +362,6 @@ echo -e "Database User: ${GREEN}itflow${NC}" echo -e "Database Name: ${GREEN}itflow${NC}" echo -e "Database Password: ${GREEN}${mariadbpwd}${NC}" echo -echo -e "Database ROOT Password: ${GREEN}${MARIADB_ROOT_PASSWORD}${NC}" +echo -e "MariaDB ROOT Password: ${GREEN}${MARIADB_ROOT_PASSWORD}${NC}" echo echo -e "A detailed log file is available at: ${GREEN}$LOG_FILE${NC}" From 26f17442f33a42f95624810a59f4ca3c1f9f5549 Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:00:29 +0000 Subject: [PATCH 46/55] Update README.md Add banner --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5194fa..11a569b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ -Install Script to install ITFlow + +
+ +

ITFlow

+ +

+ IT documentation, ticketing and accounting system for small MSPs. +
+
+ View demo +
+ Username: demo@demo | Password: demo +
+
+ About + · + Docs + · + Forum + · + Report Bug + · + Request Feature + · + Security +

+
+ +-- + +# Install Script to install ITFlow - Run the script as root From 74453638bf5b75fc58db8262deffbcab3daf3eff Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 25 Jan 2025 21:26:52 -0500 Subject: [PATCH 47/55] Update install script to use the new cron scripts that dont require a cronkey --- itflow_install.sh | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 789c75d..b8c54a4 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -161,7 +161,6 @@ generate_passwords() { show_progress "5. Generating passwords..." MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' $CRON_FILE - echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron_ticket_email_parser.php ${cronkey}" >> $CRON_FILE - echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron_mail_queue.php ${cronkey}" >> $CRON_FILE + echo "0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron.php" > $CRON_FILE + echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_ticket_email_parser.php" >> $CRON_FILE + echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_mail_queue.php" >> $CRON_FILE + echo "0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_domain_refresher.php" >> $CRON_FILE + echo "0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_certificate_refresher.php" >> $CRON_FILE # Ensure the cron file has the correct permissions chmod 644 $CRON_FILE @@ -258,22 +259,10 @@ setup_cronjobs() { echo -e "${GREEN}Cron jobs added to /etc/cron.d/itflow.${NC}" } -# Generate cron key file -generate_cronkey_file() { - log "Generating cron key file" - show_progress "11. Generating cron key file..." - mkdir -p /var/www/${domain}/uploads/tmp - echo " /var/www/${domain}/uploads/tmp/cronkey.php - echo "\$itflow_install_script_generated_cronkey = \"${cronkey}\";" >> /var/www/${domain}/uploads/tmp/cronkey.php - echo "?>" >> /var/www/${domain}/uploads/tmp/cronkey.php - chown -R www-data:www-data /var/www/ - echo -e "${GREEN}Cron key file generated.${NC}" -} - # Setup MariaDB setup_mariadb() { log "MariaDB installation" - show_progress "12. MariaDB installation..." + show_progress "11. MariaDB installation..." if ! dpkg -l | grep -q mariadb-server || ! systemctl is-active --quiet mariadb; then log "Error: MariaDB is not installed or not running." @@ -346,7 +335,6 @@ setup_webroot setup_apache clone_itflow setup_cronjobs -generate_cronkey_file setup_mariadb # Final message with instructions From 1f30f880393799a34e4bbacee93e3bb0bbdb4d38 Mon Sep 17 00:00:00 2001 From: wrongecho <32306651+wrongecho@users.noreply.github.com> Date: Sun, 26 Jan 2025 22:20:21 +0000 Subject: [PATCH 48/55] Create cron.d-itflow example manual cron configuration --- cron.d-itflow | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cron.d-itflow diff --git a/cron.d-itflow b/cron.d-itflow new file mode 100644 index 0000000..7f3e754 --- /dev/null +++ b/cron.d-itflow @@ -0,0 +1,10 @@ +# ITFlow Nightly 2 AM cron +0 2 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron.php 2>&1 | logger -t itflow-nightlycron + +# ITFlow Emails +* * * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_mail_queue.php 2>&1 | logger -t itflow-smtp +* * * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_ticket_email_parser.php 2>&1 | logger -t itflow-imap + +# ITFlow data refresh +0 3 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_domain_refresher.php 2>&1 | logger -t itflow-domains +0 4 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_certificate_refresher.php 2>&1 | logger -t itflow-certs From 67d1d654a4e71c3fb268f6507881e9d5010ad75d Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 6 May 2025 14:52:42 -0400 Subject: [PATCH 49/55] Rewrite the itflow_install.sh to allow for unattended automated install, Allow to select branch, automated the mysql config process and database import added SSL Options none for proxy and Self Signed SSL options, no need to to run mysql_secure_install, add switches and --help --- itflow_install.sh | 584 +++++++++++++++++++++------------------------- 1 file changed, 266 insertions(+), 318 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index b8c54a4..271b8d9 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -1,21 +1,20 @@ #!/bin/bash -# Colors for terminal output +# Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' -NC='\033[0m' # No Color +NC='\033[0m' -# Log file path +# Log LOG_FILE="/var/log/itflow_install.log" -# Clear previous installation log -rm -f "$LOG_FILE" # Delete the previous log file +rm -f "$LOG_FILE" -# Spinner function +# Spinner spin() { local pid=$! local delay=0.1 - local spinner='|/-\' + local spinner='|/-\\' local message=$1 while kill -0 $pid 2>/dev/null; do for i in $(seq 0 3); do @@ -26,330 +25,279 @@ spin() { printf "\r$message... Done! \n" } -# Function to log messages log() { echo "$(date): $1" >> "$LOG_FILE" } -# Function to show progress messages show_progress() { echo -e "${GREEN}$1${NC}" } -# Check if the user is root -check_root() { - if [[ $EUID -ne 0 ]]; then - log "Error: This script must be run as root." - echo -e "${RED}Error: This script must be run as root.${NC}" - exit 1 - fi -} - -# Check if the OS is supported -check_os() { - if ! grep -E "22.04|24.04|12" "/etc/"*"release" &>/dev/null; then - log "Error: This script only supports Ubuntu 22.04, 24.04 or Debian 12." - echo -e "${RED}Error: This script only supports Ubuntu 22.04, 24.04 or Debian 12.${NC}" - exit 1 - fi -} - -# Function to install required packages -install_packages() { - log "Installing packages" - show_progress "1. Installing packages..." - { - export DEBIAN_FRONTEND=noninteractive - apt-get update >> "$LOG_FILE" 2>&1 - apt-get -y upgrade >> "$LOG_FILE" 2>&1 - apt-get install -y apache2 mariadb-server \ +# Check root +if [[ $EUID -ne 0 ]]; then + echo -e "${RED}Run as root.${NC}" + exit 1 +fi + +# CLI Args +fi + +unattended=false +while [[ $# -gt 0 ]]; do + case $1 in + -d|--domain) + domain="$2" + shift 2 + ;; + -t|--timezone) + timezone="$2" + shift 2 + ;; + -b|--branch) + branch="$2" + shift 2 + ;; + -s|--ssl) + ssl_type="$2" + shift 2 + ;; + -u|--unattended) + unattended=true + shift + ;; + -h|--help) + echo -e " +Usage: $0 [options]" + echo " -d, --domain DOMAIN Set the domain name (FQDN)" + echo " -t, --timezone ZONE Set the system timezone (e.g., America/New_York)" + echo " -b, --branch BRANCH Git branch to use: master (default) or develop" + echo " -s, --ssl TYPE SSL type: letsencrypt, selfsigned, none" + echo " -u, --unattended Run in fully automated mode (no prompts)" + echo " -h, --help Show this help message" + exit 0 + ;; + *) + echo -e "${RED}Unknown option $1${NC}" + exit 1 + ;; + esac + case $1 in + --domain) + domain="$2" + shift 2 + ;; + --timezone) + timezone="$2" + shift 2 + ;; + --branch) + branch="$2" + shift 2 + ;; + --ssl) + ssl_type="$2" + shift 2 + ;; + --unattended) + unattended=true + shift + ;; + *) + echo -e "${RED}Unknown option $1${NC}" + exit 1 + ;; + esac +done + +# Get timezone +if [ "$unattended" = true ]; then + timezone=${timezone:-"America/New_York"} +else + timezone=${timezone:-$(cat /etc/timezone 2>/dev/null || echo "UTC")} + read -p "Timezone [${timezone}]: " input_tz + timezone=${input_tz:-$timezone} +fi + +if [ -f "/usr/share/zoneinfo/$timezone" ]; then + timedatectl set-timezone "$timezone" +else + echo -e "${RED}Invalid timezone.${NC}" + exit 1 +fi + +# Get domain +current_fqdn=$(hostname -f 2>/dev/null || echo "") +domain=${domain:-$current_fqdn} +if [ "$unattended" != true ]; then + read -p "Domain [${domain}]: " input_domain + domain=${input_domain:-$domain} +fi +if ! [[ $domain =~ ^([a-zA-Z0-9](-?[a-zA-Z0-9])*\.)+[a-zA-Z]{2,}$ ]]; then + echo -e "${RED}Invalid domain.${NC}" + exit 1 +fi + +# Select branch +branch=${branch:-master} +if [ "$fully_auto" != true ]; then + echo -e "Available branches: master (stable), develop (development)" + read -p "Which branch to use [\${branch:-master} - default is 'master' for stable releases]: " input_branch + branch=${input_branch:-${branch:-master}} +fi +if [[ "$branch" != "master" && "$branch" != "develop" ]]; then + echo -e "${RED}Invalid branch. Choose 'master' or 'develop'.${NC}" + exit 1 +fi + +# Select SSL type +ssl_type=${ssl_type:-letsencrypt} +if [ "$fully_auto" != true ]; then + echo -e "SSL options: letsencrypt, selfsigned, none (use 'none' if behind a proxy with SSL)" + read -p "Choose SSL type [${ssl_type:-letsencrypt}]: " input_ssl + ssl_type=${input_ssl:-${ssl_type:-letsencrypt}} +fi +if [[ "$ssl_type" != "letsencrypt" && "$ssl_type" != "selfsigned" && "$ssl_type" != "none" ]]; then + echo -e "${RED}Invalid SSL option. Choose 'letsencrypt', 'selfsigned', or 'none'.${NC}" + exit 1 +fi + +# Set HTTPS config flag +if [[ "$ssl_type" == "none" ]]; then + config_https_only="FALSE" +else + config_https_only="TRUE" +fi + +# Passwords +MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' > "$LOG_FILE" 2>&1 - } & spin "Installing packages" -} - -# Function to check for required binaries -check_required_binaries() { - log "Checking packages" - show_progress "2. Checking packages..." - - local binaries=("dpkg-reconfigure" "a2ensite" "a2dissite" "a2enmod") - - for bin in "${binaries[@]}"; do - if ! command -v $bin &> /dev/null; then - if [ -x "/usr/sbin/$bin" ]; then - export PATH="$PATH:/usr/sbin" - else - log "Error: $bin not found in PATH or /usr/sbin" - echo -e "${RED}Error: $bin not found. Please make sure it is installed and in your PATH or in /usr/sbin.${NC}" - exit 1 - fi - fi - done - echo -e "${GREEN}All required binaries are present.${NC}" -} - -# Set the correct timezone -set_timezone() { - log "Configuring timezone" - show_progress "3. Configuring timezone..." - - # Get the current timezone - current_timezone=$(cat /etc/timezone 2>/dev/null || echo "UTC") - - while true; do - # Prompt user for timezone - read -p "$(echo -e "${YELLOW}Current timezone is '${current_timezone}'. Press Enter to keep it or enter a new timezone: ${NC}")" user_timezone - - # If user presses Enter, keep the current timezone - if [ -z "$user_timezone" ]; then - echo -e "${GREEN}Timezone remains set to $current_timezone.${NC}" - user_timezone=$current_timezone - break - fi - - # Validate the timezone - if [ -f "/usr/share/zoneinfo/$user_timezone" ]; then - ln -sf "/usr/share/zoneinfo/$user_timezone" /etc/localtime - echo "$user_timezone" > /etc/timezone - dpkg-reconfigure -f noninteractive tzdata >> "$LOG_FILE" 2>&1 - echo -e "${GREEN}Timezone set to $user_timezone.${NC}" - break - else - echo -e "${RED}Invalid timezone. Please enter a valid timezone from the list below.${NC}" - timedatectl list-timezones - fi - done -} - -# Get domain name from user -get_domain() { - # Detect the system's current FQDN - current_fqdn=$(hostname -f 2>/dev/null || echo "") - - while true; do - if [ -n "$current_fqdn" ]; then - read -p "$(echo -e "${YELLOW}Current FQDN is '${current_fqdn}'. Press Enter to use it or enter a new domain: ${NC}")" new_domain - # If user presses Enter, keep the current FQDN - if [ -z "$new_domain" ]; then - domain=$current_fqdn - echo -e "${GREEN}Domain set to: $domain${NC}" - break - else - domain=$new_domain - fi - else - read -p "$(echo -e "${YELLOW}4. Enter your Fully Qualified Domain Name (e.g., itflow.domain.com): ${NC}")" domain - fi - - # Validate the domain - if [[ $domain =~ ^([a-zA-Z0-9](-?[a-zA-Z0-9])*\.)+[a-zA-Z]{2,}$ ]]; then - log "Domain set to: $domain" - echo -e "${GREEN}Domain set to: $domain${NC}" - break - else - echo -e "${RED}Invalid domain. Please enter a valid Fully Qualified Domain Name.${NC}" - current_fqdn="" - fi - done -} - -# Generate random passwords -generate_passwords() { - log "Generating passwords" - show_progress "5. Generating passwords..." - MARIADB_ROOT_PASSWORD=$(tr -dc 'A-Za-z0-9' > "$LOG_FILE" 2>&1 - a2enmod ssl >> "$LOG_FILE" 2>&1 - - apache2_conf=" - ServerAdmin webmaster@localhost - ServerName ${domain} - DocumentRoot /var/www/${domain} - ErrorLog \${APACHE_LOG_DIR}/error.log - CustomLog \${APACHE_LOG_DIR}/access.log combined - " - - echo "${apache2_conf}" > /etc/apache2/sites-available/${domain}.conf - - a2ensite ${domain}.conf >> "$LOG_FILE" 2>&1 - a2dissite 000-default.conf >> "$LOG_FILE" 2>&1 - systemctl restart apache2 >> "$LOG_FILE" 2>&1 - - certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} >> "$LOG_FILE" 2>&1 - } & spin "Configuring Apache and obtaining SSL certificate" - echo -e "${GREEN}Apache configured and SSL certificate obtained.${NC}" -} - -# Clone ITFlow repository -clone_itflow() { - log "Cloning ITFlow" - show_progress "9. Cloning ITFlow..." - { - git clone https://github.com/itflow-org/itflow.git /var/www/${domain} >> "$LOG_FILE" 2>&1 - chown -R www-data:www-data /var/www/${domain} - } & spin "Cloning ITFlow repository" - echo -e "${GREEN}ITFlow cloned to /var/www/${domain}.${NC}" -} - -# Setup cron jobs -setup_cronjobs() { - log "Setting up cron jobs" - show_progress "10. Setting up cron jobs..." - - CRON_FILE="/etc/cron.d/itflow" - - # Find the PHP binary - PHP_BIN=$(command -v php) - - if [ -z "$PHP_BIN" ]; then - log "PHP binary not found!" - echo -e "${RED}PHP binary not found!${NC}" - exit 1 - fi - - # Write the cron entries into the file - echo "0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron.php" > $CRON_FILE - echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_ticket_email_parser.php" >> $CRON_FILE - echo "* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_mail_queue.php" >> $CRON_FILE - echo "0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_domain_refresher.php" >> $CRON_FILE - echo "0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_certificate_refresher.php" >> $CRON_FILE - - # Ensure the cron file has the correct permissions - chmod 644 $CRON_FILE - - # Set ownership to root - chown root:root $CRON_FILE - - log "Cron jobs added to /etc/cron.d/itflow" - echo -e "${GREEN}Cron jobs added to /etc/cron.d/itflow.${NC}" -} - -# Setup MariaDB -setup_mariadb() { - log "MariaDB installation" - show_progress "11. MariaDB installation..." - - if ! dpkg -l | grep -q mariadb-server || ! systemctl is-active --quiet mariadb; then - log "Error: MariaDB is not installed or not running." - echo -e "${RED}Error: MariaDB is not installed or not running.${NC}" - exit 1 + certbot python3-certbot-apache git sudo whois cron dnsutils openssl +} & spin "Installing packages" + +# PHP config +PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') +PHP_INI_PATH="/etc/php/${PHP_VERSION}/apache2/php.ini" +sed -i 's/^;\?upload_max_filesize =.*/upload_max_filesize = 500M/' "$PHP_INI_PATH" +sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' "$PHP_INI_PATH" +sed -i 's/^;\?max_execution_time =.*/max_execution_time = 300/' "$PHP_INI_PATH" + +# Web root +mkdir -p /var/www/${domain} + +# Apache +show_progress "Configuring Apache..." +{ + a2enmod md ssl rewrite + if [[ "$ssl_type" != "none" ]]; then + redirect="Redirect permanent / https://${domain}/" + else + redirect="# No HTTPS redirection" fi - # Use expect to automate mysql_secure_installation - { - expect <> "$LOG_FILE" 2>&1 -spawn mysql_secure_installation -expect "Enter current password for root (enter for none):" -send "\r" -expect "Switch to unix_socket authentication \[Y/n\]" -send "n\r" -expect "Change the root password? \[Y/n\]" -send "Y\r" -expect "New password:" -send "$MARIADB_ROOT_PASSWORD\r" -expect "Re-enter new password:" -send "$MARIADB_ROOT_PASSWORD\r" -expect "Remove anonymous users? \[Y/n\]" -send "Y\r" -expect "Disallow root login remotely? \[Y/n\]" -send "Y\r" -expect "Remove test database and access to it? \[Y/n\]" -send "Y\r" -expect "Reload privilege tables now? \[Y/n\]" -send "Y\r" -expect eof + cat < /etc/apache2/sites-available/${domain}.conf + + ServerAdmin webmaster@localhost + ServerName ${domain} + DocumentRoot /var/www/${domain} + ${redirect} + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + EOF - # Create the database and itflow user - mysql -u root -p"$MARIADB_ROOT_PASSWORD" -e " - CREATE DATABASE IF NOT EXISTS itflow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - CREATE USER IF NOT EXISTS 'itflow'@'localhost' IDENTIFIED BY '${mariadbpwd}'; - GRANT ALL PRIVILEGES ON itflow.* TO 'itflow'@'localhost'; - FLUSH PRIVILEGES;" >> "$LOG_FILE" 2>&1 - } & spin "Securing MariaDB and setting up database" - - if [ $? -ne 0 ]; then - log "Error: Failed to configure MariaDB." - echo -e "${RED}Error: Failed to configure MariaDB.${NC}" - exit 1 + a2ensite ${domain}.conf + a2dissite 000-default.conf + systemctl restart apache2 + + if [[ "$ssl_type" == "letsencrypt" ]]; then + certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} + elif [[ "$ssl_type" == "selfsigned" ]]; then + openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ + -keyout /etc/ssl/private/${domain}.key \ + -out /etc/ssl/certs/${domain}.crt \ + -subj "/C=US/ST=State/L=City/O=Org/OU=IT/CN=${domain}" + + cat < /etc/apache2/sites-available/${domain}-ssl.conf + + ServerAdmin webmaster@localhost + ServerName ${domain} + DocumentRoot /var/www/${domain} + + SSLEngine on + SSLCertificateFile /etc/ssl/certs/${domain}.crt + SSLCertificateKeyFile /etc/ssl/private/${domain}.key + + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + +EOFSSL + + a2ensite ${domain}-ssl.conf + systemctl restart apache2 + else + echo -e "${YELLOW}No SSL will be configured. HTTPS will not be available.${NC}" fi +} & spin "Apache setup and SSL" + +# Git clone +show_progress "Cloning ITFlow..." +{ + git clone --branch ${branch} https://github.com/itflow-org/itflow.git /var/www/${domain} + chown -R www-data:www-data /var/www/${domain} +} & spin "Cloning ITFlow" + +# Cron jobs +PHP_BIN=$(command -v php) +cat < /etc/cron.d/itflow +0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron.php +* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_ticket_email_parser.php +* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_mail_queue.php +0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_domain_refresher.php +0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_certificate_refresher.php +EOF +chmod 644 /etc/cron.d/itflow +chown root:root /etc/cron.d/itflow + +# MariaDB +show_progress "Configuring MariaDB..." +{ + until mysqladmin ping --silent; do sleep 1; done + mysql -u root < /var/www/${domain}/config.php + Date: Tue, 6 May 2025 15:34:07 -0400 Subject: [PATCH 50/55] Fixes --- itflow_install.sh | 90 +++++++++++++++-------------------------------- 1 file changed, 28 insertions(+), 62 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 271b8d9..3cd2cd7 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -40,8 +40,6 @@ if [[ $EUID -ne 0 ]]; then fi # CLI Args -fi - unattended=false while [[ $# -gt 0 ]]; do case $1 in @@ -66,13 +64,12 @@ while [[ $# -gt 0 ]]; do shift ;; -h|--help) - echo -e " -Usage: $0 [options]" + echo -e "\nUsage: $0 [options]" echo " -d, --domain DOMAIN Set the domain name (FQDN)" - echo " -t, --timezone ZONE Set the system timezone (e.g., America/New_York)" - echo " -b, --branch BRANCH Git branch to use: master (default) or develop" + echo " -t, --timezone ZONE Set the system timezone" + echo " -b, --branch BRANCH Git branch to use: master or develop" echo " -s, --ssl TYPE SSL type: letsencrypt, selfsigned, none" - echo " -u, --unattended Run in fully automated mode (no prompts)" + echo " -u, --unattended Run in fully automated mode" echo " -h, --help Show this help message" exit 0 ;; @@ -81,35 +78,9 @@ Usage: $0 [options]" exit 1 ;; esac - case $1 in - --domain) - domain="$2" - shift 2 - ;; - --timezone) - timezone="$2" - shift 2 - ;; - --branch) - branch="$2" - shift 2 - ;; - --ssl) - ssl_type="$2" - shift 2 - ;; - --unattended) - unattended=true - shift - ;; - *) - echo -e "${RED}Unknown option $1${NC}" - exit 1 - ;; - esac done -# Get timezone +# Timezone if [ "$unattended" = true ]; then timezone=${timezone:-"America/New_York"} else @@ -125,7 +96,7 @@ else exit 1 fi -# Get domain +# Domain current_fqdn=$(hostname -f 2>/dev/null || echo "") domain=${domain:-$current_fqdn} if [ "$unattended" != true ]; then @@ -137,35 +108,34 @@ if ! [[ $domain =~ ^([a-zA-Z0-9](-?[a-zA-Z0-9])*\.)+[a-zA-Z]{2,}$ ]]; then exit 1 fi -# Select branch +# Branch branch=${branch:-master} -if [ "$fully_auto" != true ]; then - echo -e "Available branches: master (stable), develop (development)" - read -p "Which branch to use [\${branch:-master} - default is 'master' for stable releases]: " input_branch - branch=${input_branch:-${branch:-master}} +if [ "$unattended" != true ]; then + echo -e "Available branches: master, develop" + read -p "Which branch to use [${branch}]: " input_branch + branch=${input_branch:-$branch} fi if [[ "$branch" != "master" && "$branch" != "develop" ]]; then - echo -e "${RED}Invalid branch. Choose 'master' or 'develop'.${NC}" + echo -e "${RED}Invalid branch.${NC}" exit 1 fi -# Select SSL type +# SSL ssl_type=${ssl_type:-letsencrypt} -if [ "$fully_auto" != true ]; then - echo -e "SSL options: letsencrypt, selfsigned, none (use 'none' if behind a proxy with SSL)" - read -p "Choose SSL type [${ssl_type:-letsencrypt}]: " input_ssl - ssl_type=${input_ssl:-${ssl_type:-letsencrypt}} +if [ "$unattended" != true ]; then + echo -e "SSL options: letsencrypt, selfsigned, none" + read -p "SSL type [${ssl_type}]: " input_ssl + ssl_type=${input_ssl:-$ssl_type} fi if [[ "$ssl_type" != "letsencrypt" && "$ssl_type" != "selfsigned" && "$ssl_type" != "none" ]]; then - echo -e "${RED}Invalid SSL option. Choose 'letsencrypt', 'selfsigned', or 'none'.${NC}" + echo -e "${RED}Invalid SSL option.${NC}" exit 1 fi -# Set HTTPS config flag +# HTTPS config flag +config_https_only="TRUE" if [[ "$ssl_type" == "none" ]]; then config_https_only="FALSE" -else - config_https_only="TRUE" fi # Passwords @@ -190,25 +160,23 @@ sed -i 's/^;\?upload_max_filesize =.*/upload_max_filesize = 500M/' "$PHP_INI_PAT sed -i 's/^;\?post_max_size =.*/post_max_size = 500M/' "$PHP_INI_PATH" sed -i 's/^;\?max_execution_time =.*/max_execution_time = 300/' "$PHP_INI_PATH" -# Web root -mkdir -p /var/www/${domain} - -# Apache +# Apache setup show_progress "Configuring Apache..." { a2enmod md ssl rewrite + mkdir -p /var/www/${domain} + if [[ "$ssl_type" != "none" ]]; then - redirect="Redirect permanent / https://${domain}/" + http_redirect="Redirect permanent / https://${domain}/" else - redirect="# No HTTPS redirection" + http_redirect="# No HTTPS redirection" fi cat < /etc/apache2/sites-available/${domain}.conf - ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} - ${redirect} + ${http_redirect} ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined @@ -216,7 +184,7 @@ EOF a2ensite ${domain}.conf a2dissite 000-default.conf - systemctl restart apache2 + systemctl reload apache2 if [[ "$ssl_type" == "letsencrypt" ]]; then certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --domains ${domain} @@ -228,7 +196,6 @@ EOF cat < /etc/apache2/sites-available/${domain}-ssl.conf - ServerAdmin webmaster@localhost ServerName ${domain} DocumentRoot /var/www/${domain} @@ -240,9 +207,8 @@ EOF CustomLog \${APACHE_LOG_DIR}/access.log combined EOFSSL - a2ensite ${domain}-ssl.conf - systemctl restart apache2 + systemctl reload apache2 else echo -e "${YELLOW}No SSL will be configured. HTTPS will not be available.${NC}" fi From ecd22d9954e98e8babc8d491bf7aedcafcdc690a Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 6 May 2025 15:41:10 -0400 Subject: [PATCH 51/55] Get rid of the HTTPS Redirect in apache causing infinite loops --- itflow_install.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3cd2cd7..b522ae0 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -166,17 +166,10 @@ show_progress "Configuring Apache..." a2enmod md ssl rewrite mkdir -p /var/www/${domain} - if [[ "$ssl_type" != "none" ]]; then - http_redirect="Redirect permanent / https://${domain}/" - else - http_redirect="# No HTTPS redirection" - fi - cat < /etc/apache2/sites-available/${domain}.conf ServerName ${domain} DocumentRoot /var/www/${domain} - ${http_redirect} ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined From bfdfe7adc5fd2a1f5ba4536700bdbfc12b40c013 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 6 May 2025 19:08:07 -0400 Subject: [PATCH 52/55] Forgot to add import db.sql --- itflow_install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/itflow_install.sh b/itflow_install.sh index b522ae0..3dd0086 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -238,6 +238,17 @@ FLUSH PRIVILEGES; SQL } & spin "MariaDB setup" +# Import SQL +SQL_DUMP="/var/www/${domain}/db.sql" +if [ -f "$SQL_DUMP" ]; then + show_progress "Importing database..." + log "Importing database from $SQL_DUMP" + mysql -u itflow -p"${mariadbpwd}" itflow < "$SQL_DUMP" +else + echo -e "${YELLOW}Database dump not found at $SQL_DUMP${NC}" + log "Database dump not found at $SQL_DUMP" +fi + # Config.php INSTALL_ID=$(tr -dc 'A-Za-z0-9' /var/www/${domain}/config.php From 7c9bfc7190bc1698ae750b3952427028556a928f Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 7 May 2025 15:47:01 -0400 Subject: [PATCH 53/55] Add php-zip module to install --- itflow_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itflow_install.sh b/itflow_install.sh index 3dd0086..ca3f652 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -149,7 +149,7 @@ show_progress "Installing packages..." apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse php-mbstring libapache2-mod-md \ + php-curl php-imap php-mailparse php-mbstring php-zip libapache2-mod-md \ certbot python3-certbot-apache git sudo whois cron dnsutils openssl } & spin "Installing packages" From 6519b6340c1d2f1450f380962ce90ad0c19082ee Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 19 Sep 2025 15:27:51 -0400 Subject: [PATCH 54/55] use new mail parser and mail queue scripts now in cron/ remove dependancies php-imap, php-mailparse now replaced with webklex php-imap and libapache2-mod-md as this is built into the core of apache now --- cron.d-itflow | 5 +++-- itflow_install.sh | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cron.d-itflow b/cron.d-itflow index 7f3e754..9db23f3 100644 --- a/cron.d-itflow +++ b/cron.d-itflow @@ -2,9 +2,10 @@ 0 2 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron.php 2>&1 | logger -t itflow-nightlycron # ITFlow Emails -* * * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_mail_queue.php 2>&1 | logger -t itflow-smtp -* * * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_ticket_email_parser.php 2>&1 | logger -t itflow-imap +* * * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/mail_queue.php 2>&1 | logger -t itflow-smtp +* * * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/ticket_email_parser.php 2>&1 | logger -t itflow-imap # ITFlow data refresh 0 3 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_domain_refresher.php 2>&1 | logger -t itflow-domains 0 4 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_certificate_refresher.php 2>&1 | logger -t itflow-certs + diff --git a/itflow_install.sh b/itflow_install.sh index ca3f652..0f29c0d 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -149,7 +149,7 @@ show_progress "Installing packages..." apt-get update && apt-get -y upgrade apt-get install -y apache2 mariadb-server \ php libapache2-mod-php php-intl php-mysqli php-gd \ - php-curl php-imap php-mailparse php-mbstring php-zip libapache2-mod-md \ + php-curl php-mbstring php-zip \ certbot python3-certbot-apache git sudo whois cron dnsutils openssl } & spin "Installing packages" @@ -218,8 +218,8 @@ show_progress "Cloning ITFlow..." PHP_BIN=$(command -v php) cat < /etc/cron.d/itflow 0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron.php -* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_ticket_email_parser.php -* * * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_mail_queue.php +* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron/ticket_email_parser.php +* * * * * www-data ${PHP_BIN} /var/www/${domain}/cron/mail_queue.php 0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_domain_refresher.php 0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_certificate_refresher.php EOF @@ -271,3 +271,4 @@ chmod 640 /var/www/${domain}/config.php show_progress "Installation Complete!" echo -e "Visit: ${GREEN}https://${domain}${NC}" echo -e "Log: ${GREEN}${LOG_FILE}${NC}" + From 339d088094bf866f0ba53102032b9f1750683770 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 7 Oct 2025 16:26:24 -0400 Subject: [PATCH 55/55] All cron jobs will reside in /cron/ now with file name prefix cron_ removed --- cron.d-itflow | 7 ++++--- itflow_install.sh | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cron.d-itflow b/cron.d-itflow index 9db23f3..90f6445 100644 --- a/cron.d-itflow +++ b/cron.d-itflow @@ -1,11 +1,12 @@ # ITFlow Nightly 2 AM cron -0 2 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron.php 2>&1 | logger -t itflow-nightlycron +0 2 * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/cron.php 2>&1 | logger -t itflow-nightlycron # ITFlow Emails * * * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/mail_queue.php 2>&1 | logger -t itflow-smtp * * * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/ticket_email_parser.php 2>&1 | logger -t itflow-imap # ITFlow data refresh -0 3 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_domain_refresher.php 2>&1 | logger -t itflow-domains -0 4 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron_certificate_refresher.php 2>&1 | logger -t itflow-certs +0 3 * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/domain_refresher.php 2>&1 | logger -t itflow-domains +0 4 * * * www-data /usr/bin/php /var/www/itflow.example.com/cron/certificate_refresher.php 2>&1 | logger -t itflow-certs + diff --git a/itflow_install.sh b/itflow_install.sh index 0f29c0d..5c35ac3 100644 --- a/itflow_install.sh +++ b/itflow_install.sh @@ -217,11 +217,11 @@ show_progress "Cloning ITFlow..." # Cron jobs PHP_BIN=$(command -v php) cat < /etc/cron.d/itflow -0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron.php +0 2 * * * www-data ${PHP_BIN} /var/www/${domain}/cron/cron.php * * * * * www-data ${PHP_BIN} /var/www/${domain}/cron/ticket_email_parser.php * * * * * www-data ${PHP_BIN} /var/www/${domain}/cron/mail_queue.php -0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_domain_refresher.php -0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/scripts/cron_certificate_refresher.php +0 3 * * * www-data ${PHP_BIN} /var/www/${domain}/cron/domain_refresher.php +0 4 * * * www-data ${PHP_BIN} /var/www/${domain}/cron/certificate_refresher.php EOF chmod 644 /etc/cron.d/itflow chown root:root /etc/cron.d/itflow @@ -272,3 +272,6 @@ show_progress "Installation Complete!" echo -e "Visit: ${GREEN}https://${domain}${NC}" echo -e "Log: ${GREEN}${LOG_FILE}${NC}" + + +