38 Commits

Author SHA1 Message Date
Bram Prieshof
cb8b0fc014 Added sitename 2020-07-16 14:11:16 +02:00
Bram Prieshof
0361e9f1bb Add 'TO-DO\FIX-CHECK' 2020-07-16 14:06:56 +02:00
Bram Prieshof
f29e10ff17 Added sitename 2020-07-16 12:52:46 +02:00
Bram Prieshof
d5a471ed1f Hostname Validation added 2020-07-15 13:30:40 +02:00
Bram Prieshof
dff348abbe Update 'TO-DO\Wanted-Features.md' 2020-07-10 14:59:26 +02:00
Bram Prieshof
ecdf83c648 Update 'TO-DO\Wanted-Features.md' 2020-07-10 13:29:18 +02:00
Bram Prieshof
8f69a59726 Added PHP modules for nextcloud 19 2020-07-09 14:58:21 +02:00
b.waal
5277331e46 Fixed captitals causing errors 2020-07-09 14:31:33 +02:00
b.waal
4553590060 Fixed captitals causing errors 2020-07-09 14:31:28 +02:00
Bram Prieshof
d5822eba69 Add 'TO-DO\Wanted-Features.md' 2020-06-17 11:18:21 +02:00
Bram Prieshof
c8a5cf7e67 Added Backup-Util as Always-on module 2020-06-12 11:33:09 +02:00
Bram Prieshof
b12c0a3057 Update 'CMS/nextcloud/nginx-conf.sh' 2020-06-12 11:10:43 +02:00
Bram Prieshof
5ab7179d0d Added Backup-Util 2020-06-12 10:28:11 +02:00
b.waal
0b57edae92 Added reload voor Postfix 2020-05-01 14:13:36 +02:00
Bram Prieshof
7d6cdcbc9f Update 'installer.sh' 2020-05-01 14:05:42 +02:00
Bram Prieshof
04b67f6553 upped fastcgi_timeout to 300s 2020-05-01 12:31:30 +02:00
Bram Prieshof
28e84d2553 Fixed postfix insert 2020-05-01 12:16:07 +02:00
Bram Prieshof
3006586ab2 Disabled apt recommended packages and enabled options menu 2020-05-01 12:09:48 +02:00
b.waal
e54eeadaee Updated to use NL language, disabled first run wizard 2020-05-01 12:07:05 +02:00
b.waal
c1412bf888 Added Redis 2020-05-01 11:32:40 +02:00
Bram Prieshof
0cd496306a updated locat 2020-05-01 11:29:39 +02:00
b.waal
df05133afd Add 'SubModules/redis/conf.sh' 2020-05-01 11:29:35 +02:00
b.waal
04ba481f7a Add 'SubModules/redis/apt.list' 2020-05-01 11:28:29 +02:00
b.waal
318aee6642 Add 'SubModules/redis/preconf.sh' 2020-05-01 11:27:23 +02:00
Bram Prieshof
59444e1029 Update 'CoreModules/generic/conf.sh' 2020-05-01 11:05:33 +02:00
b.waal
a73d12c9ca Added nload 2020-05-01 10:49:03 +02:00
Bram Prieshof
77bbfb7f92 Update 'CMS/nextcloud/nextcloud-init.sh' 2020-04-30 15:13:57 +02:00
Bram Prieshof
44d8bc23f7 Update 'CMS/nextcloud/nextcloud-init.sh' 2020-04-30 15:09:10 +02:00
Bram Prieshof
3c4f028637 Update 'CMS/nextcloud/nginx-conf.sh' 2020-04-30 14:39:49 +02:00
Bram Prieshof
c40d43ccee Add 'CMS/nextcloud/nginx-apt.list' 2020-04-30 14:38:47 +02:00
Bram Prieshof
a01bac4063 Update 'CoreModules/generic/preconf.sh' 2020-04-30 14:17:47 +02:00
b.waal
361acdd98b Removed gnupg2 from main installer 2020-04-30 14:14:34 +02:00
b.waal
2c1d471594 Added requirement for installer 2020-04-30 13:54:24 +02:00
b.waal
c5dddce793 Cleaned Var's 2020-04-30 13:50:57 +02:00
b.waal
e9f68034cd Updated to use the internal APT/Resource mirror 2020-04-30 13:45:54 +02:00
b.waal
ac1381641b Updated to use the internal APT/Resource mirror 2020-04-30 13:42:58 +02:00
Bram Prieshof
d89ab20c2d set default_type to application/octet-stream 2020-04-30 13:38:50 +02:00
b.waal
197ebd70cd Added No-Update flag for PPA 2020-04-30 12:29:19 +02:00
20 changed files with 171 additions and 55 deletions

