From 93d4f24f07c4fc547c812a695284773c06a03d70 Mon Sep 17 00:00:00 2001 From: rm161 Date: Wed, 12 Aug 2026 10:53:04 +0200 Subject: [PATCH] jina verze --- .DS_Store | Bin 8196 -> 6148 bytes sodew-bash-main/README.md | 2 +- .../assets/k3s/templates/openlitespeed.yaml | 124 ++-- .../assets/openlitespeed/rules/php.rules | 13 - .../openlitespeed/templates/virtual.host.conf | 37 - .../{vhosts/domain.host.conf => vhost.conf} | 5 - .../openlitespeed/vhosts/virtual.host.conf | 38 - sodew-bash-main/config.sh.default | 47 +- sodew-bash-main/docs/options.md | 16 +- sodew-bash-main/docs/site.md | 8 +- sodew-bash-main/kube.sh | 5 +- sodew-bash-main/libs/app.sh | 8 +- sodew-bash-main/libs/commands/backup.sh | 64 +- sodew-bash-main/libs/commands/help.sh | 101 ++- sodew-bash-main/libs/commands/k3s.sh | 9 - sodew-bash-main/libs/commands/malware.sh | 43 +- .../libs/commands/openlitespeed.sh | 366 +++++----- sodew-bash-main/libs/commands/postfix.sh | 132 ++-- sodew-bash-main/libs/commands/redis.sh | 2 +- sodew-bash-main/libs/commands/restore.sh | 4 +- sodew-bash-main/libs/commands/router.sh | 165 ++--- sodew-bash-main/libs/commands/script.sh | 13 +- sodew-bash-main/libs/commands/site.sh | 108 +-- sodew-bash-main/libs/commands/storage.sh | 17 - sodew-bash-main/libs/commands/system.sh | 3 +- sodew-bash-main/libs/commands/unigma.sh | 59 -- sodew-bash-main/libs/commands/wordpress.sh | 12 +- sodew-bash-main/libs/commands/worker.sh | 6 +- sodew-bash-main/libs/file.sh | 226 ++++-- sodew-bash-main/libs/main.sh | 62 +- .../libs/modules/assets/ols-editor.pl | 570 +++++++-------- sodew-bash-main/libs/modules/backup.sh | 4 +- sodew-bash-main/libs/modules/diag.sh | 2 +- sodew-bash-main/libs/modules/mariadb.sh | 10 +- sodew-bash-main/libs/modules/metric.sh | 20 +- sodew-bash-main/libs/modules/openlitespeed.sh | 657 ++++++++---------- sodew-bash-main/libs/modules/postfix.sh | 479 +++++++++---- sodew-bash-main/libs/modules/redis.sh | 4 +- sodew-bash-main/libs/modules/site.sh | 59 +- sodew-bash-main/libs/modules/system.sh | 2 +- sodew-bash-main/libs/modules/unigma.sh | 116 ---- sodew-bash-main/libs/modules/wordpress.sh | 26 +- testm.txt | 1 - 43 files changed, 1686 insertions(+), 1959 deletions(-) delete mode 100644 sodew-bash-main/assets/openlitespeed/rules/php.rules delete mode 100644 sodew-bash-main/assets/openlitespeed/templates/virtual.host.conf rename sodew-bash-main/assets/openlitespeed/{vhosts/domain.host.conf => vhost.conf} (89%) delete mode 100644 sodew-bash-main/assets/openlitespeed/vhosts/virtual.host.conf delete mode 100644 sodew-bash-main/libs/commands/unigma.sh delete mode 100644 sodew-bash-main/libs/modules/unigma.sh delete mode 100644 testm.txt diff --git a/.DS_Store b/.DS_Store index 6b8af04ff1f8493baa18edec318070632592382a..14c3e622e36bcec416af4aa84ec4d7262a0b04c9 100644 GIT binary patch delta 126 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGqg`E6q~50$jCS`z?zj2C?GUhKtP<=oI#Jl z0EkT)Oc)F%>j}tjEHPnU%+A3f$PCg2)XWVeT!FZKW8rt^$^0^gj0}@)c%*rlAclkN LW7r(eGlv-fuGSLZ literal 8196 zcmeHMZEO@p7@l`q+C95)(+aXs;0_v#fdbcB2nB(oA4-K%?3MQVp>^+eY1i)U*4w>1 zK16Gb@$-+LKSiTPqXv~g;vZDhD1Z2YAtVx`m}u0WCdP#L`OeJVX@#bVA*6{r$;>-5 z@4WBKy!SjaH+O^(XwB)3gs6lN88ef#3X3Zwrf2!GB>6paPy*T$QXp$cifF_oW0#E% zI)VrU5eOm>L?DPj5P{hc0lc$WlBc=%g*GUI2m}%MUq*nP4^hla#(g;{BtJT^;7j8XI@ShkU%uyd@!%@b4IVq$tCm_rT_%nn5LIFNI z+C}+r0&yXOGKfGBfy*Pn-tJ+1uRBC1#+3K_8j``6yh-d%%Sop!Cxs&!xxy^}>8F{k zQw4Xzw|*}*VVSNMi=79ltb9&IrCcdj$#*8koI=9Wyqw#rWrtX+*Kw>=v96{1OrtPD z=eIewr^d)7G6rtCO>Jm)j~F|M{}?lX<--h!!nV*{F-Hf-Ir zNBi@pYo;ut*VZxyeLWO9S3|4A>LRsPrgd^Mmoo3once~JYUwgn8P;(fU5?J2>GXsg z;+hr9RCS1H+Oh_gx-9eV`jx8E>tYP3<_}!mpeViL__}OG_CR)kDH; z{RTzt&x_5`oqp%0&5D{#JDCjb#I1$~zk6F;RqtXm@6uead&01BRj2&v+dEWs&>hpV zMt1?BM^F3xo!HMmLewy`4&C&eEGqfdm#N*dJiuIT*L6eZi@c+USy0o?n+SG{xxhUA zT$bg!xcLr`e_ec)_#EnlAcO}sG{4yNCA%({l6tZcug6}p59#|Ld6FC<$H__ZJ~>0q zlW)lPKa8pCuQ_Me+mrnOuSjL_LKF z+=Pg4hOKZbqJ1aqf-dNTB**(O7%+;MzXwt8A?EkP0XPT`!Nc$fJc`JFn&bX?I07%h z%kT=k3P<5>co&YraX1Mdz$y3$K1ME_f%C|LZ{a(E=Muhmi*~VuU$8a*Btg6cRO.config` -- `DIR` - existence of the directory `$olsVhostsPath/` +- `DIR` - existence of the directory `$vhostsPath/` - `OLS` - existence of an entry in the `OpenLiteSpeed` configuration - `MD` - existence of the database (based on the entry in the configuration file) - `MU` - existence of the database user (based on the entry in the configuration file) - `RU` - existence of the Redis user (based on the entry in the configuration file) -- `WP` - existence of the WP configuration file `$olsVhostsPath//www/wp-config.php` +- `WP` - existence of the WP configuration file `$vhostsPath//www/wp-config.php` ) diff --git a/sodew-bash-main/kube.sh b/sodew-bash-main/kube.sh index e671b1a..6a2d241 100644 --- a/sodew-bash-main/kube.sh +++ b/sodew-bash-main/kube.sh @@ -2,7 +2,7 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -readonly appVersion="7.1.553" +readonly appVersion="7.0.539" readonly appName="KUBE" readonly appPath="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" readonly appFile="$(basename -- "$0")" @@ -16,8 +16,7 @@ function appDev() { printRow printFill 30 "◤◢" "$fontYellow" "◤$fontReset" - - +cmdOpenlitespeedRestart printFill 30 "◤◢" "$fontYellow" "◤$fontReset" } diff --git a/sodew-bash-main/libs/app.sh b/sodew-bash-main/libs/app.sh index dc7c70c..981c369 100644 --- a/sodew-bash-main/libs/app.sh +++ b/sodew-bash-main/libs/app.sh @@ -51,7 +51,7 @@ function appFailure() { if [[ "${1:-}" =~ ^[0-9]+$ ]]; then code="$1" - shift || true + shift fi printf '%b\n' "\033[0;91mCrash: $*\033[0m" @@ -70,18 +70,18 @@ function appLoadFile() { function appCheckConfig() { local value - local -a values=('hostName' 'hostIp' 'hostUuid' 'hostSalt' 'k3sNamespace' 'redisKube' 'mariadbKube' 'olsKube' 'postfixKube' 'workerKube' 'redisFileUsersAcl' 'postfixIp' 'postfixHost' 'postfixPostmaster' 'postfixDkimSelector' 'workerApiUrl' 'workerName' 'backupType' 'backupFirstDir') + local -a values=('hostName' 'hostIp' 'hostUuid' 'hostSalt' 'k3sNamespace' 'redisKube' 'mariadbKube' 'openlitespeedKube' 'postfixKube' 'workerKube' 'redisFileUsersAcl' 'postfixIp' 'postfixHost' 'postfixPostmaster' 'postfixDkimSelector' 'workerApiUrl' 'workerName' 'backupType' 'backupFirstDir') for value in "${values[@]}"; do [[ -n "${!value-}" ]] || appFailure 4 "$value: not specified" done - values=('appAssetsPath' 'appDataPath' 'basePath' 'olsVhostsPath' 'domainsList' 'k3sCmd' 'redisPath' 'mariadbMasterPath' 'mariadbSlavePath' 'olsPath' 'olsAdminPath' 'olsPhpIniPath' 'olsLogsPath' 'olsConfigFile' 'olsPrivatePath' 'olsPublicPath' 'olsVhostsConfigPath' 'postfixPath' 'postfixDkimPath' 'workerPath' 'workerAgentPath' 'workerTasksPath' 'workerFilesPath' 'logPath' 'logFile' 'backupDailyPath' 'backupArchivePath' 'storagePath' 'rsyncPath' 'ftpPath' 'sshPath') + values=('appAssetsPath' 'appDataPath' 'basePath' 'vhostsPath' 'domainsList' 'k3sCmd' 'redisPath' 'mariadbMasterPath' 'mariadbSlavePath' 'openlitespeedPath' 'openlitespeedAdminPath' 'openlitespeedPhpIniPath' 'openlitespeedLogsPath' 'openlitespeedConfigFile' 'openlitespeedVhostDataPath' 'openlitespeedVhostSharedPath' 'openlitespeedVhostsPath' 'postfixPath' 'postfixDkimPath' 'workerPath' 'workerAgentPath' 'workerTasksPath' 'workerFilesPath' 'logPath' 'logFile' 'backupDailyPath' 'backupArchivePath' 'storagePath' 'rsyncPath' 'ftpPath' 'sshPath') for value in "${values[@]}"; do [[ "${!value-}" == /* ]] || appFailure 4 "$value: a variable must begin with /" [[ "${!value-}" != */ ]] || appFailure 4 "$value: a variable cannot end in /" done - values=('backupParallelJobs' 'k3sReadyRetries' 'k3sReadySleep' 'workerApiGettingPause' 'workerApiSendingPause' 'backupDailyKeep' 'backupArchiveInterval' 'storageDailyKeep' 'storageArchiveKeep' 'olsQuotaBlockLimit' 'olsQuotaInodeLimit') + values=('backupParallelJobs' 'k3sReadyRetries' 'k3sReadySleep' 'workerApiGettingPause' 'workerApiSendingPause' 'backupDailyKeep' 'backupArchiveInterval' 'storageDailyKeep' 'storageArchiveKeep' 'openlitespeedQuotaBlockLimit' 'openlitespeedQuotaInodeLimit') for value in "${values[@]}"; do [[ "${!value-}" =~ ^[0-9]+$ ]] && (( ${!value} >= 1 )) || appFailure 4 "$value: incorrect number value" done diff --git a/sodew-bash-main/libs/commands/backup.sh b/sodew-bash-main/libs/commands/backup.sh index ac419fa..f851af7 100644 --- a/sodew-bash-main/libs/commands/backup.sh +++ b/sodew-bash-main/libs/commands/backup.sh @@ -10,7 +10,7 @@ function cmdBackupSitesArchive() { local type="${2:-$backupType}" local error vhostList total - run vhostList error openlitespeedConfigVhostList || { printDanger "Failed get list of vhosts: $error"; return 1; } + run vhostList error openlitespeedVhostList || { printDanger "Failed get list of virtual hosts: $error"; return 1; } total=$(grep -c . <<< "$vhostList") printSection "Config" @@ -68,13 +68,13 @@ function cmdBackupSitesRsync() { printDotText "Path" "$path" local error vhostList - run vhostList error openlitespeedConfigVhostList || { printDanger "Failed get list of vhosts: $error"; return 1; } + run vhostList error openlitespeedVhostList || { printDanger "Failed get list of virtual hosts: $error"; return 1; } printText "Files..." if [[ "$path" == *"$backupFirstDir" ]]; then - runError error rsync -a --mkpath -- "$olsVhostsPath/" "$path" || printDanger "$error" + runError error rsync -a --mkpath -- "$vhostsPath/" "$path" || printDanger "$error" else - runError error rsync -a --link-dest="$backupDailyPath/$backupFirstDir" -- "$olsVhostsPath/" "$path" || printDanger "$error" + runError error rsync -a --link-dest="$backupDailyPath/$backupFirstDir" -- "$vhostsPath/" "$path" || printDanger "$error" fi printText "Databases..." @@ -84,7 +84,7 @@ function cmdBackupSitesRsync() { printText "Configs..." while read -r domain; do - runError error cp -p -- "$olsVhostsConfigPath/$domain.conf" "$path/$domain.conf" || printDanger "$error" + runError error cp -p -- "$openlitespeedVhostsPath/$domain.conf" "$path/$domain.conf" || printDanger "$error" done < <(awk 'NF' <<< "$vhostList") } @@ -302,7 +302,6 @@ function cmdBackupDispatch() { # [$3] (type): backup type. function cmdBackupRun() { local target="$1" - [[ -n "$target" ]] || { printRow; printDanger "Target not specified"; return 1; } local path="$2" path=$(backupPathGenerate "$path") @@ -328,56 +327,3 @@ function cmdBackupRun() { fi fi } - -function cmdBackupList() { - printRow - - local dirList archiveList dailyList backupList backupCount error - run dirList error fileList "$backupArchivePath" d || { printDanger "$error"; return 1; } - archiveList=$(printf '%s\n' "$dirList" | grep -E -- "$backupArchiveDirPattern" | sort || true) - - run dirList error fileList "$backupDailyPath" d || { printDanger "$error"; return 1; } - dailyList=$(printf '%s\n' "$dirList" | grep -E -- "$backupDailyDirPattern" | sort || true) - - backupList=$(printf '%s\n' "$archiveList" "$dailyList" | awk 'NF' | sort) - backupCount=$(grep -c . <<< "$backupList" || true) - local i=0 num dir label - while read -r dir; do - ((++i)) - num=$(printf "%0${#backupCount}d" "$i") - label="$num: $fontBlue$dir$fontReset" - - if listContains "$dir" "$archiveList"; then - printDotText "$label" "${fontGreen}archive$fontReset" - elif listContains "$dir" "$dailyList"; then - printDotText "$label" "${fontGreen}daily$fontReset" - else - printDotText "$label" "$labelUnknown" - fi - done < <(awk 'NF' <<< "$backupList") -} - -function cmdBackupSize() { - local dirList file size total=0 archiveList dailyList - - printSection "Archive: $backupArchivePath" - run dirList error fileList "$backupArchivePath" d || { printDanger "$error"; return 1; } - archiveList=$(printf '%s\n' "$dirList" | grep -E -- "$backupArchiveDirPattern" | sort || true) - while IFS= read -r file; do - size=$(pathSize "$backupArchivePath/$file" "gb") - printDotText "$file" "$size Gb" - (( total += size )) - done <<< "$archiveList" - - printSection "Daily: $backupDailyPath" - run dirList error fileList "$backupDailyPath" d || { printDanger "$error"; return 1; } - dailyList=$(printf '%s\n' "$dirList" | grep -E -- "$backupDailyDirPattern" | sort || true) - while IFS= read -r file; do - size=$(pathSize "$backupDailyPath/$file" "gb") - printDotText "$file" "$size Gb" - (( total += size )) - done <<< "$dailyList" - - printRow - printDotText "total" "$total Gb" -} diff --git a/sodew-bash-main/libs/commands/help.sh b/sodew-bash-main/libs/commands/help.sh index 21f47eb..8407880 100644 --- a/sodew-bash-main/libs/commands/help.sh +++ b/sodew-bash-main/libs/commands/help.sh @@ -3,14 +3,14 @@ function cmdHelpPrint() { } function cmdHelpK3S() { - local title="-k|--k3s " + local title="-k|--k3s [option]" local desc=" create - create all resources in k3s remove - remove all resources in k3s info - detail about a k3s status - status about a k3s top - top pod - res [] - get resource info (all|pod|event|pv|pvc|deploy|ds|rs|sts|svc|ing|ip|secret|cm|job|cj|ep|no|ns|cs|netpol)" + res [resource] - get resource info (all|pod|event|pv|pvc|deploy|ds|rs|sts|svc|ing|ip|secret|cm|job|cj|ep|no|ns|cs|netpol)" cmdHelpPrint "$title" "$desc" } @@ -26,8 +26,8 @@ function cmdHelpMariaDB() { replica - replica rebuild database - database list user - user list - dump [all|] [] - dump specified database or all databases from Master - dump_slave [] - full dump from Slave" + dump [all|] [file] - dump specified database or all databases from Master + dump_slave [file] - full dump from Slave" cmdHelpPrint "$title" "$desc" } @@ -50,21 +50,22 @@ function cmdHelpRedis() { function cmdHelpOpenLiteSpeed() { local title="-o|--ols " local desc=" - install - install OpenLiteSpeed in k3s - update - update OpenLiteSpeed in k3s - uninstall - uninstall OpenLiteSpeed from k3s - info - detail about a OpenLiteSpeed - list