Compare commits

..

9 Commits

Author SHA1 Message Date
Marek Miklewicz d0ac04f38b Make SSH port configurable 2026-06-13 20:35:09 +02:00
Marek Miklewicz 79f7952aac Move imapsync into local plugin archives 2026-06-13 20:29:07 +02:00
Marek Miklewicz 9be960ab9d Use redis fresh install for new plugin setup 2026-06-13 20:21:38 +02:00
Marek Miklewicz 0e04667160 Install local DirectAdmin plugins 2026-06-13 20:16:49 +02:00
Marek Miklewicz 76818500b1 Update default PHP releases 2026-06-13 19:11:24 +02:00
Marek Miklewicz f880333fe5 Use local branding archives 2026-06-13 19:07:09 +02:00
Marek Miklewicz fee4de3e2b Repack enhanced translation without macOS metadata 2026-06-13 18:51:48 +02:00
Marek Miklewicz 0ecb158b3d Fix dapostinstall update step under set -e 2026-06-13 18:44:52 +02:00
Marek Miklewicz 6c377b2242 Prepare dapostinstall v2 2026-06-13 18:28:04 +02:00
16 changed files with 615 additions and 395 deletions
Binary file not shown.
Binary file not shown.
+2 -4
View File
@@ -3,13 +3,12 @@
#gedas@mc2.dev
### VARS ###
DEFAULTPACKAGE=NO_LIMIT
DEFAULTPACKAGE=NO-LIMIT
DNSMASTER="185.242.132.100" # IP address of this server that should be used on the client host for multiserver
DNSSLAVE="193.178.43.30" # the second DNS server. This server should be able to login to DNSSLAVE via ssh
DNSSLAVEPORT="22" # port for dnsslave
ADMINUSER="admin" # server main admin user
TRUSTED_IPS="127.0.0.1,185.242.134.92,185.242.134.93,185.242.134.94,193.177.165.192,193.177.165.193,193.177.165.194,193.177.165.195,193.177.165.196" #comma s
eparated list of IP addresses
TRUSTED_IPS="127.0.0.1,185.242.134.92,185.242.134.93,185.242.134.94,193.177.165.192,193.177.165.193,193.177.165.194,193.177.165.195,193.177.165.196" # comma separated list of IP addresses
### END VARS ###
######### FUNCTIONS
@@ -1443,4 +1442,3 @@ case "$1" in
createemptybackup) createemptybackup ;;
*) listFunctions ;;
esac
+224 -335
View File
@@ -1,5 +1,7 @@
#!/bin/bash
# VERSION 1.7.8-10.04.2025
set -euo pipefail
if [ -f "/var/log/dapostinstall.done" ]; then
echo -e "\e[31mSkrypt DApostinstall był już uruchomiony na tym serwerze - przerywam działanie.\e[0m"
exit 1
@@ -10,20 +12,155 @@ DADIR=/usr/local/directadmin
CBDIR=/usr/local/directadmin/custombuild
LOG_FILE=/var/log/dapostinstall.log
HTLINK="https://ht.zenadmin.pl"
MIN_PASSWORD_LENGTH=18
MAX_PASSWORD_LENGTH=24
ITERATION_LIMIT=100
DEFAULT_NS1=dns3.hitme.net.pl
DEFAULT_NS2=dns4.hitme.net.pl
SSH_PORT=10022
REDIS_VERSION=8
SETUP_TXT="$DADIR/conf/setup.txt"
PLUGIN_ARCHIVE_DIR="$DAPOSTINSTALL_DIR/plugins"
BRANDING_DIR="$DAPOSTINSTALL_DIR/branding"
DA_TEMPLATES_ARCHIVE="$BRANDING_DIR/da_templates.tar"
DA_BRANDING_ARCHIVE="$BRANDING_DIR/da-branding-hitme.tar.gz"
# PHP versions and extensions managed through DirectAdmin CustomBuild.
php1_release=8.4
php2_release=8.5
php3_release=8.3
php4_release=8.2
php5_release=8.1
php6_release=7.4
php7_release=7.3
php8_release=7.2
php9_release=5.6
ioncube=yes
zend=yes
opcache=yes
imap=yes
imagick=yes
configure_custombuild_php() {
local idx
local release
local release_var
cd "$CBDIR"
da build update
for idx in 1 2 3 4 5 6 7 8 9; do
release_var="php${idx}_release"
release="${!release_var}"
da build set "php${idx}_release" "$release"
if [[ "$release" != "no" ]]; then
da build set "php${idx}_mode" "php-fpm"
fi
done
da build php
da build rewrite_confs
}
build_php_extension() {
local enabled="$1"
local option="$2"
local target="$3"
[[ "$enabled" == "yes" ]] || return 0
cd "$CBDIR"
da build set "$option" yes
da build "$target"
}
install_local_plugin_archive() {
local archive="$1"
local plugin_name
local plugin_dir
local install_script
plugin_name="$(basename "$archive" .tar.gz)"
plugin_dir="$DADIR/plugins/$plugin_name"
echo "Instalacja pluginu $plugin_name"
rm -rf "$plugin_dir"
mkdir -p "$plugin_dir"
tar -zxf "$archive" -C "$plugin_dir"
chown -R diradmin:diradmin "$plugin_dir"
if [[ -f "$plugin_dir/install.sh" ]]; then
install_script="./install.sh"
chmod 755 "$plugin_dir/install.sh"
elif [[ -f "$plugin_dir/scripts/install.sh" ]]; then
install_script="./scripts/install.sh"
chmod 755 "$plugin_dir/scripts/install.sh"
else
fail "Brak install.sh w $plugin_dir"
fi
(
cd "$plugin_dir"
"$install_script"
)
if [[ "$plugin_name" == "imapsync" ]]; then
echo 'imapsync=ON' >> /usr/local/directadmin/data/users/admin/user.conf
cp "$DAPOSTINSTALL_DIR/lang_pl.php" "$plugin_dir/lang"
chown -R diradmin:diradmin "$plugin_dir"
fi
if [[ "$plugin_name" == "redis-manager" ]]; then
require_file "$DADIR/plugins/redis-manager/scripts/redis_install.sh"
chmod 755 "$DADIR/plugins/redis-manager/scripts/redis_install.sh"
(
cd "$plugin_dir"
./scripts/redis_install.sh "$REDIS_VERSION"
)
fi
}
install_local_plugins() {
local archive
local found=0
shopt -s nullglob
for archive in "$PLUGIN_ARCHIVE_DIR"/*.tar.gz; do
found=1
install_local_plugin_archive "$archive"
done
shopt -u nullglob
if [[ "$found" -eq 0 ]]; then
fail "Brak paczek pluginów w $PLUGIN_ARCHIVE_DIR"
fi
}
update_daupdate_tools() {
echo "update..."
wget "$HTLINK/daupdate.sh" -O /sbin/daupdate
chmod +x /sbin/daupdate
wget "$HTLINK/daupdate.sh" -O /opt/daupdate
wget "$HTLINK/da_cli.sh" -O /sbin/dacli
chmod +x /sbin/dacli
}
exec > >(tee -ia "$LOG_FILE") 2>&1
cd $DAPOSTINSTALL_DIR
cd "$DAPOSTINSTALL_DIR"
# shellcheck source=lib/common.sh
source "$DAPOSTINSTALL_DIR/lib/common.sh"
require_root
require_dir "$DADIR"
require_dir "$CBDIR"
require_file "$CBDIR/build"
require_file "$SETUP_TXT"
require_dir "$PLUGIN_ARCHIVE_DIR"
require_file "$DA_TEMPLATES_ARCHIVE"
require_file "$DA_BRANDING_ARCHIVE"
yum -y install epel-release
yum -y install htop wget rsync nano mc ncdu borgbackup screen net-tools htop libmemcached libmemcached-devel
cp daupdate.sh /opt
chmod 700 /opt/daupdate.sh
cd /opt/
/opt/daupdate.sh update
cd $DAPOSTINSTALL_DIR
update_daupdate_tools
cd "$DAPOSTINSTALL_DIR"
clear
cd $DAPOSTINSTALL_DIR
cd "$DAPOSTINSTALL_DIR"
echo "Blokada logowania roota hasłem"
sed -i '/PermitRootLogin yes/s/^#//g' /etc/ssh/sshd_config
@@ -41,7 +178,7 @@ chmod 600 $DADIR/data/users/admin/packages.list
echo "NO-LIMIT" > $DADIR/data/users/admin/packages.list
chown -R diradmin:diradmin $DADIR/data/users/admin/packages*
echo "Instalacja spolszczenia DirectAdmina"
echo "language=pl" >> $DADIR/conf/directadmin.conf
echo "language=pl" >> "$DADIR/conf/directadmin.conf"
sed -i 's/language=en/language=pl/gI' $DADIR/data/users/admin/user.conf
sed -i 's/language=en/language=pl/gI' $DADIR/data/users/admin/user.conf
sed -i 's/language=en/language=pl/gI' $DADIR/data/users/admin/packages/NO-LIMIT.pkg
@@ -79,59 +216,23 @@ cp pl.po login-pl.po $DADIR/data/skins/evolution/lang/
clear
PS3='Jaka skorke ustawic jako domyslna: '
options=("Enhanced" "Evolution")
select opt in "${options[@]}"
do
case $opt in
"Enhanced")
sed -i 's/evolution/enhanced/gI' $DADIR/conf/directadmin.conf
sed -i 's/evolution/enhanced/gI' $DADIR/data/users/admin/packages/NO-LIMIT.pkg
sed -i 's/evolution/enhanced/gI' $DADIR/data/users/admin/user.conf
systemctl restart directadmin
break
;;
"Evolution")
rm -f $DADIR/data/templates/custom/login.html
echo "Skorka evolution zostala ustawiona jako domyslna"
systemctl restart directadmin
break
;;
*) echo "Niewlasciwa opcja $REPLY";;
esac
done
echo "Wybierz tryb instalacji"
echo "Instalacja automatyczna instaluje wszystkie dodatki i przyjmuje domyslne ustawienia dla hitme."
echo "Instalacja niestandardowa pozwala pominac niektore komponenty, np. nie instalowac ModSecurity, okreslic inny niz 10022 port SSH czy serwery DNS niz standardowe dla hitme zadajac dodatkowe pytania podczas wykonywania skryptu"
PS3='Wybierz tryb instalacji: '
options=("Automatyczna" "Niestandardowa")
select opt in "${options[@]}"
do
case $opt in
"Automatyczna")
echo "Ustawienie DNSów hitme"
sed -i "/ns1=/c\ns1=dns3.hitme.net.pl" $DADIR/conf/directadmin.conf
sed -i "/ns2=/c\ns2=dns4.hitme.net.pl" $DADIR/conf/directadmin.conf
sed -i "/ns1=/c\ns1=dns3.hitme.net.pl" $DADIR/data/users/admin/user.conf
sed -i "/ns2=/c\ns2=dns4.hitme.net.pl" $DADIR/data/users/admin/user.conf
sed -i "/ns1=/c\ns1=dns3.hitme.net.pl" $DADIR/data/users/admin/reseller.conf
sed -i "/ns2=/c\ns2=dns4.hitme.net.pl" $DADIR/data/users/admin/reseller.conf
set_key_value "$DADIR/conf/directadmin.conf" "ns1" "$DEFAULT_NS1"
set_key_value "$DADIR/conf/directadmin.conf" "ns2" "$DEFAULT_NS2"
set_key_value "$DADIR/data/users/admin/user.conf" "ns1" "$DEFAULT_NS1"
set_key_value "$DADIR/data/users/admin/user.conf" "ns2" "$DEFAULT_NS2"
set_key_value "$DADIR/data/users/admin/reseller.conf" "ns1" "$DEFAULT_NS1"
set_key_value "$DADIR/data/users/admin/reseller.conf" "ns2" "$DEFAULT_NS2"
systemctl restart directadmin
echo "Ustawienie domyslnego portu SSH na 10022"
SSH_PORT=10022
echo "Ustawienie domyslnego portu SSH na $SSH_PORT"
sed -i '/Port 22/s/^#//g' /etc/ssh/sshd_config
sed -i "s/Port 22/Port 10022/g" /etc/ssh/sshd_config
sed -i "s/,22,/,22,10022,/g" /etc/csf/csf.conf
sed -i "s/Port 22/Port $SSH_PORT/g" /etc/ssh/sshd_config
sed -i "s/,22,/,22,$SSH_PORT,/g" /etc/csf/csf.conf
echo "Ustawienie dodatkowych zabezpieczen SSH"
@@ -159,22 +260,23 @@ echo "Instalacja Modsecurity i regułek malware experts"
daupdate antybots
echo "Instaluje branding hitme dla skorki evolution i serwera www"
templates_tmp="$(mktemp -d)"
trap 'rm -rf "$templates_tmp"' EXIT
cd $DAPOSTINSTALL_DIR
tar -xvf skin_customizations.tar -C $DADIR/data/users/admin/
cd $DAPOSTINSTALL_DIR
wget https://cdn.hitme.pl/da_templates.tar
tar -xf da_templates.tar
cp da_templates/*[1-9]* /home/admin/domains/default/
cp da_templates/index.html /home/admin/domains/default/index.html
cp da_templates/suspended.shtml /home/admin/domains/suspended/index.html
cp da_templates/index-hitme.html /var/www/html/index.html
tar -xf "$DA_TEMPLATES_ARCHIVE" -C "$templates_tmp"
cp "$templates_tmp"/da_templates/*[1-9]* /home/admin/domains/default/
cp "$templates_tmp"/da_templates/index.html /home/admin/domains/default/index.html
cp "$templates_tmp"/da_templates/suspended.shtml /home/admin/domains/suspended/index.html
if [[ -f "$templates_tmp"/da_templates/index-hitme.html ]]; then
cp "$templates_tmp"/da_templates/index-hitme.html /var/www/html/index.html
else
cp "$templates_tmp"/da_templates/index.html /var/www/html/index.html
fi
cd $DAPOSTINSTALL_DIR
echo "Login branging hitme"
cd /
wget https://cdn.hitme.pl/da_files/da-branding-hitme.tar.gz
tar xvzf da-branding-hitme.tar.gz
rm -rf da-branding-hitme.tar.gz
tar -xzf "$DA_BRANDING_ARCHIVE" -C /
cd $DAPOSTINSTALL_DIR/login_branding
cp admin/* $DADIR/data/admin/
cp -rfp users/admin/skin_customizations//evolution/* $DADIR/data/users/admin/skin_customizations/evolution
@@ -185,205 +287,27 @@ echo "Instalacja Security headers"
cd $DAPOSTINSTALL_DIR
cat security-headers.conf >>/etc/httpd/conf/extra/httpd-includes.conf
cd $CBDIR
./build rewrite_confs
da build rewrite_confs
cd $DAPOSTINSTALL_DIR
echo "Instalacja certyfikatu Let's Encrypt"
$DADIR/scripts/letsencrypt.sh request_single `hostname` 4096
break
;;
"Niestandardowa")
read -p "Podaj adres NS1 [dns3.hitme.net.pl]: " NS1_DEFAULT
NS1_DEFAULT=${NS1_DEFAULT:-dns3.hitme.net.pl}
read -p "Podaj adres NS2 [dns4.hitme.net.pl]: " NS2_DEFAULT
NS2_DEFAULT=${NS2_DEFAULT:-dns4.hitme.net.pl}
sed -i "/ns1=/c\ns1=$NS1_DEFAULT" $DADIR/conf/directadmin.conf
sed -i "/ns2=/c\ns2=$NS2_DEFAULT" $DADIR/conf/directadmin.conf
sed -i "/ns1=/c\ns1=$NS1_DEFAULT" $DADIR/data/users/admin/user.conf
sed -i "/ns2=/c\ns2=$NS2_DEFAULT" $DADIR/data/users/admin/user.conf
sed -i "/ns1=/c\ns1=$NS1_DEFAULT" $DADIR/data/users/admin/reseller.conf
sed -i "/ns2=/c\ns2=$NS2_DEFAULT" $DADIR/data/users/admin/reseller.conf
systemctl restart directadmin
read -p "Podaj port SSH [10022]: " SSH_PORT
SSH_PORT=${SSH_PORT:-10022}
sed -i '/Port 22/s/^#//g' /etc/ssh/sshd_config
sed -i "s/Port 22/Port $SSH_PORT/g" /etc/ssh/sshd_config
sed -i "s/,22,/,22,$SSH_PORT,/g" /etc/csf/csf.conf
while true; do
read -p "Czy aktywowac dodatkowe zabezpiecznia SSH (T/N)? " yn
case $yn in
[Tt] ) echo "Aktywacja dodatkowych zabezpieczen SSH"
tee -a /etc/ssh/sshd_config > /dev/null <<EOT
Match User root Address 185.242.134.0/24,185.242.133.37,185.242.134.92,185.242.134.93,193.177.165.192,193.177.165.193,193.177.165.194,193.177.165.195,193.177.165.196
PubkeyAuthentication yes
PasswordAuthentication yes
PermitRootLogin yes
EOT
break;;
[nN] ) echo "Pomijam aktywacje dodatkowych zabezpieczen SSH";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
while true; do
read -p "Czy instalowac klucze logowania HITME do SSH (T/N)? " yn
case $yn in
[Tt] ) echo "Instaluje klucze logowania HITME do SSH"
cd /opt
sh daupdate keyput
break;;
[nN] ) echo "Pomijam instalacje kluczy logowania do SSH";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
while true; do
read -p "Czy instalowac klucze logowania HITME do DirectAdmina (T/N)? " yn
case $yn in
[Tt] ) echo "Instaluje klucze logowania HITME do DirectAdmina"
cd /opt
sh daupdate klucze
break;;
[nN] ) echo "Pomijam instalacje kluczy logowania do DirectAdmina";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
echo "Instalacja ModSecurity"
while true; do
read -p "Czy instalowac ModSecurity z reglłkami Malware Experts (T/N)? " yn
case $yn in
[Tt] ) echo "Instaluje ModSecurity + Malware Experts"
wget $HTLINK/hitmemodsec.sh -O /opt/hitmemodsec.sh
sh /opt/hitmemodsec.sh
rm -f hitmemodsec.sh
daupdate antybots
break;;
[nN] ) echo "Pomijam instalacje ModSecurity";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
while true; do
read -p "Czy instalowac brandowanie hitme dla skorki evolution i serwera www (T/N)? " yn
case $yn in
[Tt] ) echo "Instaluje branowanie hitme dla skorki evolution"
cd $DAPOSTINSTALL_DIR
tar -xvf skin_customizations.tar -C $DADIR/data/users/admin/
wget https://cdn.hitme.pl/da_templates.tar
tar -xf da_templates.tar
cp da_templates/*[1-9]* /home/admin/domains/default/
cp da_templates/index.html /home/admin/domains/default/index.html
cp da_templates/suspended.shtml /home/admin/domains/suspended/index.html
cp da_templates/index-hitme.html /var/www/html/index.html
cd $DAPOSTINSTALL_DIR
break;;
[nN] ) echo "Pomijam instalacje brandowania hitme dla skorki evolution";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
echo "Certyfikat SSL dla DirectAdmina"
while true; do
read -p "Czy instalowac Let's Encrypt dla DirectAdmina dla hostname `hostname` (T/N)? " yn
case $yn in
[Tt] ) echo "Instaluje Let's encrypt"
$DADIR/scripts/letsencrypt.sh request_single `hostname` 4096
break;;
[nN] ) echo "Pomijam instalacje Let's Encrypt";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
while true; do
read -p "Czy instalowac Security Headers (T/N)? " yn
case $yn in
[Tt] ) echo "Instalacja Security Headers?"
cd $DAPOSTINSTALL_DIR
cat security-headers.conf >>/etc/httpd/conf/extra/httpd-includes.conf
cd $CBDIR
./build rewrite_confs
cd $DAPOSTINSTALL_DIR
break;;
[nN] ) echo "Pomijam instalacje Security Headers";
break;;
* ) echo "Niewlasciwa odpowiedz";;
esac
done
break
;;
*) echo "Niewlasciwa opcja $REPLY";;
esac
done
echo -e "\e[96mMam wszystkie informacje - rozpoczynam konfiguracje\e[0m"
echo "Konfiguracja i kompilacja PHP"
configure_custombuild_php
echo "Generowanie maila powitalnego"
cd $DAPOSTINSTALL_DIR
chmod 755 da_cli.sh
echo "Generowanie hasla DirectAdmin"
echo "Pobieranie hasla DirectAdmin z $SETUP_TXT"
count=0
DA_ADMINPASS=$(
while true; do
((count++))
[ "$count" -gt "$ITERATION_LIMIT" ] && { echo "Błąd: przekroczono limit iteracji generowania hasła" >&2; exit 1; }
base_part=$(tr -dc '[:alnum:]' < /dev/urandom | tr -d 'oO0l1I' | fold -w "$((RANDOM % (MAX_PASSWORD_LENGTH - MIN_PASSWORD_LENGTH + 1) + MIN_PASSWORD_LENGTH))" | head -n1)
special_char=$(tr -dc '[:graph:]' < /dev/urandom | tr -d '#|oO0l1I' | fold -w 1 | head -n1)
special_index=$((RANDOM % ${#base_part}))
password="${base_part:0:special_index}${special_char}${base_part:special_index}"
if echo "$password" | grep -qP '^(?=.*[[:digit:]])(?=.*[[:upper:]])(?=.*[^[:alnum:]]).+$'; then
echo "$password"
break
fi
done
)
DA_ADMINPASS=$(get_key_value "$SETUP_TXT" "adminpass")
DA_OPTIONSCONF=$CBDIR/options.conf
DA_USERCONF=$DADIR/data/users/admin/user.conf
@@ -392,53 +316,35 @@ DA_HOSTNAME=$(hostname -f)
DA_IP=$(cat "$DA_USERCONF" | grep 'ip=' | cut -d= -f2)
DA_NS1=$(cat "$DA_USERCONF" | grep 'ns1=' | cut -d= -f2)
DA_NS2=$(cat "$DA_USERCONF" | grep 'ns2=' | cut -d= -f2)
DA_PHP_LIST=$(get_php_release_list "$DA_OPTIONSCONF")
DA_PHP1=$(cat "$DA_OPTIONSCONF" | grep 'php1_release=' | cut -d= -f2)
DA_PHP2=$(cat "$DA_OPTIONSCONF" | grep 'php2_release=' | cut -d= -f2)
DA_PHP3=$(cat "$DA_OPTIONSCONF" | grep 'php3_release=' | cut -d= -f2)
DA_PHP4=$(cat "$DA_OPTIONSCONF" | grep 'php4_release=' | cut -d= -f2)
DA_PHP5=$(cat "$DA_OPTIONSCONF" | grep 'php5_release=' | cut -d= -f2)
DA_PHP6=$(cat "$DA_OPTIONSCONF" | grep 'php6_release=' | cut -d= -f2)
DA_PHP7=$(cat "$DA_OPTIONSCONF" | grep 'php7_release=' | cut -d= -f2)
DA_PHP8=$(cat "$DA_OPTIONSCONF" | grep 'php8_release=' | cut -d= -f2)
DA_PHP9=$(cat "$DA_OPTIONSCONF" | grep 'php9_release=' | cut -d= -f2)
export DA_HOSTNAME
export DA_IP
export DA_NS1
export DA_NS2
export DA_ADMINPASS
export DA_HASLO="$DA_ADMINPASS"
export SSH_PORT
export DA_PHP_LIST
sed -i 's/DA_HOSTNAME/'"$DA_HOSTNAME"'/g' mail_powitalny.txt
sed -i 's/DA_HOSTNAME/'"$DA_HOSTNAME"'/g' options.conf
sed -i 's/DA_IP/'"$DA_IP"'/g' mail_powitalny.txt
sed -i 's/DA_NS1/'"$DA_NS1"'/g' mail_powitalny.txt
sed -i 's/DA_NS2/'"$DA_NS2"'/g' mail_powitalny.txt
sed -i 's/DA_HASLO/'"$DA_ADMINPASS"'/g' mail_powitalny.txt
sed -i 's/SSH_PORT/'"$SSH_PORT"'/g' mail_powitalny.txt
sed -i 's/DA_PHP1/'"$DA_PHP1"'/g' mail_powitalny.txt
sed -i 's/DA_PHP2/'"$DA_PHP2"'/g' mail_powitalny.txt
sed -i 's/DA_PHP3/'"$DA_PHP3"'/g' mail_powitalny.txt
sed -i 's/DA_PHP4/'"$DA_PHP4"'/g' mail_powitalny.txt
sed -i 's/DA_PHP5/'"$DA_PHP5"'/g' mail_powitalny.txt
sed -i 's/DA_PHP6/'"$DA_PHP6"'/g' mail_powitalny.txt
sed -i 's/DA_PHP7/'"$DA_PHP7"'/g' mail_powitalny.txt
sed -i 's/DA_PHP8/'"$DA_PHP8"'/g' mail_powitalny.txt
sed -i 's/DA_PHP9/'"$DA_PHP9"'/g' mail_powitalny.txt
mv mail_powitalny.txt /root
render_template "$DAPOSTINSTALL_DIR/mail_powitalny.txt" "/root/mail_powitalny.txt"
echo "instalacja SpamBlocker"
cd $CBDIR
./build update
./build set eximconf yes
./build set eximconf_release 4.5
./build set blockcracking yes
./build set easy_spam_fighter yes
./build set spamd spamassassin
./build set exim yes
./build exim
./build set dovecot_conf yes
./build dovecot_conf
./build spamassassin
./build update
./build exim_conf
da build update
da build set eximconf yes
da build set blockcracking yes
da build set easy_spam_fighter yes
da build set spamd spamassassin
da build set exim yes
da build exim
da build set dovecot_conf yes
da build dovecot_conf
da build spamassassin
da build update
da build exim_conf
systemctl enable spamassassin
systemctl restart spamd
@@ -469,25 +375,25 @@ cd $DADIR
./directadmin set one_click_webmail_login 1
service directadmin restart
cd custombuild
./build update
./build dovecot_conf
./build exim_conf
./build roundcube
da build update
da build dovecot_conf
da build exim_conf
da build roundcube
echo "OneClick PhpMyAdmin"
cd $DADIR/
./directadmin set one_click_pma_login 1
systemctl restart directadmin
cd custombuild
./build update
./build phpmyadmin
da build update
da build phpmyadmin
echo "PhpMyAdmin tylko z poziomu DirectAdmina"
cd $CBDIR
./build update
./build set phpmyadmin_public no
./build phpmyadmin
da build update
da build set phpmyadmin_public no
da build phpmyadmin
systemctl restart directadmin
cd $DAPOSTINSTALL_DIR
@@ -505,29 +411,29 @@ mkdir -p $CBDIR/custom/ap2/conf/extra
cp -Rfp /etc/httpd/conf/extra/httpd-alias.conf $CBDIR/custom/ap2/conf/extra
echo "Alias /.well-known/autoconfig /var/www/html/.well-known/autoconfig" >> $CBDIR/custom/ap2/conf/extra/httpd-alias.conf
echo "Alias /poczta /var/www/html/roundcube" >> $CBDIR/custom/ap2/conf/extra/httpd-alias.conf
$CBDIR/build rewrite_confs
da build rewrite_confs
echo "Instalacja Imagick i WebP"
echo "Instalacja zaleznosci Imagick i WebP"
cd $DAPOSTINSTALL_DIR
if [[ "$imagick" == "yes" ]]; then
dnf -y install mesa-libGL giflib freeglut
# rpm -ivh libwebp-tools-1.0.0-8.el8_7.x86_64.rpm
dnf config-manager --set-enabled crb
dnf install -y giflib-devel
dnf -y install libwebp-devel libjpeg-devel libpng-devel libwebp-tools giflib libvpx libvpx-devel libtiff-devel libXpm-devel libpng-devel ImageMagick-devel
# $CBDIR/build set imagick yes
# $CBDIR/build imagick
sed -i 's/imagick=no/imagick=yes/g' /usr/local/directadmin/custombuild/options.conf
da build imagick
fi
echo "Instalacja IMAP"
sed -i 's/imap=no/imap=yes/gI' $CBDIR/options.conf
$CBDIR/build php_imap
echo "Instalacja rozszerzen PHP z CustomBuild"
build_php_extension "$ioncube" "ioncube" "ioncube"
build_php_extension "$zend" "zend" "zend"
build_php_extension "$opcache" "opcache" "opcache"
build_php_extension "$imap" "php_imap" "php_imap"
build_php_extension "$imagick" "imagick" "imagick"
echo "Instalacja Memcache i redis"
echo "Instalacja Memcache"
yum -y install memcached libmemcached
systemctl enable memcached
systemctl restart memcached
yum -y install redis redis-devel
echo "Instalacja rozszerzen PECL od poralixa"
cd $DADIR/scripts/custom
@@ -539,13 +445,7 @@ cd $DAPOSTINSTALL_DIR
cd $CBDIR
touch custom/php_disable_functions
echo "exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname" > custom/php_disable_functions
./build secure_php
# Poprawka redis dla AlmaLinux 9
if grep -q "AlmaLinux release 9" /etc/redhat-release; then
ln -s /etc/redis/redis.conf /etc/redis.conf
fi
da build secure_php
echo "Optymalizacja MySQL"
cd $DAPOSTINSTALL_DIR
@@ -561,12 +461,12 @@ echo '_dmarc="v=DMARC1;p=quarantine;pct=100;sp=none;fo=0:d:s;aspf=s;adkim=r;"' >
echo "Dopuszczenie wszystkich metod HTTPD"
cd $CBDIR
./build set http_methods ALL
./build rewrite_confs
da build set http_methods ALL
da build rewrite_confs
echo "Instalacja composera"
cd $CBDIR
./build composer
da build composer
cd $DAPOSTINSTALL_DIR
echo "Instalacja wp-cli"
@@ -597,22 +497,12 @@ touch /etc/ssh/sshd_config_placebo
sed -i 's^/etc/ssh/sshd_config^/etc/ssh/sshd_config_placebo^g' $DADIR/conf/directadmin.conf
systemctl restart directadmin
echo "Instalacja REDISa"
cd $DADIR/scripts/custom
./php-extension.sh install redis
mkdir $DADIR/plugins/redis_management
cd $DAPOSTINSTALL_DIR
tar -zxf redis_management.tar.gz -C $DADIR/plugins/redis_management
$DADIR/plugins/redis_management/scripts/install.sh
cd $DAPOSTINSTALL_DIR
echo "Instalacja IMAPsync"
echo "Instalacja pluginów DirectAdmin"
echo "Instalacja pakietu IMAPsync"
dnf -y install imapsync
mkdir $DADIR/plugins/imapsync
tar -zxf imapsync.tar.gz -C $DADIR/plugins/imapsync
$DADIR/plugins/imapsync/scripts/install.sh
echo 'imapsync=ON' >> /usr/local/directadmin/data/users/admin/user.conf
cp lang_pl.php $DADIR/plugins/imapsync/lang
cd $DAPOSTINSTALL_DIR
install_local_plugins
cd $DAPOSTINSTALL_DIR
echo "instalacja promptów"
sh prompt.sh
@@ -629,7 +519,6 @@ echo "dodaje JIT dla PHP"
sh php_zmienne.sh
sh da_cli.sh disablemultiserverpage
sh da_cli.sh disablecreateadmin
sh da_cli.sh changeuserpass admin $DA_ADMINPASS
sh da_cli.sh createemptybackup
+22
View File
@@ -0,0 +1,22 @@
# Status tlumaczenia skorki enhanced
Porownanie wykonane pomiedzy:
- angielska skorka: `/Users/marek/GPT/ChatGPT/dapostinstall/enhanced/lang/en`
- polskie tlumaczenie: `spolszczenie_enhanced.tar.gz` -> `pl/`
Stan po aktualizacji:
- brakujace pliki wzgledem `lang/en`: 0
- brakujace klucze `LANG_*`: 0
Dodano brakujace pliki:
- `pl/admin/admin_ssl.html`
- `pl/user/dnsprovider.html`
- `pl/user/mod_security.html`
- `pl/user/php_settings.html`
Uzupelniono brakujace klucze w istniejacych plikach, w tym obszary SSL/ACME/HSTS, ModSecurity, DNS Provider, limity wysylki, licencja, Rspamd, PHP Settings oraz nowe pozycje menu.
Uwaga: polskie archiwum nadal zawiera starsze pliki, ktorych nie ma w aktualnym `lang/en`, m.in. katalog `internal/`, obrazki i kilka starszych plikow user-level. Nie blokuje to kompletności aktualnych kluczy `LANG_*`.
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
PLUGIN_HOME_TITLE="Migracja poczty za pomocą IMAPSync";
PLUGIN_DESC_HEADER="";
PLUGIN_HOME_DESCRIPTION="Ta strona wyświetla wszystkie migracje skrzynek pocztowych z wykorzystaniem narzędzia IMAPSync. Nowe migracje mogą zostać rozpoczęte za pomocą przycisku "Nowa Migracja Skrzynki e-mail" lub "Nowa Migracja Wielu Skrzynek e-mail.<br><br>zobacz zakończone migracje dostępne w <a href='/CMD_TICKET?sort1=-1' target='_top' id='px_message_link'>Centrum Wiadomości</a>";
PLUGIN_HOME_DESCRIPTION="Ta strona wyświetla wszystkie migracje skrzynek pocztowych z wykorzystaniem narzędzia IMAPSync. Nowe migracje mogą zostać rozpoczęte za pomocą przycisku \"Nowa Migracja Skrzynki e-mail\" lub \"Nowa Migracja Wielu Skrzynek e-mail\".<br><br>zobacz zakończone migracje dostępne w <a href='/CMD_TICKET?sort1=-1' target='_top' id='px_message_link'>Centrum Wiadomości</a>";
PLUGIN_ACCESS_DENIED="Nie masz uprawnień do korzystania z tej strony! Skontaktuj się z administratorem aby uzyskać więcej informacje.";
PLUGIN_IMPORT_LINK="Nowa Migracja Skrzynki E-mail";
@@ -57,7 +57,7 @@ PLUGIN_BUTTON_TITLE2="Rozpoczynam Migrację";
PLUGIN_NO_DATA="Nie ma jeszcze nic do pokazania";
PLUGIN_LOGS_NOT_FOUND_ERROR="Żądane logi nie zostały odnalezione na serwerze;
PLUGIN_LOGS_NOT_FOUND_ERROR="Żądane logi nie zostały odnalezione na serwerze";
PLUGIN_REMOVED_LOGS_ERROR="Błąd podczas usuwania wybranych logów z serwera ";
PLUGIN_EMPTY_BAD_DATA_ERROR="Otrzymano puste lub uszkodzone dane z serwera.";
PLUGIN_SAVED_TASK_ERROR="Błąd podczas dodawania zadania proszę spróbować później.";
+87
View File
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
log() {
printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"
}
fail() {
printf 'ERROR: %s\n' "$*" >&2
exit 1
}
run_step() {
local message="$1"
shift
log "$message"
"$@"
}
require_root() {
[[ "${EUID}" -eq 0 ]] || fail "Ten skrypt musi byc uruchomiony jako root."
}
require_file() {
local path="$1"
[[ -f "$path" ]] || fail "Brak wymaganego pliku: $path"
}
require_dir() {
local path="$1"
[[ -d "$path" ]] || fail "Brak wymaganego katalogu: $path"
}
set_key_value() {
local path="$1"
local key="$2"
local value="$3"
touch "$path"
if grep -qE "^${key}=" "$path"; then
sed -i -E "s|^${key}=.*|${key}=${value}|" "$path"
else
printf '%s=%s\n' "$key" "$value" >> "$path"
fi
}
get_key_value() {
local path="$1"
local key="$2"
local value
value="$(grep -m1 -E "^${key}=" "$path" | cut -d= -f2-)"
[[ -n "$value" ]] || fail "Brak wartosci $key w $path"
printf '%s\n' "$value"
}
get_optional_key_value() {
local path="$1"
local key="$2"
grep -m1 -E "^${key}=" "$path" | cut -d= -f2- || true
}
get_php_release_list() {
local path="$1"
local value
local first=1
local idx
for idx in 1 2 3 4 5 6 7 8 9; do
value="$(get_optional_key_value "$path" "php${idx}_release")"
[[ -n "$value" && "$value" != "no" ]] || continue
if [[ "$first" -eq 1 ]]; then
printf 'PHP %s (domyślna)' "$value"
first=0
else
printf '\nPHP %s' "$value"
fi
done
}
render_template() {
local template="$1"
local output="$2"
perl -pe 's/\{\{([A-Z0-9_]+)\}\}/exists $ENV{$1} ? $ENV{$1} : $&/ge' "$template" > "$output"
}
+11 -19
View File
@@ -12,29 +12,29 @@ i zarządzać backupami. Opcję można skonfigurować tak, aby było to robione
W razie potrzeby dostosowania indywidualnych ustawień, czy też konfiguracji usługi zapraszam do kontaktu.
DANE DO PANELU DIRECTADMIN
Adres do panelu: https://DA_HOSTNAME:2222
Adres do panelu: https://{{DA_HOSTNAME}}:2222
Login administratora: admin
Hasło administratora: DA_HASLO
Adres IP serwera: DA_IP
Port SSH: SSH_PORT
Server Hostname: DA_HOSTNAME
Hasło administratora: {{DA_HASLO}}
Adres IP serwera: {{DA_IP}}
Port SSH: {{SSH_PORT}}
Server Hostname: {{DA_HOSTNAME}}
Logując się na konto administratora, jeżeli chcemy dodawać użytkowników, należy na poziomie administratora skorzystać z opcji "Dodaj użytkownika." Standardowo użytkownik ma nieograniczoną powierzchnie serwera jak również inne parametry takie jak ilość domen, ilość baz danych czy ilość kont e-maili
W ten sposób można zakładać końcowych userów, którym można wydzielać: przestrzeń dyskową, transfer
bazy danych, ftp, ilość domen, limity, a co najważniejsze dostęp do panelu, do którego będzie można logować się poprzez adres
np. http://zaparkowanadomena.pl:2222 lub poprzez adres https://DA_HOSTNAME:2222 jak powyżej.
np. http://zaparkowanadomena.pl:2222 lub poprzez adres https://{{DA_HOSTNAME}}:2222 jak powyżej.
POCZTA
Po podpięciu domeny i stworzeniu kont pocztowych można korzystać z klientów webowych, czyli webmail (link dostępny w panelu DA)
lub logując się bezpośrednio do poczty z adresu:
https://DA_HOSTNAME/poczta (nazwę DA_HOSTNAME można zastąpić nazwą domeny po jej zaparkowaniu).
https://{{DA_HOSTNAME}}/poczta (nazwę {{DA_HOSTNAME}} można zastąpić nazwą domeny po jej zaparkowaniu).
Jeśli chcecie Państwo skorzystać z poczty poprzez programy pocztowe takie jak: Outlook czy Mozilla Thunderbird należy użyć następujących danych w programie pocztowym
Nazwa użytkownika (Login): Pełen adres e-mail do skrzynki
Hasło: Hasło, które zostało podane podczas zakładania skrzynki:
Adres Serwera dla POP / IMAP oraz SMTP: DA_HOSTNAME
Adres Serwera dla POP / IMAP oraz SMTP: {{DA_HOSTNAME}}
Port serwera POP3: 995 (Szyfrowanie SSL / TLS)
Port serwera IMAP: 993 (Szyfrowanie SSL/TLS)
Port SMTP: 465 (szyfrowanie SSL) lub 587 (Szyfrowanie TLS)
@@ -43,23 +43,15 @@ Port SMTP: 465 (szyfrowanie SSL) lub 587 (Szyfrowanie TLS)
DNS
Adresy DNS, na które należy oddelegować domeny do zaparkowania, dodane w panelu DirectAdmin.
dns3.hitme.net.pl ip: 185.242.132.100
dns4.hitme.net.pl ip: 193.178.43.30
{{DA_NS1}}
{{DA_NS2}}
Tak oto przygotowana domena będzie można oddelegować na dane DNSy u operatora, u którego jest wykupiona domena.
Po zmianie dnsów, domena będzie działać i wyświetlać się z serwera.
Zmiana wersji PHP oraz Wiki
Na serwerze zainstalowane są następujące wersje PHP
PHP DA_PHP1 (domyślna)
PHP DA_PHP2
PHP DA_PHP3
PHP DA_PHP4
PHP DA_PHP5
PHP DA_PHP6
PHP DA_PHP7
PHP DA_PHP8
PHP DA_PHP9
{{DA_PHP_LIST}}
Zmiana domyślnej wersji PHP możliwa jest dla każdej domeny z poziomu panelu DirectAdmin zgodnie z poradnikiem pod adresem: https://wiki.hitme.pl/pomoc/hosting-dedykowany/php/zmiana-wersji-php-w-panelu-directadmin/
Jeśli potrzebna jest inna wersja PHP prosimy o kontakt z naszym supportem.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+262
View File
@@ -0,0 +1,262 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
fail() {
echo "FAIL: $*" >&2
exit 1
}
assert_file_contains() {
local file="$1"
local pattern="$2"
grep -qE "$pattern" "$file" || fail "$file does not contain pattern: $pattern"
}
assert_file_not_contains() {
local file="$1"
local pattern="$2"
if grep -qE "$pattern" "$file"; then
fail "$file contains forbidden pattern: $pattern"
fi
}
assert_bash_syntax() {
local file="$1"
bash -n "$file" || fail "$file has invalid bash syntax"
}
assert_archive_clean_for_linux_tar() {
local archive="$1"
local metadata_entries
local xattr_entries
metadata_entries="$(tar -tzf "$archive" | grep -E '(^|/)\._|(^|/)\.DS_Store$|(^|/)__MACOSX(/|$)' || true)"
if [[ -n "$metadata_entries" ]]; then
fail "$archive contains macOS metadata files"
fi
xattr_entries="$(gzip -dc "$archive" | strings | grep -E 'LIBARCHIVE\.xattr|SCHILY\.xattr|com\.apple' || true)"
if [[ -n "$xattr_entries" ]]; then
fail "$archive contains macOS extended attributes"
fi
}
assert_gzip_tar_contains() {
local archive="$1"
local path="$2"
tar -tzf "$archive" | grep -qx "$path" || fail "$archive does not contain $path"
}
assert_plain_tar_archive_clean_for_linux_tar() {
local archive="$1"
local metadata_entries
local xattr_entries
metadata_entries="$(tar -tf "$archive" | grep -E '(^|/)\._|(^|/)\.DS_Store$|(^|/)__MACOSX(/|$)' || true)"
if [[ -n "$metadata_entries" ]]; then
fail "$archive contains macOS metadata files"
fi
xattr_entries="$(tar -xOf "$archive" 2>/dev/null | strings | grep -E 'LIBARCHIVE\.xattr|SCHILY\.xattr|com\.apple' || true)"
if [[ -n "$xattr_entries" ]]; then
fail "$archive contains macOS extended attributes"
fi
}
assert_bash_syntax "$ROOT_DIR/dapostinstall.sh"
assert_bash_syntax "$ROOT_DIR/da_cli.sh"
assert_bash_syntax "$ROOT_DIR/daupdate.sh"
php -l "$ROOT_DIR/lang_pl.php" >/dev/null || fail "lang_pl.php has invalid PHP syntax"
assert_archive_clean_for_linux_tar "$ROOT_DIR/spolszczenie_enhanced.tar.gz"
[[ -f "$ROOT_DIR/branding/da_templates.tar" ]] || fail "missing local da_templates archive"
[[ -f "$ROOT_DIR/branding/da-branding-hitme.tar.gz" ]] || fail "missing local DA branding archive"
assert_plain_tar_archive_clean_for_linux_tar "$ROOT_DIR/branding/da_templates.tar"
assert_archive_clean_for_linux_tar "$ROOT_DIR/branding/da-branding-hitme.tar.gz"
[[ -f "$ROOT_DIR/plugins/borg-restore.tar.gz" ]] || fail "missing borg-restore plugin archive"
[[ -f "$ROOT_DIR/plugins/db-manager.tar.gz" ]] || fail "missing db-manager plugin archive"
[[ -f "$ROOT_DIR/plugins/redis-manager.tar.gz" ]] || fail "missing redis-manager plugin archive"
[[ -f "$ROOT_DIR/plugins/imapsync.tar.gz" ]] || fail "missing imapsync plugin archive"
assert_archive_clean_for_linux_tar "$ROOT_DIR/plugins/borg-restore.tar.gz"
assert_archive_clean_for_linux_tar "$ROOT_DIR/plugins/db-manager.tar.gz"
assert_archive_clean_for_linux_tar "$ROOT_DIR/plugins/redis-manager.tar.gz"
assert_archive_clean_for_linux_tar "$ROOT_DIR/plugins/imapsync.tar.gz"
assert_gzip_tar_contains "$ROOT_DIR/plugins/borg-restore.tar.gz" './install.sh'
assert_gzip_tar_contains "$ROOT_DIR/plugins/db-manager.tar.gz" './install.sh'
assert_gzip_tar_contains "$ROOT_DIR/plugins/redis-manager.tar.gz" './install.sh'
assert_gzip_tar_contains "$ROOT_DIR/plugins/redis-manager.tar.gz" './scripts/redis_install.sh'
assert_gzip_tar_contains "$ROOT_DIR/plugins/redis-manager.tar.gz" './scripts/redis_migrate.sh'
assert_gzip_tar_contains "$ROOT_DIR/plugins/imapsync.tar.gz" './scripts/install.sh'
assert_file_contains "$ROOT_DIR/da_cli.sh" '^DEFAULTPACKAGE=NO-LIMIT$'
assert_file_not_contains "$ROOT_DIR/da_cli.sh" '^eparated list of IP addresses$'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'c\\ns1='
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'c\\ns2='
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'set_key_value "\$DADIR/conf/directadmin\.conf" "ns1"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'set_key_value "\$DADIR/conf/directadmin\.conf" "ns2"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DEFAULT_NS1=dns3\.hitme\.net\.pl$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DEFAULT_NS2=dns4\.hitme\.net\.pl$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^SSH_PORT=10022$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^REDIS_VERSION=8$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^PLUGIN_ARCHIVE_DIR="\$DAPOSTINSTALL_DIR/plugins"$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^BRANDING_DIR="\$DAPOSTINSTALL_DIR/branding"$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DA_TEMPLATES_ARCHIVE="\$BRANDING_DIR/da_templates\.tar"$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DA_BRANDING_ARCHIVE="\$BRANDING_DIR/da-branding-hitme\.tar\.gz"$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php1_release='
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php2_release='
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php9_release='
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^ioncube=yes$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^zend=yes$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^opcache=yes$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^imap=yes$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^imagick=yes$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^SETUP_TXT="\$DADIR/conf/setup\.txt"$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^update_daupdate_tools\(\) \{$'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '/opt/daupdate\.sh update'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'require_file "\$SETUP_TXT"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'require_file "\$DA_TEMPLATES_ARCHIVE"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'require_file "\$DA_BRANDING_ARCHIVE"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'require_dir "\$PLUGIN_ARCHIVE_DIR"'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'https://cdn\.hitme\.pl/da_templates\.tar'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'https://cdn\.hitme\.pl/da_files/da-branding-hitme\.tar\.gz'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'tar -xf "\$DA_TEMPLATES_ARCHIVE" -C "\$templates_tmp"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'tar -xzf "\$DA_BRANDING_ARCHIVE" -C /'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'index-hitme\.html'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'DA_ADMINPASS=\$\(get_key_value "\$SETUP_TXT" "adminpass"\)'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'set_key_value "\$DADIR/conf/directadmin\.conf" "ns1" "\$DEFAULT_NS1"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'set_key_value "\$DADIR/conf/directadmin\.conf" "ns2" "\$DEFAULT_NS2"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'sed -i "s/Port 22/Port \$SSH_PORT/g" /etc/ssh/sshd_config'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'sed -i "s/,22,/,22,\$SSH_PORT,/g" /etc/csf/csf\.conf'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Port 10022'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" ',22,10022,'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'MIN_PASSWORD_LENGTH'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'MAX_PASSWORD_LENGTH'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'ITERATION_LIMIT'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '/dev/urandom'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'changeuserpass admin'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^configure_custombuild_php\(\) \{$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'release_var="php\$\{idx\}_release"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'release="\$\{!release_var\}"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php\$\{idx\}_release" "\$release"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php\$\{idx\}_mode" "php-fpm"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build php'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build rewrite_confs'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'eximconf_release'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '\./build'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '^[[:space:]]*\$CBDIR/build'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set eximconf yes'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build exim_conf'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'build_php_extension "\$ioncube" "ioncube" "ioncube"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'build_php_extension "\$zend" "zend" "zend"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'build_php_extension "\$opcache" "opcache" "opcache"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'build_php_extension "\$imap" "php_imap" "php_imap"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'build_php_extension "\$imagick" "imagick" "imagick"'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'sed -i .*imagick=no'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'sed -i .*imap=no'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'yum -y install redis redis-devel'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '\./php-extension\.sh install redis'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'ln -s /etc/redis/redis\.conf /etc/redis\.conf'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" "sed -i 's/DA_.*mail_powitalny.txt"
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'mv mail_powitalny.txt /root'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'DA_PHP_LIST=\$\(get_php_release_list "\$DA_OPTIONSCONF"\)'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'render_template "\$DAPOSTINSTALL_DIR/mail_powitalny.txt" "/root/mail_powitalny.txt"'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'PS3='
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '^select opt in'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" '"Niestandardowa"\)'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Czy instalowac'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Czy aktywowac'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Podaj adres NS'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Jaka skorke ustawic'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Wybierz tryb instalacji'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" "s/evolution/enhanced"
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'Skorka evolution zostala ustawiona jako domyslna'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^install_local_plugin_archive\(\) \{$'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'local found=0'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'for archive in "\$PLUGIN_ARCHIVE_DIR"/\*\.tar\.gz; do'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'found=1'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'Brak paczek pluginów w \$PLUGIN_ARCHIVE_DIR'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'plugin_name="\$\(basename "\$archive" \.tar\.gz\)"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'mkdir -p "\$plugin_dir"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'tar -zxf "\$archive" -C "\$plugin_dir"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'chown -R diradmin:diradmin "\$plugin_dir"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'chmod 755 "\$plugin_dir/install\.sh"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'chmod 755 "\$plugin_dir/scripts/install\.sh"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'cd "\$plugin_dir"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '\./install\.sh'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '\./scripts/install\.sh'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'chmod 755 "\$DADIR/plugins/redis-manager/scripts/redis_install\.sh"'
assert_file_contains "$ROOT_DIR/dapostinstall.sh" '\./scripts/redis_install\.sh "\$REDIS_VERSION"'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'redis_migrate\.sh'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'redis_management\.tar\.gz'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'plugins/redis_management'
assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'tar -zxf imapsync\.tar\.gz'
assert_file_contains "$ROOT_DIR/mail_powitalny.txt" '\{\{DA_HOSTNAME\}\}'
assert_file_contains "$ROOT_DIR/mail_powitalny.txt" '\{\{DA_HASLO\}\}'
assert_file_contains "$ROOT_DIR/mail_powitalny.txt" '\{\{DA_PHP_LIST\}\}'
assert_file_contains "$ROOT_DIR/mail_powitalny.txt" '\{\{DA_NS1\}\}'
assert_file_contains "$ROOT_DIR/mail_powitalny.txt" '\{\{DA_NS2\}\}'
assert_file_not_contains "$ROOT_DIR/mail_powitalny.txt" 'DA_PHP1'
COMMON_SH="$ROOT_DIR/lib/common.sh"
[[ -f "$COMMON_SH" ]] || fail "missing lib/common.sh"
# shellcheck source=/dev/null
source "$COMMON_SH"
tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
kv_file="$tmp_dir/example.conf"
printf 'ns1=old.example\nother=value\n' > "$kv_file"
set_key_value "$kv_file" "ns1" "dns3.hitme.net.pl"
set_key_value "$kv_file" "ns2" "dns4.hitme.net.pl"
grep -qx 'ns1=dns3.hitme.net.pl' "$kv_file" || fail "set_key_value did not replace ns1"
grep -qx 'ns2=dns4.hitme.net.pl' "$kv_file" || fail "set_key_value did not append ns2"
[[ "$(grep -c '^ns1=' "$kv_file")" -eq 1 ]] || fail "set_key_value duplicated ns1"
setup_file="$tmp_dir/setup.txt"
printf 'hostname=server.example\nadminpass=hG7KZfTPq1z8f4KC3N5J4\n' > "$setup_file"
[[ "$(get_key_value "$setup_file" "adminpass")" == "hG7KZfTPq1z8f4KC3N5J4" ]] || fail "get_key_value did not read adminpass"
php_options="$tmp_dir/options.conf"
printf 'php1_release=8.3\nphp2_release=8.2\nphp3_release=no\nphp9_release=7.4\n' > "$php_options"
expected_php=$'PHP 8.3 (domyślna)\nPHP 8.2\nPHP 7.4'
[[ "$(get_php_release_list "$php_options")" == "$expected_php" ]] || fail "get_php_release_list returned unexpected output"
php1_release=8.3
php2_release=8.2
php3_release=8.1
php4_release=7.4
php5_release=no
php6_release=no
php7_release=no
php8_release=no
php9_release=5.6
php_commands="$tmp_dir/php_commands.log"
for idx in 1 2 3 4 5 6 7 8 9; do
release_var="php${idx}_release"
release="${!release_var}"
printf 'da build set php%s_release %s\n' "$idx" "$release" >> "$php_commands"
done
grep -qx 'da build set php1_release 8.3' "$php_commands" || fail "php1_release command is wrong"
grep -qx 'da build set php2_release 8.2' "$php_commands" || fail "php2_release command is wrong"
grep -qx 'da build set php9_release 5.6' "$php_commands" || fail "php9_release command is wrong"
[[ "$(cut -d' ' -f5 "$php_commands" | sort -u | wc -l | tr -d ' ')" -gt 2 ]] || fail "php release commands appear to reuse a single value"
template_file="$tmp_dir/template.txt"
output_file="$tmp_dir/output.txt"
printf 'Host: {{DA_HOSTNAME}}\nPass: {{DA_HASLO}}\nPHP:\n{{DA_PHP_LIST}}\n' > "$template_file"
export DA_HOSTNAME='server.example'
export DA_HASLO='abc/123&xyz'
export DA_PHP_LIST="$expected_php"
render_template "$template_file" "$output_file"
grep -qx 'Host: server.example' "$output_file" || fail "render_template did not replace hostname"
grep -qx 'Pass: abc/123&xyz' "$output_file" || fail "render_template did not safely replace password"
grep -qx 'PHP 8.3 (domyślna)' "$output_file" || fail "render_template did not replace multiline PHP list"
echo "quality checks passed"
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
#file should be created as /usr/local/directadmin/scripts/custom/user_modify_pre.sh
#chown diradmin:diradmin /usr/local/directadmin/scripts/custom/user_modify_pre.sh
#chmod 700 /usr/local/directadmin/scripts/custom/user_modify_pre.sh
#Create a login key on destination (mail) server with CMD_MODIFY_USER permissions
da_host='mx1.hitme.net.pl'
da_user='admin'
da_pass='R1g4W43e458H28ObOX1x747S61J57511lyDpfc7fRGXZfo1IX0UrhPP1tZ3apx29'
if [ "${action}" = "package" ]; then
json_data=$(cat <<- EOF
{
"user":"${user}",
"package":"${package}",
"json":"yes",
"action":"package"
}
EOF
)
response=$(curl -s --request "POST" --data "${json_data}" "https://${da_user}:${da_pass}@${da_host}:2222/CMD_MODIFY_USER?json=yes")
if ! echo "${response}" | grep -q \"success\"; then
echo "Problem with a package on ${da_host}:</br>"
echo "${response}"
exit 1
fi
fi