View File

@@ -12,13 +12,13 @@ source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/ModulesM
#Setting Menulist to webserver
if [[ $webserv = "apache" ]]; then
#Apache Menulist
CMSL=("${ApacheCMSL[@]}")
options=("${ApacheOptions[@]}")
CMSL=("${apacheCMSL[@]}")
options=("${apacheOptions[@]}")
fi
if [[ $webserv = "nginx" ]]; then
#Nginx Menulist
CMSL=("${NginxCMSL[@]}")
options=("${NginxOptions[@]}")
CMSL=("${nginxCMSL[@]}")
options=("${nginxOptions[@]}")
fi
@@ -80,6 +80,20 @@ if [ $IMODE = n ]; then
domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3)
[[ -d "/var/www/"$domain"/html" ]] && msg " This domain already exists on this server, Exiting" 8 78 && exit;
if (whiptail --title "Config" --yesno " Does www.${domain} exist in DNS" 8 78); then domainwww=1; else domainwww=0; fi
if (whiptail --title "Set sitename?" --yesno "Set sitename to ${domain//./_} ?" 8 78); then
echo "Yes"
sitename=${domain//./_}
else
while true; do
sitename=$(whiptail --nocancel --inputbox "Enter sitename, Must NOT contain special characters, except: _" 8 78 --title "Sitename" 3>&1 1>&2 2>&3)
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
whiptail --msgbox " Site can't be empty, or contain a special character except for: _" 11 78
else
break
fi
done
fi
if (whiptail --title "Config" --yesno " Enable SSL on installation?" 11 78); then sslenable=1; else sslenable=0; fi
PasswordQuest
CMS=$(whiptail --title "What CMS should be installed?" --radiolist "Features" 11 118 5 "${CMSL[@]}" 3>&1 1>&2 2>&3)
@@ -101,6 +115,23 @@ if [ $IMODE = l ]; then
* ) echo "Choose yes of no.";;
esac
done
read -p "Set sitename to ${domain//./_}? (y/n)" choice
case "$choice" in
y|Y ) echo "yes";sitename=${domain//./_};;
n|N ) echo "no";
while true; do
echo "Please enter sitename, Must NOT contain special characters, except: _";read sitename
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
echo "Site can't be empty, or contain a special character except for: _"
else
break
fi
done
;;
* ) echo "invalid";;
esac
while true; do
read -p "Enable SSL on installation? -> yes/no?" yn
case $yn in

View File

@@ -16,13 +16,13 @@ source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/ModulesM
#Setting Menulist to webserver
if [[ $webserv = "apache" ]]; then
#Apache Menulist
CMSL=("${ApacheCMSL[@]}")
options=("${ApacheOptions[@]}")
CMSL=("${apacheCMSL[@]}")
options=("${apacheOptions[@]}")
fi
if [[ $webserv = "nginx" ]]; then
#Nginx Menulist
CMSL=("${NginxCMSL[@]}")
options=("${NginxOptions[@]}")
CMSL=("${nginxCMSL[@]}")
options=("${nginxOptions[@]}")
fi
#Filtering already installed modules

View File

@@ -10,6 +10,8 @@ add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_hide_header X-Powered-By;
fastcgi_buffers 64 4K;
gzip on;

View File

@@ -1,4 +1,20 @@
sudo -u www-data php /var/www/DOMAINname/html/occ db:convert-filecache-bigint
sudo -u www-data php /var/www/DOMAINname/html/occ db:add-missing-indices
sudo -u www-data php /var/www/DOMAINname/html/occ app:disable firstrunwizard
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set default_language --value=nl
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set default_locale --value=nl
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set skeletondirectory --value=
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set memcache.local --value='\OC\Memcache\APCu'
if [ "$(systemctl is-active redis-server)" = "active" ]; then
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set redis host --value=localhost
sudo -u www-data php /var/www/DOMAINname/html/occ config:system:set redis port --value=6379
else
echo "Redis not installed or runing on this system"
fi
echo "*/5 * * * * www-data php -f /var/www/DOMAINname/html/cron.php > /dev/null 2>&1" >> /etc/crontab
rm -f /etc/update-motd.d/50-nextnotice

View File

@@ -0,0 +1 @@
phpPHPver-apcu phpPHPver-bcmath phpPHPver-gmp

View File

@@ -1,5 +1,4 @@
#Nextcloud major release version
nxtVer=18
#Configuring nginx
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/Nginx-unconfigured -O /tmp/nginx-siteconf
@@ -17,15 +16,16 @@ if [ -z ${ignphpcms+x} ]; then ignphpcms=0;fi
sed -i '/upload_max_filesize/c\upload_max_filesize = 1G' /etc/php/"$phpver"/fpm/php.ini
sed -i '/post_max_size/c\post_max_size = 1G' /etc/php/"$phpver"/fpm/php.ini
sed -i '/memory_limit/c\memory_limit = 512M' /etc/php/"$phpver"/fpm/php.ini
echo "apc.enable_cli = 1" >> /etc/php/"$phpver"/fpm/php.ini
fi
#Getting Nextcloud
wget -t7 https://download.nextcloud.com/server/releases/latest-"$nxtVer".tar.bz2 -O /tmp/nextcloud.tar.bz2
wget -t7 http://mirror.nxdi.nl/resources/nextcloud/latest.tar.bz2 -O /tmp/nextcloud.tar.bz2
tar jxf /tmp/nextcloud.tar.bz2 -C /tmp
cp -a /tmp/nextcloud/. /var/www/"$domain"/html
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d)`
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="nextcloud_$db_suffix"
db_user="nextcloud_$db_suffix"
db_pass=$(date +%s|sha256sum|base64|head -c 32)

View File

@@ -15,7 +15,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
mkdir -p /var/www/"$domain"/html
#Getting WordPress
wget -q -t7 https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
wget -q -t7 http://mirror.nxdi.nl/resources/wordpress/latest.tar.gz -O /tmp/wp.tar.gz
tar -C /var/www/"$domain"/html -xzf /tmp/wp.tar.gz --strip 1
rm /var/www/"$domain"/html/wp-config-sample.php

View File

@@ -1 +1 @@
mailutils htop ufw
mailutils htop ufw nload

View File

@@ -5,6 +5,7 @@
sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf
sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf
sed -i 's/relayhost =/mydestination = '$hostname', localhost.'$hostname', '$hostname'/g' /etc/postfix/main.cf
echo "bounce_notice_recipient = info@$domain" >> /etc/postfix/main.cf
cat <<EOF > /etc/aliases
# See man 5 aliases for format
postmaster: root

View File

@@ -11,7 +11,6 @@ $PKGI software-properties-common gnupg > $OUTPUT 2>&1
$PKGA universe -y > $OUTPUT 2>&1
$PKGA ppa:ondrej/php -y -n > $OUTPUT 2>&1
$PKGA ppa:certbot/certbot -y -n > $OUTPUT 2>&1
$PKGA ppa:chris-lea/redis-server -y -n > $OUTPUT 2>&1
##-------------##

View File

@@ -26,7 +26,7 @@ http {
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type text/html;
default_type application/octet-stream;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers on;

View File

@@ -1,5 +1,5 @@
# Module modes
A module can be external(in other/external git repo) or internal(Modules/<ModuleName>).
A module can be external(in other/external git repo) or internal(SubModules/<ModuleName>).
In both cases the file structure is expected as shown below
# List of possible Files and expected Structure
@@ -12,7 +12,7 @@ In both cases the file structure is expected as shown below
* config/*
## The internal module location
Modules/`<ModuleName>`
SubModules/`<ModuleName>`
# File Explanation
| File Name | Description |

View File

@@ -13,17 +13,14 @@ nginxCMSL=("None:" "A plain webserver will be setup." OFF)
nginxCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF)
nginxCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF)
#Options
nginxOptions=("Option 1:" "Option 1 Desription" OFF)
nginxOptions+=("Option 2:" "Option 2 Desription" OFF)
nginxOptions+=("Option 3:" "Option 3 Desription" OFF)
nginxOptions=("Redis:" "Redis caching" OFF)
##Apache
#CMSList
apacheCMSL=("None:" "A plain webserver will be setup." OFF)
apacheCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF)
#Options
apacheOptions=("Option 1:" "Option 1 Desription" OFF)
apacheOptions+=("Option 2: " "Option 2 Desription" OFF)
apacheOptions=("Redis:" "Redis caching" OFF)
fi
if [ $IMODE = l ]; then
#WebServers
@@ -32,12 +29,12 @@ webservers=("Nginx" "Apache" "Quit")
#CMSList
nginxCMSL=("Wordpress" "Nextcloud" "None")
#Options
nginxOptions=("Ngx Option 1:" "Ngx Option 2:" "Ngx Option 3:")
nginxOptions=("Redis:")
##Apache
#CMSList
apacheCMSL=("Wordpress" "Nextcloud" "None")
#Options
apacheOptions=("Apa Option 1:" "Apa Option 2:" "Apa Option 3:")
apacheOptions=("Redis:")
fi

View File

@@ -0,0 +1 @@
redis-server phpPHPver-redis

3
SubModules/redis/conf.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
systemctl enable --now redis-server

View File

@@ -0,0 +1,3 @@
#!/bin/bash
$PKGA ppa:chris-lea/redis-server -y -n > $OUTPUT 2>&1

2
TO-DO\FIX-CHECK Normal file
View File

@@ -0,0 +1,2 @@
# Menu Legacy
Options enable/disable

8
TO-DO\Wanted-Features.md Normal file
View File

@@ -0,0 +1,8 @@
# Webservers
* Apache
# Modules
* Fail2Ban
# Other
* detection if hostname(fqdn) is same as web domain
* Update tool for PHP (example 7.3 to 7.4)

View File

@@ -1,2 +1,3 @@
https://git.ictmaatwerk.com/VPS-scripts/MySQL/raw/branch/master/
https://git.ictmaatwerk.com/VPS-scripts/Unattended-Security-Updates/raw/branch/master/
https://git.ictmaatwerk.com/VPS-scripts/Unattended-Security-Updates/raw/branch/master/
https://git.ictmaatwerk.com/VPS-scripts/Backup-Util/raw/branch/master/

View File

@@ -27,15 +27,11 @@ branch=master
#Installer-config
phpver=7.4
PHPMyadmin=1
phpmyadminver="5.0.2"
sqlver=8.0
cockpit=1
TestMode=0
#PackageManager-config
PKGA="add-apt-repository"
PKGI="${PKGM} install -y"
#disable option menu
OptMenu=D
PKGA="add-apt-repository --no-update"
PKGI="${PKGM} install -y --no-install-recommends"
##-------------##
# Test-Vars #
@@ -57,6 +53,8 @@ fi
aonoption="/MySQL/"
aonoption="$aonoption /Unattended-Security-Updates/"
aonoption="$aonoption /Backup-Util/"
##---------------##
@@ -130,6 +128,33 @@ else
fi
}
function HostnameQuest {
if (whiptail --title "Config" --yesno " Hostname with nxdi.nl" 11 78); then
hostname=$(whiptail --nocancel --inputbox " SystemID (eg: VCH001) without ".nxdi.nl" " 11 82 --title "Config" 3>&1 1>&2 2>&3)
hostname=$hostname".nxdi.nl"
else
hostname=$(whiptail --nocancel --inputbox " Hostname" 11 78 --title "Config" 3>&1 1>&2 2>&3)
fi
}
function LegacyHostnameQuest {
while true; do
read -p "Hostname with nxdi.nl -> yes/no?" yn
case $yn in
[Nn]* )
echo 'Enter full hostname:'
read hostname
break;;
[Yy]* )
echo 'Hostname (eg: VCH001) without ".nxdi.nl":'
read hostname
hostname=$hostname".nxdi.nl"
break;;
* )echo "Choose yes or no.";;
esac
done
}
##--------------------------##
# Installer-Requirements #
@@ -150,13 +175,30 @@ source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/ModulesM
if [ $IMODE = n ]; then
if [ $TestMode = 0 ]; then
domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3)
if (whiptail --title "Config" --yesno " Does www.${domain} exist in DNS" 8 78); then domainwww=1; else domainwww=0; fi
if (whiptail --title "Config" --yesno " Hostname with nxdi.nl" 11 78); then
hostname=$(whiptail --nocancel --inputbox " SystemID (eg: VCH001) without ".nxdi.nl" " 11 82 --title "Config" 3>&1 1>&2 2>&3)
hostname=$hostname".nxdi.nl"
if (whiptail --title "Set sitename?" --yesno "Set sitename to ${domain//./_} ?" 8 78); then
echo "Yes"
sitename=${domain//./_}
else
hostname=$(whiptail --nocancel --inputbox " Hostname" 11 78 --title "Config" 3>&1 1>&2 2>&3)
while true; do
sitename=$(whiptail --nocancel --inputbox "Enter sitename, Must NOT contain special characters, except: _" 8 78 --title "Sitename" 3>&1 1>&2 2>&3)
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
whiptail --msgbox " Site can't be empty, or contain a special character except for: _" 11 78
else
break
fi
done
fi
while true; do
HostnameQuest
if [[ "$hostname" == "$domain" ]] || [ -z "$hostname" ]
then
whiptail --msgbox " Hostname can't be empty, or be the same as the domain" 11 78
else
break
fi
done
if (whiptail --title "Config" --yesno " Enable SSL on installation?" 11 78); then
sslenable=1
else
@@ -185,20 +227,32 @@ while true; do
* ) echo "Choose yes of no.";;
esac
done
read -p "Set sitename to ${domain//./_}? (y/n)" choice
case "$choice" in
y|Y ) echo "yes";sitename=${domain//./_};;
n|N ) echo "no";
while true; do
echo "Please enter sitename, Must NOT contain special characters, except: _";read sitename
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
echo "Site can't be empty, or contain a special character except for: _"
else
break
fi
done
;;
* ) echo "invalid";;
esac
while true; do
read -p "Hostname with nxdi.nl -> yes/no?" yn
case $yn in
[Nn]* )
echo 'Enter full hostname:'
read hostname
break;;
[Yy]* )
echo 'Hostname (eg: VCH001) without ".nxdi.nl":'
read hostname
hostname=$hostname".nxdi.nl"
break;;
* )echo "Choose yes or no.";;
esac
LegacyHostnameQuest
if [[ "$hostname" == "$domain" ]] || [ -z "$hostname" ]
then
echo "Hostname can't be empty, or be the same as the domain"
else
break
fi
done
while true; do
read -p "Enable SSL on installation? -> yes/no?" yn
@@ -244,18 +298,18 @@ printf " " >>/tmp/apt.list
# Storeing vars #
##-----------------##
mkdir /etc/ICTM
mkdir -p /etc/ICTM/sites
echo "InstDate=$(date "+%d-%B-%Y")" >> /etc/ICTM/mainvar.list
for storeme in PKGM PKGA PKGI OUTPUT IMODE repo branch webserv phpver sqlver PHPMyadmin email hostname; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list
done
touch /etc/ICTM/sites/"$sitename"
##----------##
# Addons #
##----------##
##DisableOPtionMenu
if [ $OptMenu != D ]; then
if [ $IMODE = n ]; then
option=$(whiptail --nocancel --title "Additional modules" --checklist "Features" 11 110 5 "${options[@]}" 3>&1 1>&2 2>&3)
fi
@@ -276,7 +330,6 @@ opt="${opt%"${opt##*[![:space:]]}"}"
option+="\"$opt\" "
fi
}
echo "The first selection will always return invalid option, please enter the first option twice"
PS3='Which addons should be installed?'
while :
do
@@ -302,8 +355,6 @@ done
done
option="${option%"${option##*[![:space:]]}"}"
fi
##DisableOPtionMenu
fi
#saving selected modules
echo 'SelectedOptions=('$option')' > /etc/ICTM/selopts.list
@@ -506,7 +557,7 @@ fi
# Services #
##------------##
systemctl restart sshd
systemctl reload sshd postfix postfix@-
##-------##