Compare commits

...

701 commits

Author SHA1 Message Date
Peca
5ea346a345 Debian 13 installation files 2025-08-18 15:43:59 +02:00
Peca
a475e71145 Update vesta_compile.sh to set NGINX version to 1.29.1 and PHP version to 8.4.11 2025-08-18 15:24:54 +02:00
Peca
b4e10ed968 v-commander: disabling ClamAV 2025-08-18 15:06:17 +02:00
Peca
37c99361f7 v-commander: Add Freexian repository 2025-08-18 15:01:25 +02:00
Peca
63972e2266 v-commander: Enhance reboot requirement check to include dbus updates 2025-08-18 14:57:07 +02:00
Peca
87267eb18f v-commander: Add functionality to renew nginx GPG key and add Freexian repository 2025-08-18 14:47:20 +02:00
Peca
04453ebca2 v-df-snapshot-make tweaks and snapshot for /hdd 2025-08-18 14:28:32 +02:00
Peca
3faa448a32 Update Changelog for version 0.9.9-0-13 2025-08-15 20:14:45 +02:00
Peca
37e6a295ba Adding /usr/local/vesta/data/upgrades/ files that will prevent fixes to be repeated on next updates 2025-08-15 19:56:34 +02:00
Peca
7dbb74b6bf Increase changelog display limit from 30 to 100 entries in user index page 2025-08-15 17:47:12 +02:00
Peca
930bf7ed2b Version 0.9.9-0-13 2025-08-15 17:28:32 +02:00
Peca
ace0e0e2bf SSL fix for Apache 2.4.65+ 2025-08-15 08:28:52 +02:00
Peca
457e5c862e Add cron job for disk usage snapshot 2025-08-13 19:35:56 +02:00
myvesta
0a1df66a16
Merge pull request #200 from lukapaunovic/patch-7
Create wprocket-webp-express-force-https.tpl
2025-08-10 14:31:21 +02:00
myvesta
5e58708c5b
Merge pull request #202 from myvesta/cursor/PHP-syntax-fixes
PHP syntax fixes
2025-08-10 14:29:59 +02:00
Cursor Agent
be756306b0 Remove PHP version-specific code for array access and string formatting
Co-authored-by: peca <peca@mycity.rs>
2025-08-10 12:13:20 +00:00
Cursor Agent
4fff4b4985 Fix PHP 5.6 array index and implode compatibility issues
Co-authored-by: peca <peca@mycity.rs>
2025-08-10 11:48:54 +00:00
Peca
efe0045c5f Introduction of v-fix-website-permissions-only-php script 2025-08-07 23:56:00 +02:00
Peca
5008c2c778 Refactor v-fix-website-permissions to introduce conditional checks for PHP and symlink ownership adjustments, allowing for more flexible permission management based on configuration files. 2025-08-07 18:29:11 +02:00
Peca
a183cabdc7 v-install-wordpress: avoid changing nginx proxy template in apache-less variant 2025-08-04 16:50:52 +02:00
Peca
4dc1e73612 Remove redundant WP CLI installation checks from multiple scripts 2025-08-04 16:42:07 +02:00
Peca
8680995e66 Avoid 600 permissions for Apache-less variant 2025-08-04 15:19:22 +02:00
Peca
d18967e627 Refactor v-run-wp-cli to simplify WP CLI installation check by removing redundant file check for boot-fs.php 2025-08-04 11:07:07 +02:00
Peca
97548e55fb Removing temporary Docker container network interfaces from RRD 2025-08-03 15:06:13 +02:00
Peca
c1f2a02fb8 Implement cron job for fixing website permissions 2025-08-03 15:05:57 +02:00
Peca
cc09de9b6e v-fix-website-permissions: checks for php_chmod conf files 2025-08-01 19:46:28 +02:00
Peca
46a6ebafb0 Enhance v-commander to check for kernel updates and reboot requirements 2025-08-01 19:42:16 +02:00
Peca
48944af182 Update v-install-wp-cli-myvesta to set PHP version dynamically based on the oldest installed version and revert to the current version after installation 2025-07-30 18:30:43 +02:00
Peca
ef8d033b60 Enhance v-run-wp-cli and v-run-wp-cli-myvesta to check for file age and update if older than 30 days 2025-07-30 16:18:20 +02:00
Peca
95ed753b0b Separating v-install-wp-cli-myvesta. Update v-run-wp-cli to display error log if PHP Fatal Error occured. Updating v-run-wp-cli to use standard wp-cli, making v-run-wp-cli-myvesta for myvesta version of wp-cli. 2025-07-30 15:31:31 +02:00
Peca
35653eec54 Add WordFence CLI installation script 2025-07-26 22:00:22 +02:00
Peca
5fb7862b39 Replace direct calls to 'wp' with 'v-run-wp-cli' 2025-07-26 21:36:10 +02:00
Peca
d017fbbe07 v-fix-website-permissions: improve error messages for non-existent user and domain directories 2025-07-25 16:37:45 +02:00
Peca
4e8bac8dda v-update-firewall-rules: improve nginx configuration handling for deleting rules, as well as for suspended and unsuspended rules 2025-07-23 23:34:07 +02:00
Peca
30581ea672 v-change-wordpress-admin-passwords: enhance output messages for password change confirmation 2025-07-23 22:37:09 +02:00
Peca
77b6506bae v-update-deb-package: update completion message for Debian 13 2025-07-23 14:02:52 +02:00
Peca
b3758430c6 v-update-php-version: upgrade PHP to 8.4.10 and update download link; add additional dependencies for Debian 13 2025-07-22 16:30:23 +02:00
Peca
7799cd3322 v-update-deb-package: change target Debian version to 'trixie' and update dependencies for NGINX, OpenSSL, and Zlib 2025-07-22 14:22:48 +02:00
Peca
f64968ba91 v-change-wordpress-admin-passwords: add option to skip content reassignment during user deletion 2025-07-17 14:36:37 +02:00
Peca
9eade5a7df v-fix-wordpress-core: support for custom PHP version 2025-07-16 19:21:18 +02:00
Peca
a976a3bc3f v-change-database-password-for-wordpress: fixing a bug in temporary password storage 2025-07-16 18:01:53 +02:00
Peca
403dd65400 v-change-database-password-for-wordpress: enhance database name and user retrieval to support both single and double quotes in wp-config.php 2025-07-16 15:35:46 +02:00
Peca
3801e8d6cf v-delete-wordpress-uploads-php-files: set default response to 'yes' for moving files to quarantine 2025-07-16 13:58:25 +02:00
Peca
a5f2e6acd5 v-fix-website-permissions: exclude specific file types from permission changes to avoid altering 'Change' file attribute 2025-07-16 12:57:55 +02:00
Peca
29f030205e v-fix-website-permissions: exclude specific file types from permission changes to avoid altering 'Change' file attribute 2025-07-16 12:50:25 +02:00
Peca
b88f0e56bf New command: v-delete-wordpress-uploads-php-files 2025-07-15 18:44:02 +02:00
Peca
928bea0870 v-fix-website-permissions: only modify those that are not already set correctly 2025-07-15 17:48:08 +02:00
Peca
7191baa1c9 v-change-wordpress-admin-passwords: improve error handling 2025-07-15 13:53:20 +02:00
Peca
f16c7e4c3f New command: v-delete-inactive-wordpress-plugins-and-themes 2025-07-15 13:48:54 +02:00
Peca
ca9a939823 Refactor v-change-wordpress-admin-passwords to streamline admin list processing by using a here-string for input 2025-07-14 18:17:43 +02:00
Peca
1571d60b2f Update v-fix-website-permissions to allow dynamic php file permissions based on user-defined settings 2025-07-14 17:16:25 +02:00
Peca
98600537fc v-change-wordpress-admin-passwords: modified user deletion and password update commands to use user ID instead of username. 2025-07-14 16:32:21 +02:00
Peca
29236cfb03 Enhance proxy template selection in v-activate-rocket-nginx to include wprocket-webp-express-force-https option and update install script to download corresponding templates. 2025-07-13 22:16:46 +02:00
myvesta
2f8692bb21
Merge pull request #199 from lukapaunovic/patch-6
Create wprocket-webp-express-force-https.stpl
2025-07-13 22:02:11 +02:00
Luka Paunović
a48621a88e
Update wprocket-webp-express-force-https.stpl
rocket include must go bellow webp rules
2025-07-13 19:00:48 +02:00
Luka Paunović
7511baa628
Create wprocket-webp-express-force-https.tpl 2025-07-13 00:27:04 +02:00
Luka Paunović
59db959b9a
Update wprocket-webp-express-force-https.stpl 2025-07-13 00:26:08 +02:00
Luka Paunović
aa6263c0ac
Create wprocket-webp-express-force-https.stpl
WEBP Express NGINX support with Rocket-NGINX
2025-07-13 00:25:07 +02:00
Peca
cdf10aede1 v-change-wordpress-admin-passwords: enhance admin reassignment logic to handle default user selection 2025-07-12 14:46:14 +02:00
Peca
bf54a85a51 Added functions to check if a domain or user is unsuspended in main.sh 2025-07-11 16:37:09 +02:00
Peca
420a978572 v-install-wordpress: Support for IDN format domains 2025-07-11 11:41:28 +02:00
Peca
acc87125f0 v-change-wordpress-admin-passwords: ability to run v-run-wp-cli on choosen PHP version 2025-07-11 10:34:38 +02:00
Peca
54abc58c4e v-change-wordpress-admin-passwords: accept integer as id of user, support for custom php version 2025-07-10 17:49:15 +02:00
Peca
d20bc94866 v-fix-website-permissions: chown for .php and .env files 2025-07-01 10:03:32 +02:00
Peca
b8b75f0dde v-change-wordpress-admin-passwords 2025-06-30 00:11:44 +02:00
Peca
2fd60fc29d VERBOSE_MODE in v-run-wp-cli 2025-06-30 00:11:44 +02:00
Peca
1567383b49 v-run-wp-cli: Parameter 'PHP' to force specified PHP version 2025-06-28 16:49:18 +02:00
Peca
6cce5ecadd chmod .env files to 600 2025-06-26 22:26:14 +02:00
Peca
e8b5b5a836 v-update-document-errors-files 2025-06-26 18:05:11 +02:00
Peca
451c9944b9 v-fix-wordpress-core: move .user.ini 2025-06-25 17:32:23 +02:00
Peca
f77f8e8b78 $SKIP_OWNERSHIP_CHECK in v-fix-website-permissions, v-fix-wordpress-core 2025-06-24 17:30:20 +02:00
Peca
09465e5fba v-change-database-password-for-all-wordpress: first optional argument to specify a $user 2025-06-23 21:53:55 +02:00
Peca
5ee72684ab v-change-wordpress-admin-passwords: default = y 2025-06-23 15:55:28 +02:00
Peca
d37473b5e8 Using v-wp-cli in v-change-wordpress-admin-passwords 2025-06-22 23:56:46 +02:00
Peca
fd6eb44bae .gitignore: exclude data, conf, log 2025-06-22 22:45:19 +02:00
Peca
97e5fc0677 v-change-database-password-for-all-wordpress: Using existing password for $db_user 2025-06-21 17:56:57 +02:00
Peca
294c8ba516 Setting chmod 600 for all php files 2025-06-21 15:57:21 +02:00
Peca
761da8150b Visual improvements for v-change-wp-admins-pass 2025-06-20 17:54:04 +02:00
Peca
2e2b4b2f58 v-backup-user-now skip LA limit 2025-06-19 15:57:50 +02:00
Peca
e46c7e4e60 v-get-wp-cli and terminal $COLUMNS fix 2025-06-17 22:22:16 +02:00
Peca
b13b25602c Use wp-cli from git repo if available 2025-06-17 19:29:58 +02:00
Peca
c8f9601a35 v-fix-wp-core: BACKUP_DIR="$QUARANTINE_DIR/$DOMAIN/ 2025-06-17 15:56:56 +02:00
Peca
d1c48504ad v-run-wp-cli 2025-06-17 14:02:31 +02:00
Peca
596bce582f Jailing v-run-wp-cli 2025-06-17 11:43:48 +02:00
isscbta
31413a8f73
Update v-change-wp-admins-pass 2025-06-17 01:56:02 +02:00
isscbta
6ac6ea40d3
Update v-change-wp-admins-pass 2025-06-17 01:20:05 +02:00
isscbta
12dc1a5718
Update v-change-wp-admins-pass 2025-06-17 00:49:27 +02:00
isscbta
8a4b66a135
Update v-fix-wp-core 2025-06-17 00:42:19 +02:00
isscbta
a8e39817fc
Create v-desinfect-wp 2025-06-17 00:40:47 +02:00
isscbta
aa2f5e4fbb
Update v-fix-wp-core 2025-06-17 00:40:10 +02:00
isscbta
e8cbaa742f
Create v-change-wp-admins-pass 2025-06-17 00:23:04 +02:00
isscbta
59053e2ffd
Update v-fix-wp-core 2025-06-17 00:07:17 +02:00
isscbta
4f871db1fc Update v-fix-wp-core 2025-06-16 17:59:52 +02:00
isscbta
819450ca5c Create v-fix-wp-core 2025-06-16 17:59:52 +02:00
Peca
2fe4ce2ae4 v-change-db-password-to-wordpress 2025-06-16 17:59:11 +02:00
Peca
c5d0619a6b Check for SSL certificate existence before deleting web domain SSL in v-install-unsigned-ssl 2025-06-08 14:46:58 +02:00
Peca
413787070a Skip prompt to continue in vst-install-debian.sh if all required variables are set 2025-06-08 12:57:33 +02:00
Peca
6d752d93f5 Adding v-cd-www alias to root bash profile 2025-06-08 07:53:20 +02:00
Peca
85f39364a4 v-commander: stop setting a root password 2025-06-07 20:47:57 +02:00
Peca
0fd5be1d28 Activating FileManager licence for all users 2025-06-07 20:36:05 +02:00
Peca
89b7538fad Enhance package validation 2025-06-07 17:08:08 +02:00
Peca
8d9a3e1ca0 v-change-user-package switched to parse_object_kv_list_non_eval 2025-06-07 16:23:42 +02:00
Peca
4932dd3bb4 Fix dkim record deletion command in v-delete-mail-domain-dkim script 2025-06-07 14:53:49 +02:00
Peca
213ccd47df v-install-wordpress: Almost always use https 2025-06-04 11:25:33 +02:00
Peca
a3895aea0d v-clear-fail2ban 2025-06-02 15:16:33 +02:00
Peca
72252c561e Small bug fix in main.php 2025-06-01 20:25:23 +02:00
Peca
435a362765 Converting CRLF to LF in a few files 2025-06-01 14:44:18 +02:00
Peca
5ca293c9b2 Session DISABLE_IP_CHECK 2025-05-31 22:01:57 +02:00
Peca
92029a9733 v-import-cpanel-backup: /*!999999\- enable the sandbox mode */ fix 2025-05-30 22:08:44 +02:00
Peca
de5365280f Adding myVesta rules to SpamAssassin 2025-05-29 21:02:54 +02:00
myvesta
fa8dd64c5a Adding ProFTPD jail rule to Fail2Ban 2025-05-27 00:27:07 +02:00
ikheetjeff
ff7bc2baa5 Update edit_server.html 2025-05-26 09:39:29 +02:00
ikheetjeff
4c495a1d69 Update index.php 2025-05-26 09:39:29 +02:00
Peca
cb6e8e4926 nginx block-firewall.conf when user block 80,443 in Firewall 2025-05-26 09:39:29 +02:00
isscbta
451b025f1f Create v-delete-mails 2025-05-26 09:39:29 +02:00
myvesta
d3fb4e13d5 v-move-domain-and-database-to-account: Update wordfence-waf.php
Update v-move-domain-and-database-to-account

Update v-delete-web-domain: deleting /hdd/home/$user/web/$domain

Update v-delete-user: deleting /hdd/home/$user

Update v-delete-mail-domain: removing /hdd/home/$user/mail/$domain_idn

Update v-change-domain-owner: moving /hdd/home/$owner/web/$domain

Update v-change-domain-owner: moving /hdd/home/$owner/mail/$domain

Update v-move-folder-and-make-symlink: debug and additional checking
2025-05-26 09:39:29 +02:00
myvesta
83d12510e3 Update v-add-letsencrypt-domain: Detecting valid status on wildcard variant 2025-05-26 09:39:29 +02:00
myvesta
6dccbb8276 Update vst-install-debian.sh: mysql-apt-config_0.8.34-1_all.deb 2025-05-26 09:39:29 +02:00
myvesta
7388432261 parse_object_kv_list_non_eval() 2025-05-26 09:39:28 +02:00
myvesta
0d86e2ca40 Calculate size of directories on /hdd too 2025-05-26 09:39:28 +02:00
myvesta
8bdfade3d4 Update vst-install-debian.sh 2025-05-26 09:39:28 +02:00
myvesta
a86f76de09 Update db.sh - mysqldump --complete-insert --force --quick --single-transaction --max-allowed-packet=1024MB 2025-05-26 09:39:28 +02:00
myvesta
57f179ad05 When deleting a domain, also delete the database if the domain has a database. 2025-05-26 09:39:14 +02:00
myvesta
01e4890a97
Update multi-php-install.sh: Fixing disable_functions line 2025-03-31 16:41:43 +02:00
myvesta
4437f6f0da
Update v-move-folder-and-make-symlink 2025-03-19 16:25:04 +01:00
myvesta
24908aede1
Update v-move-folder-and-make-symlink 2025-03-19 16:22:54 +01:00
myvesta
dc1979461e
Update v-make-main-apache-log 2025-03-11 00:18:05 +01:00
myvesta
039dc4a561
SpamHaus DNSBL removed from exim4 2025-02-27 22:51:44 +01:00
myvesta
32aae7dbff
Update multi-php-install.sh: bringing back php8.4-memcached & imagick 2025-02-20 14:02:27 +01:00
myvesta
1573a33b75
Update v-clone-website: mysqldump --max_allowed_packet=1024M 2025-02-10 15:51:42 +01:00
myvesta
7937088e9c
Update index.php: Prevent recreation of token by shitty browser add-ons 2025-01-03 18:09:06 +01:00
myvesta
c5e5464373
Update v-restore-user: permissions fix 2025-01-03 17:16:07 +01:00
myvesta
c1072ec9e4
Update v-clone-website 2024-12-13 11:34:12 +01:00
myvesta
0e881c911b
Update v-update-firewall - skip CentOS block 2024-12-05 15:46:47 +01:00
myvesta
9fdfe2760a
Update v-change-dir-www 2024-12-03 15:50:07 +01:00
myvesta
2daa635cde
Update v-change-dir-www 2024-12-03 11:47:21 +01:00
myvesta
0639e7765f
Update vst-install-debian.sh 2024-12-02 18:52:53 +01:00
myvesta
3337783666
v-cd-www alias 2024-12-02 18:35:57 +01:00
isscbta
82803093d6
Update v-cd-www 2024-11-27 14:07:40 +01:00
isscbta
2e66899997
Create v-cd-www 2024-11-27 14:06:50 +01:00
isscbta
62b0e672a6
Create v-whitelist-email-account 2024-11-27 14:05:50 +01:00
isscbta
92ddd343a2
Create v-whitelist-email-domain 2024-11-27 14:05:30 +01:00
isscbta
aa92b6a270
Create v-blacklist-email-account 2024-11-27 14:05:07 +01:00
isscbta
00ef25524d
Create v-blacklist-email-domain 2024-11-27 14:04:37 +01:00
myvesta
af8c071944
Update v-clean-garbage 2024-11-25 11:25:22 +01:00
myvesta
6a35d14f0c
Update v-add-firewall-ban: nginx deny rules conf 2024-11-19 21:59:09 +01:00
myvesta
015b3c4571
nginx deny rules conf 2024-11-19 15:17:29 +01:00
myvesta
a2ed0dbf7a
Update v-make-separated-ip-for-email 2024-11-18 18:03:53 +01:00
myvesta
74fecc45d3
Update v-add-srs-support-to-exim 2024-11-18 18:02:05 +01:00
myvesta
0f71df9a95
Create exim4.conf.template.without-srs 2024-11-18 16:59:43 +01:00
myvesta
15b5996e4f
Update v-make-separated-ip-for-email 2024-11-18 16:56:10 +01:00
myvesta
8c477c39bf
Update v-add-srs-support-to-exim: Block execution in Exim < 4.96 2024-11-18 16:49:14 +01:00
myvesta
a7d7c3686c
Update v-add-srs-support-to-exim: compatibility for Debian < 12 2024-11-18 14:26:36 +01:00
myvesta
2cbf37e4d1
Temporarily disabling php8.4-memcache, memcached, imagick 2024-11-15 16:40:57 +01:00
myvesta
e8c912513d
Support for PHP 8.4 2024-11-15 16:19:52 +01:00
myvesta
5e9cf711e6
Add some loops due to 403 errors durring LE request in some random cases
Credits to HestiaCP - https://github.com/hestiacp/hestiacp/pull/4622
2024-11-11 19:43:49 +01:00
myvesta
de2305b3ff
Update vst-install-debian.sh 2024-11-11 18:36:32 +01:00
myvesta
60ce986ece
Update v-add-srs-support-to-exim 2024-11-11 18:11:14 +01:00
myvesta
5eb0607319
Update exim4.conf.template - avoid ACL error
failed to expand ACL string "${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}{true}{false}}": failed to open /etc/exim4/domains//aliases for linear search: No such file or directory
2024-11-10 18:23:52 +01:00
myvesta
f5027aff5d
Update v-clean-garbage 2024-11-10 18:03:09 +01:00
myvesta
46d2a729a1
Update v-clean-garbage 2024-11-10 17:22:47 +01:00
myvesta
24d84de6d2
Update v-fix-php-ini-disable-functions 2024-11-08 23:58:05 +01:00
myvesta
89fc5a1ebd
SRS support for Exim4 2024-11-08 18:07:38 +01:00
myvesta
afc6b62d5c
v-fix-php-ini-disable-dunctions exclude patching 2024-10-25 20:57:20 +02:00
myvesta
da84a0b913
v-fix-php-ini-disable-functions 2024-10-25 18:08:09 +02:00
myvesta
24371b8bbf
Update v-clone-website: adding --EXCLUDE_UPLOADS parameter 2024-10-18 22:12:23 +02:00
myvesta
acfc563a6c
Logging apache pid in v-make-main-apache-log 2024-10-14 17:51:26 +02:00
myvesta
e79acf1828
v-make-main-apache-log 2024-10-07 20:04:46 +02:00
myvesta
76ad95da64
Update vst-install-debian.sh - removing phppgadmin 2024-09-26 20:00:41 +02:00
isscbta
c148a1ed79
Create v-get-dns-config 2024-09-19 19:01:21 +02:00
isscbta
c32bd2c709
Generate random root password instead of using admin password 2024-09-19 17:32:22 +02:00
myvesta
3ed2cfa07b
Removing whitespace in php patch 2024-09-18 18:37:34 +03:00
myvesta
a99ae91c21
Update v-update-firewall: $FIREWALL_STATEFUL conf variable 2024-09-02 20:22:56 +02:00
myvesta
b9f89d0416
Update v-make-separated-ip-for-email - fix for deb 10 and 11 2024-08-23 15:54:57 +02:00
myvesta
7dcaaace8a
Merge pull request #181 from ikheetjeff/disable-root-login-phpmyadmin
disable root login phpmyadmin
2024-08-15 10:24:47 +02:00
myvesta
138f41c145
Merge pull request #180 from ikheetjeff/fix-db-mail
Fix db.sh + rebuild.sh mailadres & subject
2024-08-15 10:22:47 +02:00
myvesta
6e7954db55
Fixing Issue #185 2024-08-15 10:19:34 +02:00
myvesta
1ee4920576
Update multi-php-install.sh 2024-08-13 13:49:46 +02:00
myvesta
574fff0642
Update multi-php-install.sh - removing buster sury repo 2024-08-13 13:44:30 +02:00
myvesta
7ff828bf14
Update v-import-cpanel-backup - removing /*!999999\- enable the sandbox mode */ 2024-08-12 12:45:58 +02:00
isscbta
c1f7c91953
Added support for PHP 8.3 2024-08-07 13:55:33 +02:00
myvesta
7fa725b893
Update Changelog.md 2024-05-30 19:35:12 +02:00
myvesta
72baf4c702
Version 0.9.9-0-11 2024-05-30 17:29:18 +02:00
myvesta
edf1f616b2
Update v-run-wp-cli: removing --skip-plugins and --skip-themes 2024-05-30 17:23:43 +02:00
isscbta
357b20cc52
Rename v-run-wpcli to v-run-wp-cli 2024-05-30 17:01:39 +02:00
myvesta
30fb3d6a6c
Update v-delete-user: rm -rf /hdd/home/$user 2024-05-30 15:05:43 +02:00
myvesta
d59c4fafe2
Update v-run-wpcli to use $phpver 2024-05-30 14:11:17 +02:00
myvesta
67b8376608
Update v-add-wordpress-admin to use $phpver 2024-05-30 14:02:52 +02:00
myvesta
6a72798aba
Update v-clone-website to use $phpver 2024-05-30 13:55:10 +02:00
myvesta
8a8422539c
Update v-migrate-site-to-https to use $phpver 2024-05-30 13:52:46 +02:00
myvesta
7a13c03e9a
Update v-migrate-site-to-https to use $phpver 2024-05-30 13:48:11 +02:00
myvesta
a8435cab14
hosting-firewall-wordpress-2 2024-05-30 12:37:26 +02:00
myvesta
f99bcf8746
Update v-migrate-site-to-https 2024-05-30 09:19:22 +02:00
myvesta
c3985ba95e
Create v-backup-user-now 2024-05-23 15:26:39 +02:00
myvesta
21f7a509cb
nginx nodejs tpl CRLF to LF 2024-05-23 14:38:21 +02:00
myvesta
75ffd02ff9
nodejs tpl fix 2024-05-23 14:16:53 +02:00
isscbta
e51cd34f77
Update v-add-wordpress-admin 2024-05-22 17:51:42 +02:00
isscbta
abc2377dad
Update v-run-wpcli 2024-05-22 17:50:50 +02:00
isscbta
9cf91d5535
Create v-add-wordpress-admin 2024-05-22 17:49:54 +02:00
isscbta
491ac6255c
Create v-run-wpcli 2024-05-22 17:49:06 +02:00
myvesta
81f507b3c4
nodejs templates ssl fix 2024-05-16 12:15:20 +02:00
myvesta
763eea5c58
Update install-new-roundcube.sh - version 1.6.6 2024-05-15 19:42:42 +02:00
ikheetjeff
806ebf1db6
disable root login phpmyadmin 2024-05-05 21:21:32 +02:00
ikheetjeff
4acfa26de5
Fix emailadres and subject 2024-05-05 20:28:31 +02:00
ikheetjeff
66ae5580cd
Fix mailadress and subject 2024-05-05 20:28:05 +02:00
myvesta
dcd0bf2d64
Update v-clone-website: wp-cli to use proper php version 2024-04-24 13:56:28 +02:00
myvesta
05f5288d9b
Update v-clone-website: --skip-plugins --skip-themes 2024-04-24 13:14:36 +02:00
myvesta
65d4f0e65e
deb12 exim4: message_linelength_limit = 1G
Preventing exim4 error: message has lines too long for transport
2024-04-19 09:12:57 +02:00
myvesta
9b0f9e5876
Version 0.9.9-0-10 2024-04-11 20:55:41 +02:00
myvesta
cc3437c287
v-edit-php return fix 2024-04-11 20:50:26 +02:00
myvesta
9d65824606
v-edit-php tuning 2024-04-11 20:41:56 +02:00
isscbta
6514ea1d38
Create v-edit-php-ini 2024-04-11 15:43:41 +02:00
isscbta
f540cf9f2a
Update v-edit-domain-php-ini 2024-04-11 12:18:39 +02:00
isscbta
40afd5b5c8
Create v-edit-domain-php-ini 2024-04-09 16:44:05 +02:00
myvesta
929241c5f7
Version 0.9.9-0-9 2024-04-05 20:10:05 +02:00
myvesta
583a1e5cc7
Update v-commander 2024-04-05 19:56:50 +02:00
myvesta
63c4826ac0
Update v-commander 2024-04-05 15:22:20 +02:00
myvesta
8cc35b43eb
Update header.html 2024-04-04 15:08:14 +02:00
myvesta
dd825b96cb
Update latest.txt - 0.9.9-0-8 2024-04-04 14:55:48 +02:00
myvesta
5acdfb6158
Merge pull request #175 from VasilisParaschos/174-banned-ip-quick-info
Get quick info about a banned IP (Host, Banlist, Location)
2024-04-04 14:52:45 +02:00
myvesta
55e0fcb5de
Update v-clean-garbage: restart exim4 2024-04-04 14:48:56 +02:00
myvesta
20695198f4
tpl CRLF to LF 2024-03-29 17:17:22 +01:00
myvesta
dd18d6dd6d
Blocking xmlrpc.php and wp-config.php in nginx-rate-limit templatre for WP 2024-03-29 14:51:56 +01:00
myvesta
fa165a0020
Update v-fix-user-permissions 2024-03-14 20:24:47 +01:00
myvesta
0ae1ea6adc
Update v-commander 2024-03-08 17:22:18 +01:00
myvesta
e6bf09c608
Update v-commander 2024-03-08 16:48:48 +01:00
myvesta
138a30755f
Update v-commander 2024-03-08 16:43:05 +01:00
myvesta
6819f21c3e
Update v-commander 2024-03-08 15:49:33 +01:00
myvesta
a7def7b190
Changelog 2024-02-27 13:10:58 +01:00
myvesta
7e209c543d
Update v-backup-users
Prevent removing valid licenses when vestacp.com is offline.
Licences are free now - https://forum.myvestacp.com/viewtopic.php?t=949
2024-02-27 13:05:59 +01:00
myvesta
2aca86432f
imapsync tools 2024-02-08 21:26:03 +01:00
vaspar
edfea0d259 Get quick info about a banned IP (Host, Banlist, Location) 2024-02-02 16:36:40 +02:00
myvesta
560fa67c4b
v-list-php-apache 2024-01-26 23:36:51 +01:00
myvesta
db7e663c2c
Update v-list-php 2024-01-26 22:56:37 +01:00
myvesta
11ab872123
Update v-list-php 2024-01-24 16:17:11 +01:00
myvesta
7274147d36
v-list-php 2024-01-24 16:14:14 +01:00
myvesta
22463fd0f1
Update Changelog.md to 0.9.9-0-6 2024-01-22 18:47:27 +01:00
myvesta
e9317fc0ae
Update latest.txt to 0.9.9-0-6 2024-01-22 18:44:18 +01:00
myvesta
834fcfcf12
php8.3 fpm www.conf 2024-01-22 18:42:14 +01:00
myvesta
a43eef9c9b
Updating WAF path in v-clone-website 2024-01-15 18:06:36 +01:00
isscbta
cf1eacde1d
Update Wordfence WAF Path 2024-01-15 17:52:06 +01:00
isscbta
b0b3a9403f
Update Wordfence WAF Path 2024-01-15 17:08:52 +01:00
myvesta
003f35810b
Update v-fix-website-permissions 2024-01-08 09:49:04 +01:00
myvesta
1a6562eb87
Update v-fix-website-permissions 2024-01-08 09:43:54 +01:00
myvesta
f400b401d2
Update v-fix-website-permissions 2024-01-08 09:41:12 +01:00
myvesta
ecf419cb88
Update v-fix-website-permissions 2024-01-08 09:39:24 +01:00
myvesta
bdde36d4e3
Update v-fix-website-permissions 2024-01-08 09:34:57 +01:00
myvesta
c3720e5d5e
Fixing typo in secure_login.php
Thanks to @gathlete - https://forum.myvestacp.com/viewtopic.php?t=928
2024-01-07 23:47:44 +01:00
myvesta
add9c5c5e7
php8.3 installer fix 2024-01-07 22:36:29 +01:00
myvesta
8ef3fb0357
PHP 8.3 support 2024-01-07 22:35:06 +01:00
myvesta
08d0db0c6f
php8.3 templetes typo fix 2024-01-07 22:19:17 +01:00
myvesta
db6ba149c6
Apache templates for PHP 8.3 2024-01-07 22:16:40 +01:00
myvesta
942b46a657
v-php-func takes STDIN only if --stdin parameter is passed 2024-01-07 21:51:00 +01:00
isscbta
a55b160103
Added: Email rate limit 2024-01-06 11:39:49 +01:00
isscbta
5e72ead3b3
Create v-fix-website-permissions 2024-01-03 19:19:47 +01:00
myvesta
f39dc8edce
Update multi-php-install.sh 2023-12-28 21:42:09 +01:00
myvesta
f344c0b1d5
Update multi-php-install.sh 2023-12-28 21:22:34 +01:00
myvesta
6800013edb
Update v-commander 2023-12-28 21:21:31 +01:00
myvesta
cecb7cf56a
Update multi-php-install.sh 2023-12-28 21:15:39 +01:00
myvesta
e1053b1c9a
Update multi-php-install.sh: upgrading tailf_apache_error.php 2023-12-28 20:26:36 +01:00
myvesta
0beaa0abda
Update multi-php-install.sh: install phpgate 2023-12-28 20:11:10 +01:00
isscbta
fa71d3a1c6
Update Wordfence WAF Path 2023-12-28 16:01:34 +01:00
isscbta
91f6ae080a
Update Wordfence WAF Path 2023-12-28 16:01:09 +01:00
myvesta
328f6f293c
Disable hosts_try_fastopen for all hosts 2023-12-20 21:23:34 +01:00
myvesta
f4beb1c8f1
Update vst-install-debian.sh, MAX_DBUSER_LEN=80 2023-12-11 11:48:32 +01:00
myvesta
c4eb89e4fd
Update install-rocket-nginx.sh 2023-11-25 11:41:04 +01:00
myvesta
25749e8025
Update fix-fpm-poold.sh 2023-11-17 10:06:42 +01:00
myvesta
5e3473f90d
Merge pull request #169 from lukapaunovic/patch-5
Create wp-super-cache.stpl
2023-11-12 20:55:08 +01:00
myvesta
65aa97de82
Merge pull request #168 from lukapaunovic/patch-4
Create wp-super-cache.tpl
2023-11-12 20:54:49 +01:00
Luka Paunović
9985fcbea5
Create wp-super-cache.stpl 2023-11-12 19:45:58 +01:00
Luka Paunović
fc05c65359
Create wp-super-cache.tpl 2023-11-12 19:45:02 +01:00
myvesta
fff40883dd
webp smush nginx template 2023-11-12 19:18:00 +01:00
myvesta
562ad763dd
v-commander: install nginx-rate-limit templates 2023-11-05 15:25:01 +01:00
myvesta
7993d50276
v-install-wordpress to put force-https-firewall-wordpress nginx template 2023-11-05 15:17:34 +01:00
myvesta
803cde4c89
CRLF to LF for nginx-rate-.limit templates for WordPresd 2023-11-03 17:08:22 +01:00
myvesta
5e525f8898
nginx rate limit fixes for http:// templates 2023-11-02 14:27:15 +01:00
myvesta
88f52ec9a4
Adding limit_conn zone_site 15; to wordpress tpl 2023-11-02 11:33:19 +01:00
myvesta
3d8880e559
Rotating places for limit_conn_zone 2023-11-02 11:08:13 +01:00
myvesta
911dc91268
Fix message: Added rate_limit 'wfone' to nginx.conf 2023-11-02 11:03:54 +01:00
myvesta
c87de2631b
Fix to download force-https-firewall-wordpress.stpl 2023-11-02 11:01:03 +01:00
myvesta
bfdefc50e3
nginx rate-limit improvements 2023-11-02 10:47:51 +01:00
myvesta
2f0807e8ee
Update v-commander: redis installer conf fix 2023-10-18 14:46:55 +02:00
myvesta
946a1953d9
v-update-mail-domains-disk - even mail account is symlinked 2023-10-13 11:56:50 +02:00
myvesta
bf8411fa08
Update latest.txt: version 0.9.9-0-5 2023-10-08 16:56:38 +02:00
myvesta
3f3cfece06
Update Changelog.md 2023-10-08 16:55:33 +02:00
myvesta
8748ffc85b
Update v-suspend-web-domain 2023-10-08 16:45:13 +02:00
myvesta
a4acb57e54
Fixing removing certificates during apache reload
v-suspend-web-domain on line 49 is triggering apache/nginx reload... that is doing it in the background... and on line 64, we were previously doing 'mv' for certificates... 
If the reload lasts too long it in the background, certificates will vanish because of 'mv' on line 64.
This fix will avoid this collision by doing 'cp' instead of 'mv', then sleeping for 10 sec, and then removing certificates.
We will call this bug "Nemanja Puhalo's bug" because he hit this bug first.
2023-10-08 16:28:08 +02:00
myvesta
1848c36784
Update v-suspend-web-domain, allowing restart=no 2023-10-08 15:45:34 +02:00
myvesta
af7b658bfb
v-restart-web: systemctl instead of service 2023-10-08 15:33:46 +02:00
myvesta
9c233e92a6
v-restart-web: systemctl instead of service 2023-10-08 15:21:43 +02:00
myvesta
fd57420a70
Delete current SSL before v-install-unsigned-ssl 2023-10-08 13:28:52 +02:00
isscbta
baa93199e8
Update README.md 2023-10-06 11:35:11 +02:00
myvesta
5fb32ef55f
Delete pool.d conf file for all PHP versions 2023-10-04 14:56:19 +02:00
myvesta
1099b0c267
Update install_rate_limit_tpl.sh 2023-10-04 11:34:09 +02:00
myvesta
b5d57baa29
Update vst-install-debian.sh 2023-10-03 10:47:40 +02:00
myvesta
64fa7d9e58
Update exim4.conf.template 2023-10-01 15:12:40 +02:00
myvesta
e1fe2ba094
Patching exim4.conf for: Helo name contains a ip address 2023-10-01 15:07:43 +02:00
myvesta
85bbc56cbd
Update v-make-separated-ip-for-email 2023-10-01 14:55:49 +02:00
myvesta
3d503f4e14
Update v-clean-garbage 2023-10-01 14:19:41 +02:00
myvesta
33e6263e3d
Update v-clean-garbage 2023-10-01 00:32:27 +02:00
myvesta
8a323f6447
Update v-clean-garbage 2023-09-30 15:23:27 +02:00
myvesta
c8fcc089a7
Clean /home/*/tmp/ in v-clean-garbage 2023-09-30 15:20:47 +02:00
myvesta
98d8ab7f29
v-list-sys-services: detection for official mariadb repo installation 2023-09-27 09:32:23 +02:00
myvesta
1709e9ae3d
Disabling SpamAssassin on Deb12 2023-09-24 16:58:29 +02:00
myvesta
39a4dffbce
Check if source user is suspended 2023-09-16 01:20:19 +02:00
myvesta
c43b3b0976
Check if source user is suspended 2023-09-16 01:11:30 +02:00
myvesta
06527b4d49
Update postinst 2023-09-15 01:12:08 +02:00
myvesta
022f3078f5
Fixing 'dh key too small' in dovecot 2023-09-06 14:45:40 +02:00
myvesta
8d467b98ab
Muting some unnecessary cleaning errors 2023-08-23 14:39:44 +02:00
myvesta
34c0588b76
ignoring nohup messages 2023-08-23 14:05:26 +02:00
myvesta
b80a975621
Muting some unnecessary cleaning errors 2023-08-23 11:37:04 +02:00
myvesta
c32036e531
Handling tailf watcher processes in v-clean-garbage 2023-08-23 11:23:57 +02:00
myvesta
658680095b
http2 typo 2023-08-18 20:52:13 +02:00
myvesta
bb79f9f8c0
deb12 nginx http2 on; 2023-08-18 20:50:20 +02:00
myvesta
0213d749ee
Update exim_forwarding.patch 2023-08-11 14:03:16 +02:00
myvesta
cb52ef65b4
postinst removing tabs indent 2023-08-09 20:14:34 +02:00
myvesta
4d7ce60f39
deb12 fixes in postinst 2023-08-09 20:11:40 +02:00
myvesta
e82378c935
v-grep LF ending 2023-08-09 15:45:37 +02:00
myvesta
843d4a94e2
Update install_rate_limit_tpl.sh 2023-08-08 15:41:25 +02:00
myvesta
5d2f0d68e0
Removing sury repo from multi-php-install.sh for Debian 8 and 9 2023-07-29 14:40:19 +02:00
myvesta
12d6e59a7e
Update v-import-cpanel-backup 2023-07-27 14:50:16 +02:00
myvesta
7ee011a9d3
Update v-import-cpanel-backup 2023-07-27 14:41:38 +02:00
myvesta
ef5ef95194
get deb12 exim conf 2023-06-28 15:22:05 +02:00
myvesta
dc8abe95f0
Update list_user.html - coffee typo 2023-06-27 18:58:52 +02:00
myvesta
12c65839c2
Update Changelog.md 2023-06-27 15:28:36 +02:00
myvesta
d4f0baa4ad
Update Changelog.md 2023-06-27 15:24:58 +02:00
myvesta
9290ba6071
Version 0.9.9-0-4 2023-06-27 15:22:30 +02:00
myvesta
e095751b8b
Update barracuda.cf - correcting scores 2023-06-27 13:09:12 +02:00
myvesta
fb3e1e52e0
Update barracuda.cf 2023-06-27 12:20:28 +02:00
myvesta
a6eedcc6a9
Creating spamassassin /nonexistent folder 2023-06-26 22:00:46 +02:00
myvesta
ac98e1d9aa
Patching spamassassin dns_server 2023-06-26 21:52:43 +02:00
myvesta
c41a540494
Update install-new-roundcube.sh 2023-06-26 14:45:37 +02:00
myvesta
473277dd29
Update install-new-roundcube.sh - deleting filter plugin 2023-06-26 14:39:45 +02:00
myvesta
d41ca32761
Update install-new-roundcube.sh 1.6.1 2023-06-26 10:21:16 +02:00
myvesta
ebd100521f
Temporary ProFTPD fix for Debian12 2023-06-26 00:01:52 +02:00
myvesta
fdff356aa7
Switching signing apt key to "gpg --dearmor" 2023-06-25 23:50:21 +02:00
myvesta
b3336ba630
Update exim4.conf.template-RC deb11 2023-06-19 00:14:37 +02:00
myvesta
82956ffa9e
Setting up rsyslog for deb12 2023-06-18 22:00:38 +02:00
myvesta
1d89e935e1
Update exim4.conf.template 2023-06-18 19:13:09 +02:00
myvesta
599ce37116
exim4 fix for Tainted filename for search for aliases 2023-06-18 19:11:55 +02:00
myvesta
93a6d0b6e9
deb12 fail2ban auth.log fix 2023-06-17 23:00:40 +02:00
myvesta
ce5fac9b07
deb12 nginx listen ssl 2023-06-17 20:49:36 +02:00
myvesta
c74dfde170
deb12 exim4 smtputf8_advertise_hosts 2023-06-17 19:01:26 +02:00
myvesta
d52e27cc05
deb12 install rsyslog 2023-06-17 18:50:27 +02:00
myvesta
a6fdb87f7d
v-list-sys-services deb12 mariadb detection fix 2023-06-17 18:24:33 +02:00
myvesta
b535c863d6
deb12 spamd install 2023-06-17 18:12:35 +02:00
myvesta
89c86b84fd
deb12 new exim4 conf 2023-06-17 18:03:49 +02:00
myvesta
83092b8ac8
Fix for deb12 xxd install and php8.2 in default package 2023-06-17 17:51:26 +02:00
myvesta
159755e053
deb12 spamassassin temporary fix 2023-06-17 16:25:06 +02:00
myvesta
58c2793e94
vesta-nginx-deb12 conf fix 2023-06-17 15:59:47 +02:00
myvesta
420c0d097f
Reverting mistakenly changed 7.4 to 8.2 for deb12 2023-06-17 15:23:15 +02:00
myvesta
f332227588
v-install-unsigned-ssl deb12 fix 2023-06-17 15:11:30 +02:00
myvesta
f6cb92c20a
Debian12 installer script, first fix 2023-06-17 15:09:34 +02:00
myvesta
698069d708 Making php8.2 templates executable 2023-06-17 14:49:42 +02:00
myvesta
af61d62c47
debian12 php8.2 templates 2023-06-17 14:46:05 +02:00
myvesta
b5ccfbed82
debian12 vesta_compile.sh fixes 2023-06-16 23:10:48 +02:00
myvesta
b421b5f3b6
Version 0.9.9-0-3 2023-06-16 21:31:59 +02:00
myvesta
21071f4d7a
Fix for Grammarly Addon conflict 2023-06-16 21:26:22 +02:00
myvesta
90fddaa436
Update Changelog.md 2023-06-12 16:32:08 +02:00
myvesta
ef368b644b
Version 0.9.9-0-2 2023-06-12 16:29:24 +02:00
myvesta
6e88a26d4d
Few buttons decorated 2023-06-12 16:28:15 +02:00
myvesta
db6360922f
UI performance fix 5 2023-06-12 15:38:39 +02:00
myvesta
83acec3ec1
UI performance fix 4 2023-06-12 10:04:56 +02:00
myvesta
83649defc9
deleting styles.fix.css
it's merged with styles.min.css
2023-06-12 00:11:44 +02:00
myvesta
83e24f738a
Update list_backup_detail.html 2023-06-12 00:03:27 +02:00
myvesta
6921a58418
UI performance fix 3 2023-06-11 23:53:43 +02:00
myvesta
8fd8e33c3f
Update styles.fix.css 2023-06-10 22:47:04 +02:00
myvesta
5cbbbbcb06
right sidebar list 15 last logs 2023-06-10 22:42:12 +02:00
myvesta
9c9c06c2dc
Frontend UI performance fix 2 2023-06-10 22:39:49 +02:00
myvesta
bae14b2180
Frontend UI performance fix 2023-06-10 17:25:51 +02:00
myvesta
04070b4270
Merge pull request #159 from jaapmarcus/update-compile
Update urls due to moved download locations
2023-06-08 10:15:07 +02:00
Jaap Marcus
d9a68455a8
Update urls due to moved download locations
Update names


Fix pcre url


Please not configs are not tested


Revert changes
2023-06-07 22:59:31 +02:00
myvesta
7875aaf58e
Update list_backup_detail.html 2023-06-05 10:24:27 +02:00
myvesta
0a5faad911
Update latest.txt 2023-06-05 10:05:18 +02:00
myvesta
b41131f7ba
backup details css fix 2023-06-05 10:04:25 +02:00
myvesta
eccd4a99ba
Update styles.fix.css 2023-06-04 23:28:07 +02:00
myvesta
1120629026
Update latest.txt - version 0.9.9-0 2023-06-04 23:20:13 +02:00
myvesta
4683c08e1b
Update Changelog.md 2023-06-04 23:17:38 +02:00
myvesta
b670feea43
Removing smtputf8_advertise_hosts from Deb 9 and 10 2023-06-04 22:21:06 +02:00
myvesta
fcdd2a552c
smtputf8_advertise_hosts patch fix 2 2023-06-04 22:12:08 +02:00
myvesta
bf56cdc40f
smtputf8_advertise_hosts patch fix 2023-06-04 22:03:41 +02:00
myvesta
39745fd25a
Update styles.min.css, new sprite.png query number 2023-06-04 21:54:20 +02:00
myvesta
ecb988d2eb
sprite.png fix 2023-06-04 21:10:05 +02:00
myvesta
cd6c585641
Update styles.fix.css 2023-06-04 20:45:13 +02:00
myvesta
524a3a592b
Update styles.fix.css 2023-06-04 20:36:32 +02:00
myvesta
ff61a26f69
Update styles.fix.css 2023-06-04 20:25:37 +02:00
myvesta
2a3de783ae
Update scripts.html, correcting 'Log' label 2023-06-04 19:57:07 +02:00
myvesta
8bead4afaa
Update styles.fix.css 2023-06-04 19:50:39 +02:00
myvesta
c3d0c17c51
Redesign of hosting panel 2023-06-04 17:56:44 +02:00
myvesta
2afbc2cddf
Patching exim4.conf for: smtputf8_advertise_hosts 2023-06-04 16:41:08 +02:00
myvesta
ec8e174158
Update README.md, fixing < char 2023-05-27 19:03:41 +02:00
myvesta
c2511876c2
--retry-connrefused exception for Debian8 2023-05-02 12:59:16 +02:00
myvesta
22d524cfce
apache templates -FollowSymLinks +SymLinksIfOwnerMatch 2023-04-30 15:15:43 +02:00
myvesta
ae45e4a571
simplifying php code 2023-04-16 00:10:54 +02:00
myvesta
502acb44c0
v-grep and v-sed 2023-04-15 19:03:11 +02:00
myvesta
075c5e231b
MYVESTA_QUIET as export variable 2023-04-15 18:51:15 +02:00
myvesta
3fbb3dad78
myvesta php replacement for gnu 'sed' (but without regular expression) 2023-04-15 16:38:53 +02:00
myvesta
b01da84b15
correction for main.php 2023-04-15 15:53:21 +02:00
myvesta
888db2bc72
myvesta php replacement for gnu 'grep' (but without regular expression) 2023-04-15 15:50:27 +02:00
myvesta
2f37124545
simplifying php str functions 2023-04-14 19:01:07 +02:00
myvesta
c5144bcbae
v-php-func str_find quiet 2023-04-14 16:47:42 +02:00
myvesta
452f8a81d9
php myvesta_str_substring 2023-04-14 16:21:00 +02:00
myvesta
4dd6d22f07
myvesta-php-func support for stdin 2023-04-14 15:39:33 +02:00
myvesta
77467eeebd
exim4 HELO authenticated patch 2023-04-12 19:58:32 +02:00
myvesta
706e365a5e
syntax fix 2023-04-09 14:01:18 +02:00
isscbta
2fae00ae7d
Update v-clone-website 2023-04-09 00:22:04 +02:00
isscbta
e2fcade5bb
Update v-clone-website 2023-04-09 00:17:27 +02:00
isscbta
8dbfa3e210
Update README.md 2023-04-07 13:53:10 +02:00
isscbta
0e16d8d59c
Update README.md 2023-04-07 13:50:17 +02:00
isscbta
f0a82f02d3
Update README.md 2023-04-07 13:50:02 +02:00
isscbta
e86585568d
Update README.md 2023-04-07 13:44:53 +02:00
isscbta
5eabdd4784
Update README.md 2023-04-07 13:41:06 +02:00
isscbta
863f3e2aa5
Update README.md 2023-04-07 13:40:23 +02:00
myvesta
0b7b8cef85
Version 0.9.8-26-62 2023-04-06 11:14:44 +02:00
myvesta
7a3fc4fcea
Update Changelog.md 2023-04-06 11:13:17 +02:00
myvesta
f3211b7804
Merge pull request #157 from jaapmarcus/fix-update-certificate-changess
Fix: Changes in Certificate request Lets Encrypt
2023-04-06 11:07:39 +02:00
myvesta
b21efb09b6
Adding user-agent in v-add-letsencrypt-user 2023-04-06 10:28:44 +02:00
myvesta
fbf1d3390a
Checking for $nonce before step 7, and check for $certificate after step 7 2023-04-06 10:24:54 +02:00
myvesta
1056cd624b
Adding LE_STAGING to v-add-letsencrypt-user 2023-04-06 10:00:57 +02:00
myvesta
a18ee316a2
$LE_API to $API 2023-04-06 09:56:18 +02:00
myvesta
f50a785fff
Changing user-agent in v-add-letsencrypt-domain 2023-04-06 09:10:50 +02:00
myvesta
2f395f0a5e
Add staging 2023-04-06 09:06:03 +02:00
Jaap Marcus
4771d2502c
Fix: Changes in Certificate request Lets Encrypt
See: https://community.letsencrypt.org/t/myvesta-hestiacp-vestacp-fail-issuance-with-async-finalization/195923

And https://github.com/hestiacp/hestiacp/pull/3442

Not tested on Vesta CP
❤️
2023-04-06 01:23:10 +02:00
myvesta
f5132329c8
Update Changelog.md 2023-04-05 23:13:38 +02:00
myvesta
a098a9831c
Update Changelog.md 2023-04-05 21:10:28 +02:00
myvesta
cdde300f80
Version 0.9.8-26-61 2023-04-05 21:08:38 +02:00
myvesta
ec1c2146a1
LetsEncrypt check if 'certificate' is empty on step 6 2023-04-05 21:07:11 +02:00
myvesta
3bafc5b064
myvesta_echo php function 2023-04-01 23:29:35 +02:00
myvesta
a47603156d
Update exim_forwarding.patch 2023-03-29 15:48:42 +02:00
isscbta
551df0b5a6 Update v-clean-garbage 2023-03-29 15:45:36 +02:00
isscbta
a792f42ffd Security Improvements 2023-03-28 17:07:52 +02:00
myvesta
b1a3b88877
new line on the output end if v-php-func called directly from shell 2023-03-28 10:39:38 +02:00
myvesta
da136faf08
php function "find_in_file" 2023-03-26 19:04:45 +02:00
myvesta
4563f02f0f
Strip 'BROWSER MEDIA CACHE' block in rocket-nginx conf 2023-03-26 15:11:50 +02:00
myvesta
201cdad4b3
exit with brackets fix 2023-03-26 15:06:22 +02:00
myvesta
3192243fb4
tabs fix 2023-03-26 15:01:52 +02:00
myvesta
beccead388
php-func fix 2023-03-26 14:58:10 +02:00
myvesta
dd1efc58a1
Update bash-to-php-interpreter.php 2023-03-26 03:49:38 +02:00
myvesta
09dcc123be
Interpreter for calling myVesta PHP functions 2023-03-26 03:40:33 +02:00
myvesta
d84a021354
force-https fix 2023-03-25 23:59:28 +01:00
myvesta
505c4085f5
Update force-https.patch 2023-03-25 18:30:41 +01:00
myvesta
797ae8e515
force-https.patch 2023-03-25 18:19:29 +01:00
myvesta
71f91ba16d
deb9 private-force-https.tpl 2023-03-25 16:24:20 +01:00
myvesta
66097392bf
deb8 ttp2->ssl fix 2023-03-25 16:22:49 +01:00
myvesta
fdd8350fef
https redirect to the same host (deb9) 2023-03-25 16:12:44 +01:00
myvesta
ce7f31121d
https redirect to the same host (deb9) 2023-03-25 16:10:09 +01:00
myvesta
77857f92f0
https redirect to the same host 2023-03-25 15:39:57 +01:00
myvesta
a235ba6384
exim_forwarding.patch 2023-03-24 23:15:17 +01:00
myvesta
cd5cc2eda4
Forward from primary ip, not from secondary 2023-03-24 20:36:20 +01:00
myvesta
e9ca648f12
v-commander: inst-memchached and inst-redis 2023-03-23 14:14:40 +01:00
myvesta
172d66b4d2
Add files via upload 2023-03-22 15:02:22 +01:00
myvesta
afa72dc258
Update multi-php-install.sh 2023-03-21 17:50:14 +01:00
myvesta
bdc75152d2
php8.2.patch 2023-03-21 17:49:08 +01:00
myvesta
8ae36f7df5
Update string.php 2023-03-11 14:50:11 +01:00
myvesta
16e1000f1c
str_get_between PHP function 2023-03-11 10:40:40 +01:00
myvesta
38137b3ba9
Do not delete ssl.$domain* 2023-03-03 10:47:25 +01:00
myvesta
6db5f28ae5
Update v-commander 2023-03-02 15:29:26 +01:00
myvesta
4b0c521309
Merge pull request #155 from N1ebieski/master
Include "hidden" files to backup with support for exclusions in the old format
2023-02-24 13:29:53 +01:00
N1ebieski
47d55cff76
Update v-backup-user
Include "hidden" files to backup with support for exclusions in old pattern
2023-02-24 11:52:37 +01:00
myvesta
0dda04a19f
Merge pull request #154 from myvesta/revert-146-patch-4
Revert "Include "hidden" files to backup"
2023-02-23 20:46:14 +01:00
myvesta
91c6ff09ab
Revert "Include "hidden" files to backup" 2023-02-23 20:45:28 +01:00
myvesta
3391125925
SILENT_MODE in v-search-domain-owner 2023-02-23 16:18:31 +01:00
myvesta
0fae1613e3
Update main.sh 2023-02-23 15:58:00 +01:00
myvesta
8dcbafcc73
Update v-get-php-version-of-domain 2023-02-23 15:47:30 +01:00
myvesta
db554bacb7
Update fix-fpm-poold.sh 2023-02-23 14:57:37 +01:00
myvesta
f8a3f209c4
Update fix-fpm-poold.sh 2023-02-23 14:55:45 +01:00
myvesta
d0bba785be
Update v-activate-rocket-nginx 2023-02-21 20:29:16 +01:00
myvesta
84cf1269fb
Update sr.php 2023-02-20 11:16:08 +01:00
isscbta
ca4abdb864 Update v-activate-rocket-nginx 2023-02-16 21:38:17 +01:00
isscbta
f73b121ce7 Merge branch 'master' of https://github.com/myvesta/vesta 2023-02-16 21:33:35 +01:00
isscbta
d267a3deaa Update v-activate-rocket-nginx 2023-02-16 21:28:28 +01:00
myvesta
72e659ac18
Update v-get-php-version-of-domain 2023-02-16 21:20:11 +01:00
isscbta
38ec1b872f Update v-activate-rocket-nginx 2023-02-16 21:04:20 +01:00
isscbta
a997f6f59c Update v-activate-rocket-nginx 2023-02-16 20:50:57 +01:00
myvesta
7c9dfd4c05
Update v-activate-rocket-nginx 2023-02-15 14:00:04 +01:00
myvesta
1e20159847
Version 0.9.8-26-60 2023-02-12 16:22:53 +01:00
myvesta
df9e5508e0
Update Changelog.md 2023-02-12 16:21:32 +01:00
myvesta
1ee85a3568
Merge pull request #146 from N1ebieski/patch-4
Include "hidden" files to backup
2023-02-12 16:12:13 +01:00
myvesta
0ab6925adb
Create v-commander 2023-02-12 15:59:45 +01:00
myvesta
5dedc1e813
Checking for $CREATE_TO_DATABASE in v-clone-website 2023-02-11 20:35:00 +01:00
myvesta
7fe91ca4c9
v-clone-website: By default cloning to DB: user_domain_com
instead of cloning to database: user_old_db_migrated
2023-02-11 20:29:14 +01:00
myvesta
e0b90ef9d6
v-install-wordpress: Check if MariaDB allows long database name 2023-02-11 19:43:58 +01:00
myvesta
a28436e6e8
Update multi-php-install.sh 2023-02-11 19:20:03 +01:00
myvesta
6770d3bc4c
Fix for /backup 2023-02-10 19:37:45 +01:00
isscbta
7420a9ca84
Update v-move-domain-and-database-to-account 2023-02-10 17:40:20 +01:00
isscbta
a531eb20f6 Update v-activate-rocket-nginx 2023-02-06 18:34:10 +01:00
isscbta
33d0e6df9c Update v-activate-rocket-nginx 2023-02-06 15:57:07 +01:00
myvesta
94770a5f12
Update v-clean-garbage 2023-02-05 16:43:14 +01:00
myvesta
d6a84f37d2
Update v-update-myvesta 2023-02-05 16:40:24 +01:00
myvesta
65f626eda7
Update v-clean-garbage 2023-02-05 16:36:12 +01:00
myvesta
cf5b5325d6
Update v-clean-garbage 2023-02-05 16:32:14 +01:00
myvesta
43ebf79c34
Update v-clean-garbage 2023-02-05 16:19:10 +01:00
myvesta
5007cc2edf
Update v-update-myvesta 2023-02-05 16:17:46 +01:00
myvesta
a10f82af30
Create v-update-myvesta 2023-02-05 16:11:15 +01:00
myvesta
6d9c6d4734
Update v-clean-garbage 2023-02-05 16:05:00 +01:00
myvesta
71daf552e5
Cleaning /hdd/home 2023-02-05 15:52:13 +01:00
myvesta
935c7b2d08
Merge pull request #152 from umutkorkmaaz/master
i18n updates: missing fields added, duplicated keys removed, Turkish lang improvements
2023-02-04 11:04:58 +01:00
Umut Korkmaz
87b8216812 Duplicated fields removed 2023-02-04 02:47:43 +03:00
Umut Korkmaz
164ea90d53 Added missing fields 2023-02-04 02:45:31 +03:00
Umut Korkmaz
1ecd227785
Untranslated fields translated, typos fixed 2023-02-04 01:58:49 +03:00
isscbta
ab0b8c53c4
Rename v-activate-rocket-nginx.sh to v-activate-rocket-nginx 2023-02-02 14:28:37 +01:00
isscbta
15e5f3bc81
Rename v-get-php-version-of-domain.sh to v-get-php-version-of-domain 2023-02-02 13:49:00 +01:00
isscbta
d940389c15 Script to determine which PHP version a given domain is using 2023-02-02 13:44:29 +01:00
isscbta
1c33f9cfd2 Update v-activate-rocket-nginx.sh 2023-02-02 11:37:42 +01:00
isscbta
2d8fc21ba7 Update v-activate-rocket-nginx.sh 2023-02-01 20:07:07 +01:00
isscbta
c263c3322c Update v-activate-rocket-nginx.sh 2023-02-01 19:40:01 +01:00
isscbta
8eb0b19a0b Automatic installation of rocket-nginx for a given domain 2023-02-01 19:37:14 +01:00
myvesta
0a17e3759b
Version 0.9.8-26-59 2023-01-31 23:49:12 +01:00
myvesta
1325a73661
Update Changelog.md 2023-01-31 23:43:47 +01:00
myvesta
0e9a5304a5
Installing WordPress to user_domain_com database 2023-01-31 23:34:10 +01:00
myvesta
fa94c7a210
Update Changelog.md 2023-01-31 23:24:37 +01:00
myvesta
3fdfddf007
Merge pull request #144 from umutkorkmaaz/master
Fixed #142
2023-01-31 23:17:53 +01:00
myvesta
e8b9545a9d
CRLF to LF EOL 2023-01-31 21:56:18 +01:00
myvesta
151159f9d3
fpm pool.d conf tweak 2023-01-31 21:51:19 +01:00
myvesta
bfd822092c
Creating /etc/nginx/.htpasswd if it does not exist 2023-01-31 20:22:44 +01:00
myvesta
780f637325
Update PHP-FPM-73-public.sh 2023-01-31 20:13:31 +01:00
myvesta
60dbae21b1
Update PHP-FPM-73.sh 2023-01-31 20:12:40 +01:00
myvesta
13b310d115
Update PHP-FPM-74-public.sh 2023-01-31 20:11:12 +01:00
myvesta
f5cc5d75c2
Update PHP-FPM-74.sh 2023-01-31 20:10:19 +01:00
myvesta
08146520a0
default user/pass for private-hosting.tpl 2023-01-31 18:01:56 +01:00
myvesta
e7543afbd3
Update install-rocket-nginx.sh 2023-01-31 17:54:25 +01:00
isscbta
ac96d9f9b3 Fix filename 2023-01-31 17:48:45 +01:00
isscbta
4bc0ecc46e Update wprocket-hosting.stpl 2023-01-31 16:34:10 +01:00
isscbta
1d67c6ae54 Update wprocket-hosting.tpl 2023-01-31 16:31:02 +01:00
isscbta
290600dfcd Minor fix for install-rocket-nginx.sh 2023-01-31 16:27:52 +01:00
isscbta
66162375fd Minor fix for install-rocket-nginx.sh 2023-01-31 16:23:15 +01:00
myvesta
91ac345b3e
default php 8.2 www.conf 2023-01-31 15:26:38 +01:00
myvesta
2db5a6404a
PHP 8.2 apache templates 2023-01-31 15:20:33 +01:00
myvesta
ed85dfdac7
Support for PHP 8.2 2023-01-31 15:03:05 +01:00
isscbta
8409e19fac Added install-rocket-nginx.sh and the following nginx templates 2023-01-30 13:42:03 +01:00
myvesta
a39b192d30
v-lock-wordpress - set correct chmod just in case 2023-01-23 12:47:49 +01:00
myvesta
cdbcf84b2c
unlock /wp-content/cache/ for caching 2023-01-22 16:35:59 +01:00
myvesta
7cdd65baf2
Update v-install-wordpress 2023-01-20 13:09:23 +01:00
myvesta
bdfe17490f
Update v-unlock-wordpress 2023-01-20 13:07:16 +01:00
myvesta
ee5df22828
Update v-lock-wordpress 2023-01-20 13:06:34 +01:00
myvesta
0a78d937dd
Update v-unlock-wordpress 2023-01-19 18:07:43 +01:00
myvesta
a65f008f9a
Update v-unlock-wordpress 2023-01-19 18:06:44 +01:00
myvesta
0fc6fd5fa5
Update v-install-wordpress 2023-01-19 18:05:56 +01:00
myvesta
f397454364
Update v-install-wordpress 2023-01-19 18:04:45 +01:00
myvesta
8b75699377
Update v-lock-wordpress 2023-01-19 18:03:40 +01:00
myvesta
c9c29ce7a9
Create v-unlock-wordpress 2023-01-19 18:02:56 +01:00
myvesta
efc2be9f71
Lock WordPress files if they are potentially infected 2023-01-19 17:55:44 +01:00
myvesta
caee59c015
Update v-install-wordpress 2023-01-19 17:43:42 +01:00
myvesta
479805c52c
Cleaning fail2ban database 2023-01-15 22:01:43 +01:00
myvesta
2df6bfbb0b
New roundcube version 2023-01-15 17:37:32 +01:00
myvesta
ae81474f8e
Update vst-install-debian.sh 2023-01-14 17:15:36 +01:00
myvesta
d0a77cf3f6
Writing '$ip $servername' to /etc/hosts 2023-01-14 16:44:27 +01:00
myvesta
171a42a65e
Update vst-install-debian.sh 2023-01-14 15:49:46 +01:00
myvesta
fab56e1b70
Another attempt to fix wildcard letsencrypt 2023-01-12 17:59:49 +01:00
myvesta
0db48dcdaa
Update v-move-folder-and-make-symlink 2022-12-29 15:12:58 +01:00
myvesta
75e7d7c5e0
Update v-move-folder-and-make-symlink 2022-12-29 13:44:40 +01:00
myvesta
5b0056b193
Update v-move-folder-and-make-symlink 2022-12-29 13:18:44 +01:00
myvesta
cab6df399a
Create v-move-folder-and-make-symlink 2022-12-29 12:57:17 +01:00
myvesta
d0f5d1a355
Update fix-fpm-poold.sh 2022-12-08 14:13:42 +01:00
myvesta
343a4deb73
Additional fix for utf8mb4_0900_ai_ci 2022-11-26 21:42:09 +01:00
myvesta
93b4b1e466
Update v-fix-user-permissions 2022-11-26 15:37:51 +01:00
myvesta
8e34db9a71
Replacing utf8mb4_0900_ai_ci 2022-11-23 14:28:32 +01:00
myvesta
8563303fbe
Rollback of previous commit 2022-11-23 14:25:56 +01:00
myvesta
e134202224
Skipping forward proxy while renewing LetsEncrypt 2022-11-22 09:07:25 +01:00
myvesta
06ebea1a8b
Update fix-fpm-poold.sh 2022-11-14 14:45:59 +01:00
myvesta
f5d3d97dfb
Add files via upload 2022-11-09 19:01:33 +01:00
myvesta
56484d4b01
Create run-all.sh 2022-11-09 19:01:02 +01:00
myvesta
595dd5dffd
Delete create-mail-sync.sh 2022-11-09 19:00:15 +01:00
myvesta
7e37ed4711
scanps fixes 2022-11-09 17:04:10 +01:00
myvesta
aa493287f3
Create scanps.php 2022-11-09 16:15:48 +01:00
myvesta
8d4eee37d0
Create scanps.sh 2022-11-09 15:36:57 +01:00
myvesta
f89065a80a
Create create-mail-sync.sh 2022-11-09 10:35:38 +01:00
myvesta
af11a4cbf2
Update fix-fpm-poold.sh 2022-11-04 20:09:50 +01:00
myvesta
402a4286d3
Update fix-fpm-poold.sh 2022-11-03 15:37:43 +01:00
myvesta
039dca41c3
Update fix-fpm-poold.sh 2022-11-03 15:23:15 +01:00
myvesta
c182d7f0a7
Create fix-fpm-poold.sh 2022-11-03 15:19:08 +01:00
myvesta
8791d471c6
Merge pull request #148 from jaapmarcus/patch-1
Unsuspend database does not restore permissions remote users
2022-11-03 10:10:13 +01:00
Jaap Marcus
c6d226023e
Unsuspend database does not restore permissions remote users
See https://github.com/hestiacp/hestiacp/issues/3011 and https://github.com/hestiacp/hestiacp/issues/3014
2022-11-03 07:14:43 +01:00
myvesta
374b4da5bc
Update W3TC.json 2022-11-02 19:57:48 +01:00
myvesta
93c1414217
systemctl instead of service in v-restart-dns 2022-10-14 18:38:39 +02:00
myvesta
7f38c8ceaf
Restart DNS after adding acme_challenge TXT record 2022-10-14 16:00:02 +02:00
myvesta
25d3fef4aa
Create v-fix-user-permissions 2022-09-26 14:27:39 +02:00
N1ebieski
e5a03804aa
Include "hidden" files to backup
Files like .htaccess, .env, .git etc
2022-09-25 14:47:31 +02:00
myvesta
5518e0e059
Update v-clean-garbage 2022-09-24 11:55:07 +02:00
Umut Korkmaz
44cf0b5306
Fixed #142 2022-08-02 17:24:55 +03:00
myvesta
d48f6cc428
typo fix 2022-07-29 00:34:52 +02:00
myvesta
bc67f1028a
Fix for an boring PHP Notice in vesta-php 2022-07-12 21:08:30 +02:00
myvesta
d625c9722a
Fix for an boring PHP Notice in vesta-php 2022-07-12 21:00:33 +02:00
myvesta
6d36502623
Update Changelog.md 2022-07-12 20:52:41 +02:00
myvesta
8b1c8b658d
Update Changelog.md 2022-07-12 20:47:56 +02:00
myvesta
94d7c20a3b
Version 0.9.8-26-58 2022-07-12 20:42:10 +02:00
myvesta
b2d7c5a1fd
Fix for PHP Notice in vesta-php 2022-07-12 20:40:20 +02:00
myvesta
fa3d9aff36
Merge pull request #141 from divinity76/patch-4
avoid out-of-memory serving large logfiles
2022-07-12 20:24:54 +02:00
divinity76
15c5bdac51
turns out VESTA_CMD is 2 commands 2022-07-12 20:07:55 +02:00
divinity76
5aebfde6cf
avoid double-quoting v_domain 2022-07-12 19:17:01 +02:00
divinity76
1a081dfdbe
workaround for passthru() being disabled 2022-07-12 19:14:55 +02:00
myvesta
e65af22a54
hash_equals() in /reset/mail/
Thanks to @divinity76
2022-07-12 18:10:31 +02:00
divinity76
b09d244af7
code-breaking-typo
from copypasta
2022-07-09 11:18:30 +02:00
divinity76
b13b82112a
avoid out-of-memory serving large logfiles
large logfiles previously resulted in out-of-memory errors, see https://github.com/hestiacp/hestiacp/issues/2736

hestacp PR: https://github.com/hestiacp/hestiacp/pull/2741

and no, removing the php end tag was not an accident, it was intentional. end tags, ideally, should only be used when they're absolutely required, because they can easily introduce bugs like printing a newline after the end tag.
2022-07-09 11:16:02 +02:00
myvesta
a2da58841b
Merge pull request #140 from umutkorkmaaz/patch-4
fix typo
2022-07-06 19:32:51 +02:00
Umut Korkmaz
d3bde491c7
fix typo 2022-07-06 19:43:11 +03:00
myvesta
16f18bd8b3
Version 0.9.8-26-57 2022-07-06 15:09:22 +02:00
myvesta
7f1de189dd
Update Changelog.md 2022-07-06 15:08:12 +02:00
myvesta
cf8a49f739
Patch for GMail SMTP timeouts 2022-07-06 14:38:58 +02:00
myvesta
2598785a75
Fix for Exim4 fastopen with Gmail services (Debian11) 2022-07-06 13:25:34 +02:00
myvesta
c7aa6ec749
Fix for Exim4 fastopen with Gmail services (Debian11) 2022-07-06 12:48:09 +02:00
myvesta
0f86941e8e
Fix for Sed Injection Vulnerability 2022-06-04 19:06:23 +02:00
myvesta
8dd8cd0767
Version 0.9.8-26-56 2022-05-27 23:57:37 +02:00
myvesta
748d42ead7
Update Changelog.md 2022-05-27 23:55:58 +02:00
myvesta
67ba371722
Barracuda RBL in installer 2022-05-27 23:50:14 +02:00
myvesta
c787f2c235
Adding Barracuda RBL to SpamAssassin 2022-05-27 23:46:39 +02:00
myvesta
93f2a62ee8
Fixing insane HTML form bug in Lisr backup details page
Without this fix, selecting first item and skiping next item and selecting any other item below, resulted with selected only first item in HTML form array
2022-05-27 23:28:25 +02:00
myvesta
360abd80c0
Update v-make-separated-ip-for-email 2022-05-21 12:42:29 +02:00
myvesta
d8fb531865
Update barracuda.cf 2022-05-08 16:24:56 +02:00
myvesta
aaf20378b1
Create barracuda.cf 2022-05-08 15:59:46 +02:00
myvesta
23ba131e69
Update v-make-separated-ip-for-email 2022-05-07 22:21:20 +02:00
myvesta
f49479043f
Update v-make-separated-ip-for-email 2022-05-07 21:39:40 +02:00
myvesta
18e42c9540
exim4.conf.template-RC 2022-05-07 21:11:10 +02:00
myvesta
aeb210433f
conf/mariadb_installed and conf/mysql8_installed 2022-05-07 14:23:11 +02:00
myvesta
3a688f33fa
Update vst-install-debian.sh 2022-05-07 12:45:33 +02:00
myvesta
f2809eeb67
Update Changelog.md 2022-04-25 23:38:47 +02:00
myvesta
247dce94f8
Version 0.9.8-26-55 2022-04-25 22:41:53 +02:00
myvesta
d98d67d5a1
Update Changelog.md 2022-04-25 22:39:52 +02:00
myvesta
1c4cce181a
Making sure yescrypt is disabled 2022-04-25 22:34:33 +02:00
myvesta
74e9dd4abf
Linux EOL in v-log-failed-login and v-change-user-rkey 2022-04-25 22:16:34 +02:00
myvesta
fca4ca66d4
Delete v-change-user-rkey 2022-04-25 22:13:46 +02:00
myvesta
822541d1c5
Delete v-log-failed-login 2022-04-25 22:12:19 +02:00
myvesta
da69aaa7aa
Update v-log-failed-login 2022-04-25 22:09:23 +02:00
myvesta
475b7eac6b
Generating 16 chars password for users 2022-04-25 21:23:02 +02:00
myvesta
547d5f0c5b
Preventing brute-force reseting password 2022-04-25 21:13:46 +02:00
myvesta
add252bbd7
Update install-new-roundcube.sh 2022-04-02 10:13:37 +02:00
myvesta
8bbf4ef361
Update install-new-roundcube.sh 2022-04-02 10:12:05 +02:00
myvesta
1cbd6a5797
Update v-get-database-credentials-of-domain 2022-03-31 16:12:46 +02:00
myvesta
3cf64450a2 Blocking in nginx .env 2022-03-30 14:12:30 +02:00
myvesta
355ae01222 Reverting blocking in nginx everything that begins with dot 2022-03-30 13:50:29 +02:00
myvesta
ebb6b54065
Many improvements in v-clone-website 2022-03-24 20:31:43 +01:00
myvesta
6523a2daf9
OpenCart detection 2022-03-24 20:26:16 +01:00
myvesta
bda54c4ec4
handle --parameters without shifting 2022-03-24 18:20:31 +01:00
myvesta
54c3fd1e13 Blocking in nginx everything that begins with dot 2022-03-11 15:55:00 +01:00
myvesta
dd09dbe748
Update v-clone-website 2022-03-04 20:30:40 +01:00
myvesta
81b63267cf
Update v-clone-website 2022-03-04 18:54:15 +01:00
myvesta
7331a39ace
srdb cli in v-clone-website 2022-03-04 18:53:06 +01:00
myvesta
7fe43c33bc
Merge pull request #137 from umutkorkmaaz/master
Update v-install-wordpress
2022-02-17 08:16:17 +01:00
Umut Korkmaz
2f115195d4
Update v-install-wordpress
if the user reached the database limit abort the installation
2022-02-16 20:24:10 +03:00
myvesta
8c186156fd
Update v-clean-garbage 2022-02-11 16:43:39 +01:00
myvesta
29b83e7f76
Update install-new-roundcube.sh 2022-02-08 11:39:03 +01:00
myvesta
a4251739e9
Update install-new-roundcube.sh 2022-02-01 16:19:16 +01:00
myvesta
5a0914b71b
Update vst-install-debian.sh 2022-01-24 23:20:31 +01:00
myvesta
9090a21bc7
MySQL 8 support as installer option 2022-01-24 20:43:41 +01:00
myvesta
d98f373226
Detection of MySQL 8 in v-list-sys-services 2022-01-24 20:41:48 +01:00
myvesta
f0f28da12e phpmyadmin installer mysql8 suppodrt 2022-01-23 23:46:17 +01:00
myvesta
e91976613c mysql8 create user, set password, grant 2022-01-23 15:41:28 +01:00
myvesta
d30c9f584e
Update install-new-roundcube.sh 2022-01-22 16:15:24 +01:00
myvesta
91fe4bc7c5
Exclude /var/log/apt/* while cleaning garbage 2022-01-09 14:43:45 +01:00
myvesta
aa85d2e581
Update install-softaculous.sh 2021-12-25 13:36:08 +01:00
myvesta
909619ef69
Update v-clean-garbage 2021-12-19 16:06:13 +01:00
myvesta
fee11ca777
Update install-new-roundcube.sh 2021-12-19 01:56:35 +01:00
myvesta
90db1084ec
Update install-new-roundcube.sh 2021-12-19 01:08:43 +01:00
myvesta
2ee193873f
Update install-new-roundcube.sh 2021-12-17 22:36:49 +01:00
myvesta
d89da4f51b
Version 0.9.8-26-54 2021-12-17 19:36:17 +01:00
myvesta
ecc0640415
Update Changelog.md 2021-12-17 19:35:20 +01:00
myvesta
a0ad0c6101
Update sr.php 2021-12-17 19:16:50 +01:00
myvesta
5d87f24b3f
Checking if FreshClam is started after installation 2021-12-17 18:19:25 +01:00
myvesta
e0530d895a
Update vst-install-debian.sh 2021-12-17 18:12:47 +01:00
myvesta
6db07c4aa5
Starting FreshClam during myVesta installation 2021-12-17 16:38:43 +01:00
myvesta
774faa2d98
Update install-new-roundcube.sh 2021-12-17 01:18:49 +01:00
myvesta
5fa3645004
Adding install-new-roundcube.sh 2021-12-17 00:43:49 +01:00
myvesta
b965a3d184
Delete install-new-roundcube.sh 2021-12-17 00:42:45 +01:00
myvesta
e44da1ee66
Add files via upload 2021-12-17 00:36:35 +01:00
myvesta
5b9672b26f
Add files via upload 2021-12-16 23:56:59 +01:00
myvesta
11b5f0d9c7
Delete create_wp_http 2021-12-16 23:53:46 +01:00
myvesta
39fd40f0cc
Update multi-php-install.sh 2021-12-13 00:57:03 +01:00
myvesta
93d8ca4a81
Update vst-install-debian.sh 2021-12-12 21:17:24 +01:00
myvesta
98dcbbc691
Update postinst 2021-12-12 21:16:22 +01:00
myvesta
4ec64b0191
Update keep_mpm_event.sh 2021-12-12 21:14:15 +01:00
myvesta
d399d74fd9
Update multi-php-install.sh 2021-12-12 20:29:25 +01:00
myvesta
71bdbfbcf5
php8.1.patch 2021-12-12 20:27:57 +01:00
myvesta
549ba4e154
Update multi-php-install.sh 2021-12-12 19:39:37 +01:00
myvesta
a17af106fd
Support for PHP 8.1 2021-12-12 19:38:43 +01:00
myvesta
c03d8cd75e
PHP-FPM 8.1 templates 2021-12-12 19:25:40 +01:00
myvesta
5631e6d732
Update Changelog.md 2021-12-12 17:35:18 +01:00
myvesta
3b9d81bc80
Version 0.9.8-26-53 2021-12-12 17:32:45 +01:00
myvesta
353526d289
Update postinst 2021-12-12 17:31:50 +01:00
myvesta
9c04bb8417
Ensure pool.d folders after template changes 2021-12-12 17:25:19 +01:00
myvesta
3c17e159a1
Ensure that pool.d folders are not empty 2021-12-12 16:49:24 +01:00
myvesta
77de50a6cd
Create v-ensure-poold-folders-not-empty 2021-12-12 16:31:21 +01:00
myvesta
c7b872b778
check_if_service_exists() function 2021-12-12 16:28:16 +01:00
myvesta
591bd21615
default pool.d www.conf files 2021-12-12 16:24:23 +01:00
myvesta
cf4f5af280
Update latest.txt 2021-11-23 13:38:12 +01:00
myvesta
706fe4a5e7
Update Changelog.md 2021-11-23 13:37:32 +01:00
myvesta
fb0e127adf
Added memcached to v-list-sys-services 2021-11-23 13:33:34 +01:00
myvesta
dba6c79f71
Update v-normalize-restored-user 2021-11-21 13:43:01 +01:00
myvesta
a30d8b8233
Update v-normalize-restored-user 2021-11-21 13:41:48 +01:00
myvesta
a08a17cca8
Merge pull request #134 from anton-reutov/patch-26
Small improvmemts for login form
2021-11-20 22:15:48 +01:00
myvesta
47ba92989c
Merge pull request #133 from anton-reutov/patch-25
Small improvmemts for login form
2021-11-20 22:15:15 +01:00
Anton Reutov
47f2ca1d37
Small improvmemts for login form 2021-11-19 21:29:42 +03:00
Anton Reutov
d36f1a355b
Small improvmemts for login form 2021-11-19 21:28:19 +03:00
myvesta
8f6fe21dbf
Dont match wildcardly *domains and databases* while restoring 2021-11-17 15:15:23 +01:00
myvesta
de5f28459e
$pid fix in v-list-sys-services 2021-11-14 21:11:34 +01:00
myvesta
b62486ddd2
Update Changelog.md 2021-11-14 20:20:29 +01:00
myvesta
a7d96a479b
Fixes only if ClamAV is enabled 2021-11-14 20:16:27 +01:00
myvesta
b42d607ad1
Version 0.9.8-26-51 2021-11-14 20:05:49 +01:00
myvesta
d9202d91b9
Avoid clamav fixes if clamav is disabled 2021-11-14 20:01:21 +01:00
myvesta
302e351252 Many fixes for v-list-sys-services 2021-11-14 19:47:54 +01:00
myvesta
8c4be97720
Fix for "chmod: changing permissions" 2021-11-12 23:04:46 +01:00
myvesta
aba861c814 check spam if email smaller than 600 KB 2021-11-11 22:54:42 +01:00
1029 changed files with 45008 additions and 3685 deletions

3
.gitignore vendored
View file

@ -4,3 +4,6 @@
*.gz
.vscode
.DS_Store
data
conf
log

View file

@ -1,38 +1,202 @@
Version 0.9.8-26-50 [07-Nov-2021]
Version 0.9.9-0-13 [2025-08-15]
==================================================
* Improvement: Activating FileManager licence for all users (credits to Official VestaCP)
* Introducing a malware cleaning set of tools: v-install-wordfence-cli, v-desinfect-wordpress, v-fix-wordpress-core, v-change-database-password-for-wordpress, v-change-wordpress-admin-passwords, v-delete-inactive-wordpress-plugins-and-themes, v-delete-wordpress-uploads-php-files) (credits to isscbta)
* Improvement: Added support for PHP 8.3 and 8.4
* SRS support for Exim4 (v-add-srs-support-to-exim) (credits to HestiaCP)
* Security: Ensuring that PHP files are visible only to the account they belong to - setting chmod 600 for all .php and .env files (also added as admin cronjob - v-fix-website-permissions-for-all-websites-only-php)
* Added cronjob for disk usage snapshot (size of each folder) to see what folder is growing every day (v-df-snapshot-make, v-df-snapshot-diff [some-day-snapshot] [some-other-day-snapshot])
* Bugfix: SSL fix for Apache 2.4.65+ (fix for '421 Misdirected Request')
* Bugfix: vst-install-debian.sh: ability to install MySQL 8 on Debian 12
* Improvement: Update nginx block-firewall.conf when user blocks 80,443 ports for some IPv4 address in the Firewall section of the admin panel
* Improvement: v-install-wordpress: Support for IDN format domains
* Security: Adding ProFTPD jail rule to Fail2Ban
* Introducing: v-make-main-apache-log - making one log file for PHP requests for all websites
* Security: Introducing a new command: v-fix-php-ini-disable-functions
* Improvement: Introducing myVesta rules for SpamAssassin (enhancing spam filtering)
* Improvement: When deleting a domain, also delete the database if the domain has a database
* Bugfix: Removing temporary Docker container network interfaces from RRD
* Introducing v-run-wp-cli-myvesta that knows the correct terminal width
* Introducing a new command: v-cd-www alias for v-change-dir-www
* Introducing a new command: v-clear-fail2ban
* Introducing a new command: v-get-dns-config (to print zone file in bind9 format)
* Introducing a DISABLE_IP_CHECK as vesta.conf variable (if logged-in user is getting a new IPv4 address every minute)
* Security: Introducing a parse_object_kv_list_non_eval() function in main.sh, to avoid the evil eval command
* Security: Enhance package validation, in v-change-user-package 'eval' replaced with 'parse_object_kv_list_non_eval'
* Improvement: Replacing all WordPress scripts to use 'v-run-wp-cli' instead of 'wp'
* Improvement: v-install-wordpress: Almost always use https
* Improvement: Skip the prompt to continue during myVesta installation if the administrator has set all required variables in the command line
* Security: Jailing v-run-wp-cli (running WP-CLI as user, added open_basedir, disabling shell_exec() and other dangerous PHP functions)
* Security: v-commander: removing the ability to set a root password
* Bugfix: DKIM record deletion command in v-delete-mail-domain-dkim script
* Adding FTP / SFTP port for Remote Backup (credits to ikheetjeff)
* Introducing a new command: v-delete-mails - delete emails older than N days (credits to isscbta)
* Introducing new commands: v-blacklist-email-domain, v-blacklist-email-account, v-whitelist-email-domain, v-whitelist-email-account (credits to isscbta)
* Bugfix: v-move-folder-and-make-symlink: use 'mv' instead of 'rsync'
* Improvement: Calculate the size of directories on /hdd too
* Bugfix: v-move-domain-and-database-to-account: Update wordfence-waf.php
* Bugfix: v-add-letsencrypt-domain: Detecting valid status on wildcard variant
* Bugfix: db.sh and v-clone-website: mysqldump --max_allowed_packet=1024M
* Bugfix: web/index.php: Prevent recreation of token by shitty browser add-ons
* Bugfix: v-restore-user: permissions fix while restoring backup
* Bugfix: Add some loops due to 403 errors during LE request in some random cases
* Improvement: v-clone-website: adding --EXCLUDE_UPLOADS parameter
* Bugfix: vst-install-debian.sh - removing phppgadmin
* Bugfix: v-update-firewall: $FIREWALL_STATEFUL conf variable (for Infomaniak VPS servers)
* Bugfix: Awstats template for all systems does not have a closed bracket in line 27 (credits to gkirde)
* Bugfix: Update v-import-cpanel-backup - removing /*!999999\- enable the sandbox mode */
* Bugfix: Small PHP syntax fixes in the admin panel
* Introducing nginx template 'wprocket-webp-express-force-https' (credits to Luka Paunovic)
* Improvement: Added functions to check if a domain or user is unsuspended in main.sh
* Introducing a new command: v-update-document-errors-files
* Improvement: new v-backup-user-now command does backup even if the system Load Average is above the limit, or the administrator configured backups to perform only at night
* Improvement: v-install-wp-cli and v-install-wp-cli-myvesta - automatically updates if wp-cli is 30 days old
* Bugfix: Check for SSL certificate existence before deleting web domain SSL in v-install-unsigned-ssl
* Improvement: v-install-wordpress: avoid changing nginx proxy template in apache-less variant
* Added to .gitignore excludes for 'data', 'conf', and 'log' folders
* And many other minor bugfixes and improvements...
Version 0.9.9-0-12 [2025-02-28]
==================================================
* SpamHaus DNSBL removed from exim4
* A lot of small bugs fixed
Version 0.9.9-0-11 [2024-05-30]
==================================================
* Introducing v-run-wp-cli command ( @isscbta )
* Introducing v-add-wordpress-admin command ( @isscbta )
* Few bugs fixed
Version 0.9.9-0-10 [2024-04-11]
==================================================
* Introducing v-edit-php-ini command ( @isscbta )
* Introducing v-edit-domain-php-ini command ( @isscbta )
Version 0.9.9-0-9 [2024-04-05]
==================================================
* Get quick info about a banned IP (Host, Banlist, Location) (many thanks to @VasilisParaschos )
* Few bugs fixed
Version 0.9.9-0-5 to 0.9.9-0-8
==================================================
* Few bugs fixed
Version 0.9.9-0-4 [2023-06-27]
==================================================
* Support for Debian 12 ( in mutual cooperation with @HestiaCP )
Version 0.9.9-0-2 [2023-06-12]
==================================================
* Hosting panel UI perfomance fix
Version 0.9.9-0 [2023-06-05]
==================================================
* Redesign of hosting panel
* Fix for WP_CACHE_KEY_SALTs in v-clone-website command
* Fix for "Helo name contains a ip address" in Exim4
* Fix for Exim4 for punycode domains (in collaboration with @HestiaCP )
Version 0.9.8-26-62 [2023-04-05]
==================================================
* Fix for LetsEncrypt Asynchronous Order Finalization (in collaboration with @HestiaCP )
Version 0.9.8-26-61 [2023-04-04]
==================================================
* Many bugfixes
* Hotfix for LetsEncrypt to prevent Apache falling
Version 0.9.8-26-60 [2023-02-12]
==================================================
* New script: v-commander (useful for maintaining the server)
* New script: v-activate-rocket-nginx (serve WP-Rocket cache directly from nginx)
* New script: v-update-myvesta (get the very latest build of myVesta)
* v-clone-website: By default cloning to database: user_domain_com (instead of cloning to database: user_old_db_migrated)
* Many minor bugfixes
Version 0.9.8-26-59 [2023-02-01]
==================================================
* Support for PHP 8.2
* New script: v-move-folder-and-make-symlink
* New script: v-lock-wordpress (to prevent PHP malware) and v-unlock-wordpress
* v-install-wordpress: Installing WordPress to user_domain_com database instead of installing to user_wp database
* Many minor bugfixes
Version 0.9.8-26-58 [2022-07-12]
==================================================
* [Security] hash_equals() in /reset/mail/ (credits to @divinity76 )
* Avoid out-of-memory while downloading large log files from panel (credits to @divinity76 )
* Fix for an boring PHP Notice in vesta-php
Version 0.9.8-26-57 [2022-07-06]
==================================================
* Fix for GMail SMTP timeouts on Debian11
* [Security] Fix for Local Sed Injection Vulnerability ( credits to @cleemy-desu-wayo )
Version 0.9.8-26-56 [2022-05-28]
==================================================
* Adding Barracuda RBL to SpamAssassin
* Fixing insane HTML form bug in List backup items page
* Script for easy adding second IP address for SMTP authenticated users only (v-make-separated-ip-for-email)
Version 0.9.8-26-55 [2022-04-26]
==================================================
* Support for MySQL 8
* [Security] Preventing brute-force resetting password (thanks to HestiaCP @hestiacp for fix)
* Many minor bugfixes
Version 0.9.8-26-54 [2021-12-17]
==================================================
* Checking if FreshClam is started after installation
Version 0.9.8-26-53 [2021-12-12]
==================================================
* Support for PHP 8.1
* Function to ensure that pool.d folders are not empty
Version 0.9.8-26-52 [2021-11-23]
==================================================
* Fix for not to match wildcard "*domains" and "databases*" while restoring
* Added memcached to v-list-sys-services
Version 0.9.8-26-51 [2021-11-14]
==================================================
* Many fixes for "List services" page (v-list-sys-services function)
Version 0.9.8-26-50 [2021-11-07]
==================================================
* Many small bugfixes and CSRF fixes
Version 0.9.8-26-49 [17-Jul-2021]
Version 0.9.8-26-49 [2021-07-17]
==================================================
* Support for Debian 11
Version 0.9.8-26-48 [11-Jul-2021]
Version 0.9.8-26-48 [2021-07-11]
==================================================
* Fixed two bugs in LetsEncrypt generating process
Version 0.9.8-26-47 [30-May-2021]
Version 0.9.8-26-47 [2021-05-30]
==================================================
* Enabling TLS for ProFTPD FTPS
* More logical "Restore backup" template
Version 0.9.8-26-46 [17-Apr-2021]
Version 0.9.8-26-46 [2021-04-17]
==================================================
* [Feature] Updating CloudFlare IP addresses
Version 0.9.8-26-45 [13-Apr-2021]
Version 0.9.8-26-45 [2021-04-13]
==================================================
* [Feature] Logging whole LetsEncrypt process to /usr/local/vesta/log/letsencrypt.log and /usr/local/vesta/log/letsencrypt_cron.log
* [Feature] Warn admin once (by sending email) if LetsEncrypt renewing failed for server hostname
* [Bugfix] Correct truncating of CA LetsEncrypt certificate (thanks to HestiaCP @hestiacp for fix)
Version 0.9.8-26-44 [04-Apr-2021]
Version 0.9.8-26-44 [2021-04-04]
==================================================
* [Security] Preventing denial-of-service in openssl library in vesta-nginx service (CVE-2021-3449)
* [Security] Preventing admin to install non-vesta packages from vesta admin panel user interface (Credits to: Numan Türle @numanturle)
* [Bugfix] Preventing multiple execution of v-backup-users
* [UserInterface] CSS fix for Apache status table (Credits to: Milos Spasic)
Version 0.9.8-26-43 [15-Mar-2021]
Version 0.9.8-26-43 [2021-03-15]
==================================================
* [Security] fix for: CSRF remote code execution in UploadHandler.php - CVE-2021-28379 (Credits to: Fady Osman @fady_othman)
* [Security] fix for: Local privilege escalation from user account to admin account via v-add-web-domain (Credits to: Two independent security researchers, Marti Guasch Jiménez and Francisco Andreu Sanz, working with the SSD Secure Disclosure program) (and also thanks to HestiaCP @hestiacp for fix)
@ -42,62 +206,62 @@ Version 0.9.8-26-43 [15-Mar-2021]
* [Security] fix for: Admin to root escalation in v-activate-vesta-license (Credits to: Numan Türle @numanturle)
* [Security] Ensure HTML will not be displayed in list log page (Credits to: Kristan Kenney @kristankenney, thanks to HestiaCP @hestiacp for fix)
Version 0.9.8-26-42 [26-Feb-2021]
Version 0.9.8-26-42 [2021-02-26]
==================================================
* [Feature] Support for PHP 8.0, see: https://forum.myvestacp.com/viewtopic.php?f=18&t=52
* [Bugfix] Making sure Apache is in mpm_event mode
Version 0.9.8-26-41 [11-Feb-2021]
Version 0.9.8-26-41 [2021-02-11]
==================================================
* Few bugfixes
Version 0.9.8-26-40 [08-Feb-2021]
Version 0.9.8-26-40 [2021-02-08]
==================================================
* Few bugfixes
Version 0.9.8-26-39 [12-Dec-2020]
Version 0.9.8-26-39 [2020-12-12]
==================================================
* [Security] Fixing useless issue with tokens in "download backup" and "loginas" functions (thanks to HestiaCP for fixes)
* [Security] Fixing XSS in /list/rrd/?period= value
Version 0.9.8-26-38 [05-Dec-2020]
Version 0.9.8-26-38 [2020-12-05]
==================================================
* [Security] Fixing Apache status public access (thanks to HestiaCP for letting us know)
Version 0.9.8-26-37 [26-Oct-2020]
Version 0.9.8-26-37 [2020-10-26]
==================================================
* [Bugfix] Fixing LetsEncrypt deprecated GET method for ACME v2 (thanks to @moucho)
* [Bugfix] Fixing Roundcube to send via authenticated SMTP user instead via php
Version 0.9.8-26-36 [10-Sep-2020]
Version 0.9.8-26-36 [2020-09-10]
==================================================
* [Bugfix] Checking necessary available disk space before doing backup
* [Security] Disabling login with 'root'
Version 0.9.8-26-35 [23-Aug-2020]
Version 0.9.8-26-35 [2020-08-23]
==================================================
* [Feature] Limiting max recipients per email to 15, in order to prevent mass spamming
* [Bugfix] While restoring backup, only exclude logs folder from root, not in public_html
Version 0.9.8-26-34 [19-Aug-2020]
Version 0.9.8-26-34 [2020-08-19]
==================================================
* [Bugfix] Split long DNS TXT entries into 255 chunks
Version 0.9.8-26-33 [16-Aug-2020]
Version 0.9.8-26-33 [2020-08-16]
==================================================
* [Feature] Ability to set some domain to send emails from another IP (command: v-make-separated-ip-for-email-domain)
Version 0.9.8-26-32 [02-Aug-2020]
Version 0.9.8-26-32 [2020-08-02]
==================================================
* [Feature] v-replace-in-file command introduced
* [Security] Making sure new myVesta commands can be called only by root
Version 0.9.8-26-31 [30-Jul-2020]
Version 0.9.8-26-31 [2020-07-30]
==================================================
* [Feature] v-import-cpanel-backup command moved to vesta-bin folder (becoming standard myVesta command)
* Starting to log auto-update output
Version 0.9.8-26-30 [26-Jul-2020]
Version 0.9.8-26-30 [2020-07-26]
==================================================
* New ASCII logo in installer
* Deleted favicon when user don't know secret-url of hosting panel
@ -105,14 +269,14 @@ Version 0.9.8-26-30 [26-Jul-2020]
* [bugfix] Minor fix of URL for templates in v-update-dns-templates
* [bugfix] Minor fixes in installer
Version 0.9.8-26-29 [21-Jul-2020]
Version 0.9.8-26-29 [2020-07-21]
==================================================
* [Feature] v-clone-website command moved to vesta-bin folder (becoming standard myVesta command)
* [Feature] v-migrate-site-to-https command moved to vesta-bin folder (becoming standard myVesta command)
* [Bugfix] Fix for ClamAV socket
* Changing Vesta to myVesta in title of hosting panel pages
Version 0.9.8-26-28 [15-Jul-2020]
Version 0.9.8-26-28 [2020-07-15]
==================================================
* [Feature] v-install-wordpress command introduced
* [Feature] v-move-domain-and-database-to-account command introduced
@ -120,37 +284,37 @@ Version 0.9.8-26-28 [15-Jul-2020]
* [Bugfix] Fix for LetsEncrypt issuing in apache-less variant (nginx + php-fpm variant)
* [Bugfix] Fix for configuring phpMyAdmin DB in apache-less variant (nginx + php-fpm variant)
Version 0.9.8-26-27 [05-Jul-2020]
Version 0.9.8-26-27 [2020-07-05]
==================================================
* [Feature] Admins now see changelog when they open myVesta panel after myVesta get updated (changelog will dissapear on next refresh)
* [Bugfix] Better control of opened SMTP concurrent connections (preventing denial-of-service of SMTP) on fresh installed servers - https://github.com/myvesta/vesta/commit/c57b15b5daca2a0ea88ee6a89a2ff5a4ef47d2a3
* Second tuning of php-fpm pool.d config files (perfomances and limits)
Version 0.9.8-26-26 [27-Jun-2020]
Version 0.9.8-26-26 [2020-06-27]
==================================================
* [Feature] Self-signed SSL will be automaticaly added when you add new domain (CloudFlare is fine with that, you don't need LetsEncrypt anymore if you use CloudFlare as reverse-proxy(CDN+Firewall), just set "Full" in SSL section on CloudFlare)
* [Feature] Script for adding self-signed SSL to desired domain [v-install-unsigned-ssl]
* From now, on fresh installed server, default backup cron goes at Saturday at 01 AM (instead of everyday at 05 AM)
* New favicon for hosting panel
Version 0.9.8-26-25 [23-Jun-2020]
Version 0.9.8-26-25 [2020-06-23]
==================================================
* [Security] Fixing unnecessary slash in nginx configs for phpmyadmin and roundcube (Credits to Bernardo Berg @bberg1984 for finding this issue!)
* [Security] Adding escapeshellarg on few more places in php code (Credits to Talha Günay and @Lupul for finding these places)
Version 0.9.8-26-24 [22-Jun-2020]
Version 0.9.8-26-24 [2020-06-22]
==================================================
* [Bugfix] nginx + php-fpm installer variant now finally works
Version 0.9.8-26-23 [14-Jun-2020]
Version 0.9.8-26-23 [2020-06-14]
==================================================
* Adding label that LetsEncrypt can be added when you Edit domain
Version 0.9.8-26-22 [13-Jun-2020]
Version 0.9.8-26-22 [2020-06-13]
==================================================
* [Bugfix] Checking (in order to delete) php7.4 pool config file while deleting domain
Version 0.9.8-26-21 [13-Jun-2020]
Version 0.9.8-26-21 [2020-06-13]
==================================================
* [Feature] Blocking executable files inside archives in received emails (ClamAV)
* [Bugfix] Removing ability to schedule LetsEncrypt issuing while adding new domain (because it can fall in infinite loop whole day)
@ -159,82 +323,82 @@ Version 0.9.8-26-21 [13-Jun-2020]
* [Bugfix] Script that removes depricated 'ssl on;' in nginx templates
* [Security] Ensure UPDATE_SSL_SCRIPT is not set in some config files
Version 0.9.8-26-20 [01-Jun-2020]
Version 0.9.8-26-20 [2020-06-01]
==================================================
* [Bugfix] Script that will ensure that Apache2 will always stay in mpm_event mode
* [Bugfix] Ensure config files will not be overwritten while updating vesta-nginx package
* [Bugfix] Fixing URL in v-update-web-templates script
* [Feature] Additional rates for nginx anti-denial-of-service templates
Version 0.9.8-26-19 [15-May-2020]
Version 0.9.8-26-19 [2020-05-15]
==================================================
* [Bugfix] Do not match subdomains while restoring domain [v-restore-user]
Version 0.9.8-26-18 [15-May-2020]
Version 0.9.8-26-18 [2020-05-15]
==================================================
* [Bugfix] Fixing NS parameters in v-add-dns-on-web-alias
Version 0.9.8-26-17 [15-May-2020]
Version 0.9.8-26-17 [2020-05-15]
==================================================
* [Bugfix] Reverting default clamav socket path
* [Bugfix] Put mail_max_userip_connections = 50 in dovecot
Version 0.9.8-26-16 [15-May-2020]
Version 0.9.8-26-16 [2020-05-15]
==================================================
* [Bugfix] Allow quick restarting of nginx if acme-challenge should be added many times
* [Bugfix] Enabling email notification to fresh installed servers about backup success status
* [Bugfix] Timeout 10 sec for apache2 status
Version 0.9.8-26-15 [09-May-2020]
Version 0.9.8-26-15 [2020-05-09]
==================================================
* [Feature] nginx templates that can prevent denial-of-service on your server
* First tuning php-fpm pool.d config files (perfomances and limits)
* New logo
Version 0.9.8-26-14 [08-May-2020]
Version 0.9.8-26-14 [2020-05-08]
==================================================
* v-clone-website script switched to parameters
* Display new version in console while updating myVesta
Version 0.9.8-26-13 [07-May-2020]
Version 0.9.8-26-13 [2020-05-07]
==================================================
* [Feature] Put build date and version in right-bottom corner of control panel
Version 0.9.8-26-12 [07-May-2020]
Version 0.9.8-26-12 [2020-05-07]
==================================================
* [Feature] Put build date and version while compiling myVesta
* [Feature] Office365 DNS template
* [Feature] Yandex DNS template
* ProFTPD MaxIstances = 100 for fresh installed servers
Version 0.9.8-26-11 [01-May-2020]
Version 0.9.8-26-11 [2020-05-01]
==================================================
* [Feature] Skipping LE renewing after 7 failed attempts
* [Bugfix] Keep conf files during auto-update
* [Bugfix] Do not restart apache while preparing letsencrypt acme challenge
* [Bugfix] Set ALLOW_BACKUP_ANYTIME='yes' for fresh installed servers
Version 0.9.8-26-10 [11-Apr-2020]
Version 0.9.8-26-10 [2020-04-11]
==================================================
* [Feature] Creating v-normalize-restored-user script (normalize NS1, NS2 and IP of account that is backuped on other server and restored on this server)
* Tweak for hostname FPM conf
* [Security] Forbid changing root password (Credits to Alexandre ZANNI, Orange Cyberdefense, https://cyberdefense.orange.com)
* [Security] Importing system enviroment in v-change-user-password (Credits to Alexandre ZANNI, Orange Cyberdefense, https://cyberdefense.orange.com)
Version 0.9.8-26-9 [23-Mar-2020]
Version 0.9.8-26-9 [2020-03-23]
==================================================
* [Security] Preventing manipulation with $SERVER['HTTP_HOST'] (Credits to @mdisec - Managing Partner of PRODAFT / INVICTUS A.Ş. Master ninja at pentest.blog)
Version 0.9.8-26-8 [23-Mar-2020]
Version 0.9.8-26-8 [2020-03-23]
==================================================
* [Security] Temporary fix for parsing backup conf (Credits to @dreiggy - https://pentest.blog/vesta-control-panel-second-order-remote-code-execution-0day-step-by-step-analysis/)
Version 0.9.8-26-7 [18-Mar-2020]
Version 0.9.8-26-7 [2020-03-18]
==================================================
* [Bugfix] Fix that avoid LetsEncrypt domain validation timeout
* [Bugfix] Set timeout in v-list-sys-web-status script
Version 0.9.8-26-6 [21-Feb-2020]
Version 0.9.8-26-6 [2020-02-21]
==================================================
* [Bugfix] mail-wrapper.php from now works
* [Feature] Introducing NOTIFY_ADMIN_FULL_BACKUP, email notification about backup success status
@ -242,7 +406,7 @@ Version 0.9.8-26-6 [21-Feb-2020]
* [Feature] Introducing force-https-webmail-phpmyadmin nginx template
* [Feature] Trigger for /root/update_firewall_custom.sh
Version 0.9.8-26-5 [10-Feb-2020]
Version 0.9.8-26-5 [2020-02-10]
==================================================
* [Security] sudoers fix for Debian10
* [Feature] [Script that will migrate your site from http to https, replacing http to https URLs in database](https://github.com/myvesta/vesta/blob/master/src/deb/for-download/tools/v-migrate-site-to-https)
@ -251,7 +415,7 @@ Version 0.9.8-26-5 [10-Feb-2020]
* [Bugfix] Roundcube force https
* [Bugfix] Exim compatibility with Loopia for Debian10
Version 0.9.8-26-4 [07-Jan-2020]
Version 0.9.8-26-4 [2020-01-07]
==================================================
* [Feature] Allow whitelisting specific IP for /api/
* [Feature] Allow whitelisting specific IP to avoid secret_url
@ -259,11 +423,11 @@ Version 0.9.8-26-4 [07-Jan-2020]
* [Bugfix] apparmor install fix again
* [Bugfix] Turning off MariaDB SQL strict mode
Version 0.9.8-26-3 [26-Nov-2019]
Version 0.9.8-26-3 [2019-11-26]
==================================================
* [Bugfix] Better check if session cron already added
Version 0.9.8-26-2 [15-Nov-2019]
Version 0.9.8-26-2 [2019-11-15]
==================================================
* [Feature] Support for sub-sub-sub-sub versions :))
* [Bugfix] Support for longer username of email accounts
@ -271,7 +435,7 @@ Version 0.9.8-26-2 [15-Nov-2019]
* [Bugfix] Trying to fix ClamAV broken socket
* Moving to myvestacp.com
Version 0.9.8-26 [28-Sep-2019]
Version 0.9.8-26 [2019-09-28]
==================================================
* [Bugfix] Let's Encrypt HTTP/2 support (by @serghey-rodin)
* [Bugfix] Fixing broken autoreply output

101
README.md
View file

@ -1,14 +1,95 @@
myVesta
==================================================
Visit our homepage:
- https://www.myvestacp.com/
<h1 align="center"><a href="https://myvestacp.com">myVesta</a></h1>
Forum:
- https://forum.myvestacp.com/
<div style="text-align:center">
[![Screenshot of myVesta](https://www.myvestacp.com/screenshot1.png)](https://www.myvestacp.com/)
</div>
<h1 align="center">About</h1>
<p align="center">myVesta is a security and stability-focused fork of VestaCP, exclusively supporting Debian in order to maintain a streamlined ecosystem. Boasting a clean, clutter-free interface and the latest innovative technologies, our project is committed to staying synchronized with official VestaCP commits. We work independently to enhance security and develop new features, driven by our passion for contributing to the open-source community rather than monetary gain. As such, we will offer all features built for myVesta to the official VestaCP project through pull requests, without interfering with their development milestones.</p>
<p align="center"><b><a href="https://github.com/myvesta/vesta/blob/master/Changelog.md">View Changelog</a>
</b></p>
<h1>Links</h1>
<ul>
<li><a href="https://www.myvestacp.com/">Visit our homepage.</a></li>
<li><a href="https://forum.myvestacp.com/">Check out our forum for discussions and support.</a></li>
<li><a href="https://wiki.myvestacp.com/">For more information, take a look at our knowledge base.</a></li>
</ul>
<h1>Features of myVesta</h1>
<ul>
<li>Support for Debian 11 and 12 (Debian 12 is recommended, but previous Debian releases are also supported)</li>
<li>Support for MySQL 8</li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=20&t=51">nginx templates</a> that can prevent denial-of-service on your server</li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=18&t=52">Support for multi-PHP versions</a></li>
<li>You can <a href="https://forum.myvestacp.com/viewtopic.php?f=20&t=350">host NodeJS apps</a></li>
<li>You can limit the maximum number of sent emails (per hour) <a href="https://github.com/myvesta/vesta/blob/master/install/debian/10/exim/exim4.conf.template#L112-L113">per mail account</a> and <a href="https://github.com/myvesta/vesta/blob/master/install/debian/10/exim/exim4.conf.template#L72-L73">per hosting account</a>, preventing hijacking of email accounts and preventing PHP malware scripts to send spam.</li>
<li>
You can completely "lock" myVesta so it can be accessed only via secret URL, for example https://serverhost:8083/?MY-SECRET-URL
<ul>
<li>During installation you will be asked to choose a secret URL for your hosting panel</li>
<li>Literally no PHP scripts will be alive on your hosting panel (won't be able to get executed), unless you access the hosting panel with secret URL parameter. Thus, when it happens that, let's say, some zero-day exploit pops up - attackers won't be able to access it without knowing your secret URL - PHP scripts from VestaCP will be simply dead - no one will be able to interact with your panel unless they have the secret URL.</li>
<li>You can see for yourself how this mechanism was built by looking at:</li>
<ul>
<li><a href="https://github.com/myvesta/vesta/blob/master/src/deb/for-download/php/php.ini#L496">src/deb/for-download/php/php.ini</a></li>
<li><a href="https://github.com/myvesta/vesta/blob/master/web/inc/secure_login.php">web/inc/secure_login.php</a></li>
</ul>
<li>If you didn't set the secret URL during installation, you can do it anytime. Just execute in shell: <code>echo "&lt;?php \$login_url='MY-SECRET-URL';" > /usr/local/vesta/web/inc/login_url.php</code></li>
</ul>
</li>
<li>We <a href="https://github.com/myvesta/vesta/blob/master/install/debian/10/php/php7.3-dedi.patch#L9">disabled dangerous PHP functions</a> in php.ini, so even if, for example, your customer's CMS gets compromised, hacker will not be able to execute shell scripts from within PHP.</li>
<li>Apache is fully switched to mpm_event mode, while PHP is running in PHP-FPM mode, which is the most stable PHP-stack solution
<ul><li>OPCache is turned on by default</li></ul>
<li>Auto-generating LetsEncrypt SSL for server hostname (signed SSL for Vesta 8083 port, for dovecot (IMAP & POP3) and for Exim (SMTP))</li>
<li>You can change Vesta port during installation or later using one command line: v-change-vesta-port [number]</li>
<li>ClamAV is configured to block zip/rar/7z archives that contains executable files (just like GMail)</li>
<li>Backup will run with lowest priority (to avoid load on server), and can be configured to run only by night (and to stop on the morning and continue next night) </li>
<ul>
<li>You can compile Vesta binaries by yourself - <a href="https://github.com/myvesta/vesta/blob/master/src/deb/vesta_compile.sh">src/deb/vesta_compile.sh</a></li>
<li>You can even create your own APT repository in a minute</li>
<li>We are using latest nginx version for vesta-nginx package</li>
<li>With your own APT infrastructure you can take security of Vesta-installer infrastructure in your own hands. You will have full control of your Vesta code (this way you can rest assured that there's 0% chance that you'll install malicious packages from repositories that may get hacked)</li>
<li>Binaries that you compile are 100% compatible with official VestaCP from vestacp.com, so you can run official VestaCP code with your own binaries (in case you don't want the source code from this fork)</li>
</ul>
</li>
</ul>
<h1>How to install</h1>
Download the installation script:
```shell
curl -O http://c.myvestacp.com/vst-install-debian.sh
```
Then run it:
```shell
bash vst-install-debian.sh
```
Or use our <a href="https://www.myvestacp.com/install_generator.html">installer generator</a>.
<h1>Useful scripts</h1>
<ul>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=24&t=50">How to move accounts from one (my)Vesta server to another myVesta server</a></li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=17&t=386">WordPress installer in one second </a></li>(v-install-wordpress)
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=17&t=385">Cloning script that will copy the whole site from one (sub)domain to another (sub)domain </a></li>(v-clone-website)
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=17&t=382">Script that will migrate your site from http to https, replacing http to https URLs in database </a></li>(v-migrate-site-to-https)
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=24&t=63">Script for importing cPanel backups to Vesta (thanks to Maks Usmanov - Skamasle) </a></li> (v-import-cpanel-backup)
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=18&t=52">Script that will install multiple PHP versions on your server</a></li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=20&t=350">How to host NodeJS apps</a></li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=20&t=51">Script that will install nginx templates that can prevent denial-of-service on your server</a></li>
<li><a href="https://forum.myvestacp.com/viewtopic.php?f=15&t=47">Official VestaCP Softaculous installer</a></li>
</ul>
<h1>Licence</h1>
myVesta is licensed under <a href="https://github.com/serghey-rodin/vesta/blob/master/LICENSE">GPL v3</a> license.
Knowledge base:
- https://wiki.myvestacp.com/
Changelog:
- https://github.com/myvesta/vesta/blob/master/Changelog.md

144
bin/v-activate-rocket-nginx Normal file
View file

@ -0,0 +1,144 @@
#!/bin/bash
# info: Install rocket-nginx extension for certain domain
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain doesn't exist";
exit 1;
fi
if [ ! -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
echo 'Please install WordPress first.'
exit 1;
fi
if [ ! -d "/etc/nginx/rocket-nginx" ]; then
echo "rocket-nginx is not installed";
echo "Do you want to install it now (y/n)?"
read answer
if [ "$answer" == "y" ]; then
echo "Installing rocket-nginx..."
curl -sL https://c.myvestacp.com/tools/install-rocket-nginx.sh | bash -
else
echo "Exiting script"
exit 1;
fi
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Changing Proxy Template
# Check if the proxy template is already set correctly
current_template=$(/usr/local/vesta/bin/v-list-web-domain $user $domain | grep 'PROXY:' | awk '{print $2}')
if [ "$current_template" == "wprocket-force-https" ] || [ "$current_template" == "wprocket-hosting" ] || [ "$current_template" == "wprocket-webp-express-force-https" ]; then
echo "Proxy Template is already set up correctly"
else
# Prompt the user to choose whether to force HTTPS or not
echo "Do you want to use wprocket-hosting template, wprocket-force-https template or wprocket-webp-express-force-https template (h/f/w):"
read answer
# Change the proxy template based on the user's choice
if [ "$answer" == "h" ]; then
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "wprocket-hosting"
elif [ "$answer" == "f" ]; then
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "wprocket-force-https"
elif [ "$answer" == "w" ]; then
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "wprocket-webp-express-force-https"
fi
echo "Proxy Template is ready"
fi
# Disabling wp-cron in wp-config.php
cd /home/$user/web/$domain/public_html
checkstring_disable="define('DISABLE_WP_CRON', true)"
checkstring_enable="define('DISABLE_WP_CRON', false)"
string_disable="define( 'DISABLE_WP_CRON', true );"
line="<?php"
file="wp-config.php"
if grep -q -w -i -F "$checkstring_disable" "$file"; then
echo "WP-Cron is already disabled in your wp-config.php"
elif grep -q -w -i -F "$checkstring_enable" "$file"; then
echo "Disabling WP-Cron in your wp-config.php..."
sed -i "/$checkstring_enable/d" "$file"
sed -i "/$line/Ia $string_disable" "$file"
else
echo "Disabling WP-Cron in your wp-config.php..."
sed -i "/$line/Ia $string_disable" "$file"
fi
# Adding cron job
# Check if a cron job already exists for any of the specified PHP-FPM versions
existing_cron=$(crontab -l -u $user | grep -o "wp-cron.php >/home/$user/web/$domain/cron.log" | grep -v "grep")
if [ ! -z "$existing_cron" ]; then
echo "There is already a cron job added for user $user and domain $domain."
else
echo "Adding cron job..."
# Add the cron job
fpm_ver=$(/usr/local/vesta/bin/v-get-php-version-of-domain "$domain")
touch /home/$user/web/$domain/cron.log
chown $user:$user /home/$user/web/$domain/cron.log
case $fpm_ver in
5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 | 8.1 | 8.2 | 8.3)
/usr/local/vesta/bin/v-add-cron-job "$user" "*/15" "*" "*" "*" "*" "cd /home/$user/web/$domain/public_html; /usr/bin/php$fpm_ver wp-cron.php >/home/$user/web/$domain/cron.log 2>&1"
;;
esac
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "Installation is completed."
echo "Checking RESPONSE HEADERS (You should see x-rocket-nginx-serving-static if the WP Rocket plugin is activated):"
curl -I https://$domain
exit

View file

@ -72,6 +72,13 @@ $iptables -I fail2ban-$chain 1 -s $ip \
# Changing permissions
chmod 660 $conf
# nginx deny rules conf
if [ "$chain" = "WEB" ] && [ -f "/etc/nginx/conf.d/block.conf" ]; then
if ! grep -q "deny $ip;" /etc/nginx/conf.d/block.conf; then
echo "deny $ip;" >> /etc/nginx/conf.d/block.conf
systemctl reload nginx
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -83,6 +83,16 @@ sort_fw_rules
# Updating system firewall
$BIN/v-update-firewall
if [ "$WEB_SYSTEM" == 'nginx' ] || [ "$PROXY_SYSTEM" == 'nginx' ]; then
if [ "$port_ext" == "80,443" ] && [ "$action" == "DROP" ]; then
touch /etc/nginx/conf.d/block-firewall.conf
if ! grep -q "deny $ip;" /etc/nginx/conf.d/block-firewall.conf; then
echo "deny $ip;" >> /etc/nginx/conf.d/block-firewall.conf
systemctl restart nginx
fi
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -17,6 +17,12 @@ aliases=$3
# LE API
API='https://acme-v02.api.letsencrypt.org'
if [[ "$LE_STAGING" = 'yes' ]]; then
API='https://acme-staging-v02.api.letsencrypt.org'
fi
deb_release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
@ -56,8 +62,12 @@ query_le_v2() {
# Save http response to file passed as "$4" arg or print to stdout if not provided
# http response headers are always sent to stdout
local save_to_file=${4:-"/dev/stdout"}
curl --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
}
if [ "$deb_release" -gt 8 ]; then
curl --location --user-agent "myVesta" --insecure --retry 5 --retry-connrefused --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
else
curl --location --user-agent "myVesta" --insecure --retry 5 --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
fi
}
@ -123,7 +133,7 @@ fi
# Requesting nonce / STEP 1
echo "[$(date)] : --- Requesting nonce / STEP 1 ---" >> /usr/local/vesta/log/letsencrypt.log
echo "[$(date)] : curl -s -I \"$API/directory\"" >> /usr/local/vesta/log/letsencrypt.log
answer=$(curl -s -I "$API/directory")
answer=$(curl --user-agent "myVesta" -s -I "$API/directory")
echo "[$(date)] : answer=$answer" >> /usr/local/vesta/log/letsencrypt.log
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
echo "[$(date)] : nonce=$nonce" >> /usr/local/vesta/log/letsencrypt.log
@ -144,6 +154,11 @@ for identifier in $(echo $domain,$aliases |tr ',' '\n' |sort -u); do
done
payload=$(echo "$payload"|sed "s/,$//")
payload=$payload']}'
# validation='pending'
# # Start counter to avoid infinite loop
# i=0
# while [ "$validation" = 'pending' ]; do
# echo "[$(date)] : ----------------------- step 2 loop, counter \$i=$i -----------------------" >> /usr/local/vesta/log/letsencrypt.log
echo "[$(date)] : payload=$payload" >> /usr/local/vesta/log/letsencrypt.log
echo "[$(date)] : query_le_v2 \"$url\" \"$payload\" \"$nonce\"" >> /usr/local/vesta/log/letsencrypt.log
answer=$(query_le_v2 "$url" "$payload" "$nonce")
@ -154,12 +169,23 @@ authz=$(echo "$answer" |grep "acme/authz" |cut -f2 -d '"')
echo "[$(date)] : authz=$authz" >> /usr/local/vesta/log/letsencrypt.log
finalize=$(echo "$answer" |grep 'finalize":' |cut -f4 -d '"')
echo "[$(date)] : finalize=$finalize" >> /usr/local/vesta/log/letsencrypt.log
order=$(echo -e "$answer" | grep -i location | cut -f2 -d \ | tr -d '\r\n')
echo "[$(date)] : order=$order" >> /usr/local/vesta/log/letsencrypt.log
status=$(echo "$answer" |grep HTTP/ |tail -n1 |cut -f2 -d ' ')
echo "[$(date)] : status=$status" >> /usr/local/vesta/log/letsencrypt.log
validation=$(echo "$answer" | grep 'status":' | cut -f4 -d '"')
echo "[$(date)] : validation=$validation" >> /usr/local/vesta/log/letsencrypt.log
if [[ "$status" -ne 201 ]]; then
echo "[$(date)] : EXIT=Let's Encrypt new auth status $status" >> /usr/local/vesta/log/letsencrypt.log
check_result $E_CONNECT "Let's Encrypt new auth status $status"
fi
# # Exit the loop after 5 attempts
# i=$((i + 1))
# if [ $i -gt 5 ]; then
# break
# fi
# sleep 2
# done
# Requesting authorization token / STEP 3
echo "[$(date)] : --- Requesting authorization token / STEP 3 ---" >> /usr/local/vesta/log/letsencrypt.log
@ -200,6 +226,7 @@ for auth in $authz; do
echo "[$(date)] : EXIT=DNS _acme-challenge record wasn't created" >> /usr/local/vesta/log/letsencrypt.log
fi
check_result $exitstatus "DNS _acme-challenge record wasn't created"
systemctl restart bind9
else
if [ "$WEB_SYSTEM" = 'nginx' ] || [ ! -z "$PROXY_SYSTEM" ]; then
if [ -f "/usr/local/vesta/web/inc/nginx_proxy" ]; then
@ -263,7 +290,9 @@ for auth in $authz; do
# Doing pol check on status
i=1
while [ "$validation" = 'pending' ]; do
echo "[$(date)] : - Doing pol check on status" >> /usr/local/vesta/log/letsencrypt.log
i=0
while true; do
echo "[$(date)] : ----------------------- Doing pol check on status, counter \$i=$i -----------------------" >> /usr/local/vesta/log/letsencrypt.log
payload='{}'
echo "[$(date)] : query_le_v2 \"$url\" \"$payload\" \"$nonce\"" >> /usr/local/vesta/log/letsencrypt.log
answer=$(query_le_v2 "$url" "$payload" "$nonce")
@ -276,6 +305,20 @@ for auth in $authz; do
echo "[$(date)] : nonce=$nonce" >> /usr/local/vesta/log/letsencrypt.log
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
echo "[$(date)] : status=$status" >> /usr/local/vesta/log/letsencrypt.log
if [[ $(echo "$answer" | grep 'addressesResolved') != "" ]]; then
break
fi
if [ "$wildcard" = 'yes' ]; then
if [[ $(echo "$answer" | grep '"status": "valid"') != "" ]]; then
break
fi
fi
i=$((i + 1))
if ((i > 30)); then
break
fi
sleep 2
done
if [[ "$status" -ne 200 ]]; then
echo "[$(date)] : EXIT=Let's Encrypt validation status $status" >> /usr/local/vesta/log/letsencrypt.log
check_result $E_CONNECT "Let's Encrypt validation status $status"
@ -287,7 +330,7 @@ for auth in $authz; do
check_result $E_CONNECT "Let's Encrypt domain validation timeout"
fi
echo "[$(date)] : curl: $url2 :" >> /usr/local/vesta/log/letsencrypt.log
get_answer=$(curl --silent -S "$url2")
get_answer=$(curl --user-agent "myVesta" --silent -S "$url2")
echo "[$(date)] : get_answer=$get_answer" >> /usr/local/vesta/log/letsencrypt.log
sleeping=$((i*2))
echo "[$(date)] : sleep $sleeping (i=$i)" >> /usr/local/vesta/log/letsencrypt.log
@ -323,8 +366,41 @@ if [[ "$status" -ne 200 ]]; then
check_result $E_CONNECT "Let's Encrypt finalize bad status $status"
fi
# Downloading signed certificate / STEP 7
echo "[$(date)] : --- Downloading signed certificate / STEP 7 ---" >> /usr/local/vesta/log/letsencrypt.log
if [ "$nonce" = "" ]; then
echo "[$(date)] : EXIT=Let's Encrypt 'nonce' is empty after step 6" >> /usr/local/vesta/log/letsencrypt.log
check_result $E_CONNECT "Let's Encrypt 'nonce' is empty after step 6"
fi
if [ "$certificate" = "" ]; then
validation="processing"
i=1
while [ "$validation" = "processing" ]; do
echo "[$(date)] : --- Polling server waiting for Certificate / STEP 7 ---" >> /usr/local/vesta/log/letsencrypt.log
answer=$(query_le_v2 "$order" "" "$nonce")
i=$((i + 1))
nonce=$(echo "$answer" | grep -i nonce | cut -f2 -d \ | tr -d '\r\n')
echo "[$(date)] : answer=$answer" >> /usr/local/vesta/log/letsencrypt.log
status=$(echo "$answer" | grep HTTP/ | tail -n1 | cut -f 2 -d ' ')
echo "[$(date)] : status=$status" >> /usr/local/vesta/log/letsencrypt.log
validation=$(echo "$answer" | grep 'status":' | cut -f4 -d '"')
echo "[$(date)] : validation=$validation" >> /usr/local/vesta/log/letsencrypt.log
certificate=$(echo "$answer" | grep 'certificate":' | cut -f4 -d '"')
echo "[$(date)] : certificate=$certificate" >> /usr/local/vesta/log/letsencrypt.log
sleep $((i * 2)) # Sleep for 2s, 4s, 6s, 8s
if [ $i -gt 10 ]; then
check_result "$E_CONNECT" "Certificate processing timeout ($domain)"
fi
done
fi
if [ "$certificate" = "" ]; then
echo "[$(date)] : EXIT=Let's Encrypt 'certificate' is empty after step 7" >> /usr/local/vesta/log/letsencrypt.log
check_result $E_CONNECT "Let's Encrypt 'certificate' is empty after step 7"
fi
# Downloading signed certificate / STEP 8
echo "[$(date)] : --- Downloading signed certificate / STEP 8 ---" >> /usr/local/vesta/log/letsencrypt.log
echo "[$(date)] : query_le_v2 \"$certificate\" \"\" \"$nonce\"" >> /usr/local/vesta/log/letsencrypt.log
answer=$(query_le_v2 "$certificate" "" "$nonce" "$ssl_dir/$domain.pem")
echo "[$(date)] : answer=$answer" >> /usr/local/vesta/log/letsencrypt.log

View file

@ -15,6 +15,10 @@ user=$1
# LE API
API='https://acme-v02.api.letsencrypt.org'
if [[ "$LE_STAGING" = 'yes' ]]; then
API='https://acme-staging-v02.api.letsencrypt.org'
fi
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
@ -41,7 +45,7 @@ query_le_v2() {
post_data=$post_data'"payload":"'"$payload_"'",'
post_data=$post_data'"signature":"'"$signature_"'"}'
curl -s -i -d "$post_data" "$1" -H "$content"
curl --user-agent "myVesta" -s -i -d "$post_data" "$1" -H "$content"
}

View file

@ -0,0 +1,77 @@
#!/bin/bash
gen_pass() {
MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
if [ -z "$1" ]; then
LENGTH=32
else
LENGTH=$1
fi
while [ ${n:=1} -le $LENGTH ]; do
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
let n+=1
done
echo "$PASS"
}
eximversion=$(exim4 --version | grep '^Exim version ' | awk '{print $3}')
if (( $(echo "$eximversion < 4.96" | bc -l) )); then
echo "= ERROR: Exim SRS support requires Exim 4.96 or higher."
echo "You have Exim $eximversion"
exit 1;
fi
echo "=== Addind SRS support to Exim4 ==="
# SRS support is taken from HestiaCP
if [ ! -f "/etc/exim4/srs.conf" ]; then
echo "= Generating SRS KEY"
srs=$(gen_pass 16)
echo $srs > /etc/exim4/srs.conf
chmod 640 /etc/exim4/srs.conf
chown root:Debian-exim /etc/exim4/srs.conf
fi
if [ ! -f "/etc/exim4/exim4.conf.template.backup-without-srs" ]; then
echo "= Backing up /etc/exim4/exim4.conf.template"
cp /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template.backup-without-srs
fi
if ! /usr/local/vesta/bin/v-grep 'SRS_SECRET = ' '/etc/exim4/exim4.conf.template' '-q'; then
echo "= Adding: SRS_SECRET = readfile /etc/exim4/srs.conf"
v-sed 'smtputf8_advertise_hosts =' 'smtputf8_advertise_hosts =\n\nSRS_SECRET = ${readfile{/etc/exim4/srs.conf}}' '/etc/exim4/exim4.conf.template'
fi
if ! /usr/local/vesta/bin/v-grep 'if outbound, and forwarding has been done, use an alternate transport' '/etc/exim4/exim4.conf.template' '-q'; then
echo "= Patching \"dnslookup:\" block"
/usr/local/vesta/bin/v-php-func "replace_in_file_once_between_including_borders" "/etc/exim4/exim4.conf.template" 'dnslookup:' ' no_more' 'dnslookup:\n driver = dnslookup\n # if outbound, and forwarding has been done, use an alternate transport\n domains = ! +local_domains\n transport = ${if eq {$local_part@$domain} \\n {$original_local_part@$original_domain} \\n {remote_smtp} {remote_forwarded_smtp}}\n no_more'
fi
if ! /usr/local/vesta/bin/v-grep 'inbound_srs:' '/etc/exim4/exim4.conf.template' '-q'; then
echo "= Adding \"inbound_srs\" and \"inbound_srs_failure\" blocks"
v-sed 'aliases:' 'inbound_srs:\n driver = redirect\n senders = :\n domains = +local_domains\n # detect inbound bounces which are converted to SRS, and decode them\n condition = ${if inbound_srs {$local_part} {SRS_SECRET}}\n data = $srs_recipient\n\ninbound_srs_failure:\n driver = redirect\n senders = :\n domains = +local_domains\n # detect inbound bounces which look converted to SRS but are invalid\n condition = ${if inbound_srs {$local_part} {}}\n allow_fail\n data = :fail: Invalid SRS recipient address\n\naliases:' '/etc/exim4/exim4.conf.template'
fi
if ! /usr/local/vesta/bin/v-grep 'remote_forwarded_smtp:' '/etc/exim4/exim4.conf.template' '-q'; then
echo "= Adding \"remote_forwarded_smtp:\" block"
v-sed 'procmail:\n driver = pipe' 'remote_forwarded_smtp:\n driver = smtp\n dkim_domain = DKIM_DOMAIN\n dkim_selector = mail\n dkim_private_key = DKIM_PRIVATE_KEY\n dkim_canon = relaxed\n dkim_strict = 0\n hosts_try_fastopen = \n hosts_try_chunking = !93.188.3.0/24\n message_linelength_limit = 1G\n # modify the envelope from, for mails that we forward\n max_rcpt = 1\n return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}\n\nprocmail:\n driver = pipe' '/etc/exim4/exim4.conf.template'
fi
touch /etc/exim4/limit_per_email_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_email_account_max_recipients
touch /etc/exim4/limit_per_hosting_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_hosting_account_max_recipients
echo "= Restarting exim4 service"
systemctl restart exim4
if [ $? -ne 0 ]; then
systemctl status exim4
cp /etc/exim4/exim4.conf.template.backup-without-srs /etc/exim4/exim4.conf.template
systemctl restart exim4
echo "=== Patching failed, old exim conf returned, exim4 restarted again."
exit 1
fi
echo "=== SRS support was added successfully. ==="
exit 0

View file

@ -28,7 +28,7 @@ is_package_new() {
}
is_package_consistent() {
source $pkg_dir/$package.pkg
parse_object_kv_list_non_eval $(cat $pkg_dir/$package.pkg)
if [ "$WEB_DOMAINS" != 'unlimited' ]; then
is_int_format_valid $WEB_DOMAINS 'WEB_DOMAINS'
fi
@ -63,6 +63,9 @@ is_package_consistent() {
is_int_format_valid $BACKUPS 'BACKUPS'
fi
is_format_valid_shell $SHELL
is_web_template_valid $WEB_TEMPLATE
is_dns_template_valid $DNS_TEMPLATE
is_proxy_template_valid $PROXY_TEMPLATE
}

View file

@ -90,7 +90,7 @@ done
# Changing file owner & permission
chown -R $user:$user $HOMEDIR/$user/web/$domain
chown root:$user /var/log/$WEB_SYSTEM/domains/$domain.* $conf
sudo -u $user chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.*
chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.*
sudo -u $user chmod 751 $HOMEDIR/$user/web/$domain $HOMEDIR/$user/web/$domain/*
sudo -u $user chmod 551 $HOMEDIR/$user/web/$domain/stats $HOMEDIR/$user/web/$domain/logs
sudo -u $user chmod 644 $HOMEDIR/$user/web/$domain/public_*html/*.*

76
bin/v-add-wordpress-admin Normal file
View file

@ -0,0 +1,76 @@
#!/bin/bash
# info: Add a WordPress admin user to a specific domain
# options: DOMAIN USERNAME PASSWORD EMAIL
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
if [ "$#" -lt 4 ]; then
echo "Usage: v-add-wordpress-admin [DOMAIN] [USERNAME] [PASSWORD] [EMAIL]"
exit 1
fi
# Importing system environment
source /etc/profile
SILENT_MODE=1
# Argument definition
domain=$1
username=$2
password=$3
email=$4
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '4' "$#" 'DOMAIN USERNAME PASSWORD EMAIL'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain doesn't exist";
exit 1;
fi
if [ ! -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
echo 'Please install WordPress first.'
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
/usr/local/vesta/bin/v-run-wp-cli $domain user create $username $email --role=administrator --user_pass="$password" --skip-plugins --skip-themes;
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit 0;

View file

@ -22,6 +22,9 @@ source $VESTA/func/domain.sh
source $VESTA/func/db.sh
source $VESTA/conf/vesta.conf
if [ ! -z "$NOW" ]; then
BACKUP_LA_LIMIT=50
fi
#----------------------------------------------------------#
# Verifications #
@ -251,6 +254,11 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
if [ ! -z "$exlusion" ]; then
xdirs="$(echo -e "$exlusion" |tr ':' '\n' |grep -v $domain)"
for xpath in $xdirs; do
# Add ./ at the beginning of the path if the path is in old pattern
if [[ $xpath != ./* ]]; then
xpath=(./$xpath)
fi
if [ -d "$xpath" ]; then
fargs+=(--exclude=$xpath/*)
echo "$(date "+%F %T") excluding directory $xpath"
@ -265,7 +273,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
set +f
# Backup files
tar --anchored -cpf- ${fargs[@]} * |gzip -$BACKUP_GZIP - > $tmpdir/web/$domain/domain_data.tar.gz
tar --anchored -cpf- ${fargs[@]} --exclude={'./','../'} . |gzip -$BACKUP_GZIP - > $tmpdir/web/$domain/domain_data.tar.gz
done
# Print total

6
bin/v-backup-user-now Normal file
View file

@ -0,0 +1,6 @@
#!/bin/bash
export ALLOW_BACKUP_ANYTIME='yes'
export NOW='yes'
nice -n 19 ionice -c 3 /usr/local/vesta/bin/v-backup-user $1

View file

@ -37,7 +37,7 @@ fi
log=$VESTA/log/backup.log
$BIN/v-check-vesta-license >/dev/null
# $BIN/v-check-vesta-license >/dev/null
touch $log
if [ ! -z "$NOTIFY_ADMIN_FULL_BACKUP" ]; then

View file

@ -0,0 +1,102 @@
#!/bin/bash
# info: Add a specific email address to exim4 and spamassassin blacklist
# usage: v-blacklist-email-account EMAIL
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Determine Debian version and set SpamAssassin service name
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -lt 12 ]; then
SPAMD_SERVICE="spamassassin.service"
else
SPAMD_SERVICE="spamd.service"
fi
DENY_SENDERS_FILE="/etc/exim4/deny_senders"
SPAMASSASSIN_FILE="/etc/spamassassin/local.cf"
# Flags to track changes
SPAMASSASSIN_CHANGED=false
# Function to check if an entry already exists in a file
check_entry_exists() {
local entry=$1
local file=$2
grep -qF "$entry" "$file"
}
# Function to add an entry to a file
add_entry_to_file() {
local entry=$1
local file=$2
echo "$entry" >> "$file"
}
# Display usage if no arguments are provided
if [ $# -lt 1 ]; then
echo "Usage: v-blacklist-email EMAIL"
exit 1
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
EMAIL=$1
# Validate email format
if [[ ! "$EMAIL" =~ ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then
echo "Invalid email address format."
exit 1
fi
# Prepare entries for Exim4 and SpamAssassin
EXIM_ENTRY="$EMAIL"
SPAMASSASSIN_ENTRY="blacklist_from $EMAIL"
#----------------------------------------------------------#
# Exim4 Blacklist #
#----------------------------------------------------------#
echo "Updating $DENY_SENDERS_FILE..."
if ! check_entry_exists "$EXIM_ENTRY" "$DENY_SENDERS_FILE"; then
add_entry_to_file "$EXIM_ENTRY" "$DENY_SENDERS_FILE"
echo "Added $EXIM_ENTRY to $DENY_SENDERS_FILE."
else
echo "$EXIM_ENTRY already exists in $DENY_SENDERS_FILE."
fi
#----------------------------------------------------------#
# SpamAssassin Blacklist #
#----------------------------------------------------------#
echo "Updating $SPAMASSASSIN_FILE..."
if ! check_entry_exists "$SPAMASSASSIN_ENTRY" "$SPAMASSASSIN_FILE"; then
add_entry_to_file "$SPAMASSASSIN_ENTRY" "$SPAMASSASSIN_FILE"
echo "Added $SPAMASSASSIN_ENTRY to $SPAMASSASSIN_FILE."
SPAMASSASSIN_CHANGED=true
else
echo "$SPAMASSASSIN_ENTRY already exists in $SPAMASSASSIN_FILE."
fi
if [ "$SPAMASSASSIN_CHANGED" == "true" ]; then
systemctl restart "$SPAMD_SERVICE"
echo "SpamAssassin service ($SPAMD_SERVICE) restarted."
fi
#----------------------------------------------------------#
# Done #
#----------------------------------------------------------#
exit 0

View file

@ -0,0 +1,133 @@
#!/bin/bash
# info: Add a domain to exim4 and spamassassin blacklist
# usage: v-blacklist-email-domain DOMAIN SUBDOMAIN(YES/NO)
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Determine Debian version and set SpamAssassin service name
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -lt 12 ]; then
SPAMD_SERVICE="spamassassin.service"
else
SPAMD_SERVICE="spamd.service"
fi
DENY_SENDERS_FILE="/etc/exim4/deny_senders"
SPAMASSASSIN_FILE="/etc/spamassassin/local.cf"
# Flags to track changes
SPAMASSASSIN_CHANGED=false
# Function to check if a domain already exists in a file
check_domain_exists() {
local domain=$1
local file=$2
grep -qE "^${domain}$" "$file"
}
# Function to check if a SpamAssassin entry already exists
check_spamassassin_exists() {
local entry=$1
local file=$2
grep -qF "$entry" "$file"
}
# Function to add domain to file
add_domain_to_file() {
local domain=$1
local file=$2
echo "$domain" >> "$file"
}
# Display usage if no arguments are provided
if [ $# -lt 2 ]; then
echo "Usage: v-blacklist-domain DOMAIN SUBDOMAIN(YES/NO)"
exit 1
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
DOMAIN=$1
SUBDOMAIN=${2^^} # Convert to uppercase for consistency (YES/NO)
# Validate SUBDOMAIN parameter
if [[ "$SUBDOMAIN" != "YES" && "$SUBDOMAIN" != "NO" ]]; then
echo "Invalid parameter for SUBDOMAIN. Use YES or NO."
exit 1
fi
# Prepare entries for Exim4
EXIM_ENTRY_MAIN="$DOMAIN"
EXIM_ENTRY_SUB="*.$DOMAIN"
# Prepare entries for SpamAssassin
SPAMASSASSIN_ENTRY_MAIN="blacklist_from *@${DOMAIN}"
SPAMASSASSIN_ENTRY_SUB="blacklist_from *.$DOMAIN"
#----------------------------------------------------------#
# Exim4 Blacklist #
#----------------------------------------------------------#
echo "Updating $DENY_SENDERS_FILE..."
if ! check_domain_exists "$EXIM_ENTRY_MAIN" "$DENY_SENDERS_FILE"; then
add_domain_to_file "$EXIM_ENTRY_MAIN" "$DENY_SENDERS_FILE"
echo "Added $EXIM_ENTRY_MAIN to $DENY_SENDERS_FILE."
else
echo "$EXIM_ENTRY_MAIN already exists in $DENY_SENDERS_FILE."
fi
if [ "$SUBDOMAIN" == "YES" ]; then
if ! check_domain_exists "$EXIM_ENTRY_SUB" "$DENY_SENDERS_FILE"; then
add_domain_to_file "$EXIM_ENTRY_SUB" "$DENY_SENDERS_FILE"
echo "Added $EXIM_ENTRY_SUB to $DENY_SENDERS_FILE."
else
echo "$EXIM_ENTRY_SUB already exists in $DENY_SENDERS_FILE."
fi
fi
#----------------------------------------------------------#
# SpamAssassin Blacklist #
#----------------------------------------------------------#
echo "Updating $SPAMASSASSIN_FILE..."
if ! check_spamassassin_exists "$SPAMASSASSIN_ENTRY_MAIN" "$SPAMASSASSIN_FILE"; then
add_domain_to_file "$SPAMASSASSIN_ENTRY_MAIN" "$SPAMASSASSIN_FILE"
echo "Added $SPAMASSASSIN_ENTRY_MAIN to $SPAMASSASSIN_FILE."
SPAMASSASSIN_CHANGED=true
else
echo "$SPAMASSASSIN_ENTRY_MAIN already exists in $SPAMASSASSIN_FILE."
fi
if [ "$SUBDOMAIN" == "YES" ]; then
if ! check_spamassassin_exists "$SPAMASSASSIN_ENTRY_SUB" "$SPAMASSASSIN_FILE"; then
add_domain_to_file "$SPAMASSASSIN_ENTRY_SUB" "$SPAMASSASSIN_FILE"
echo "Added $SPAMASSASSIN_ENTRY_SUB to $SPAMASSASSIN_FILE."
SPAMASSASSIN_CHANGED=true
else
echo "$SPAMASSASSIN_ENTRY_SUB already exists in $SPAMASSASSIN_FILE."
fi
fi
if [ "$SPAMASSASSIN_CHANGED" == "true" ]; then
systemctl restart "$SPAMD_SERVICE"
echo "SpamAssassin service ($SPAMD_SERVICE) restarted."
fi
#----------------------------------------------------------#
# Done #
#----------------------------------------------------------#
exit 0

View file

@ -60,6 +60,10 @@ if [ ! -z "$check_db" ]; then
exit $E_EXISTS
fi
if [ ! -d "/backup" ]; then
echo "There is no /backup folder, creating it now..."
mkdir /backup
fi
#----------------------------------------------------------#
# Action #

View file

@ -0,0 +1,65 @@
#!/bin/bash
# info: change db password to all wordpress databases
# options:
#
# The command is used for changing db password to all wordpress databases on the server.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Importing system variables
source /etc/profile
# Includes
source $VESTA/func/main.sh
only_user='';
if [ ! -z "$1" ]; then
only_user=$1
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
touch /root/remember-db-user-pass.txt
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
continue;
fi
if [ ! -z "$only_user" ]; then
if [ "$only_user" != "$user" ]; then
continue;
fi
fi
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
if [ -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
/usr/local/vesta/bin/v-change-database-password-for-wordpress $domain $user
echo "--------------------------------"
fi
done
if [ ! -z "$only_user" ]; then
break;
fi
done
# cat /root/remember-db-user-pass.txt
if [ -f "/root/remember-db-user-pass.txt" ]; then
rm /root/remember-db-user-pass.txt
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -0,0 +1,132 @@
#!/bin/bash
# info: change database password for wordpress
# options:
#
# The command is used for changing database password for wordpress.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
# Check if number of arguments is 2
if [ $# -eq 2 ]; then
user=$2
else
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
fi
USER=$user
if [ -z "$user" ]; then
echo "ERROR: Domain $domain not found"
exit 1;
fi
if [ ! -d "/home/$user" ]; then
echo "ERROR: User $user doesn't exist";
exit 1;
fi
# Includes
source /usr/local/vesta/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "ERROR: Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
echo "=== Domain: $domain"
wp_config_path="/home/$user/web/$domain/public_html/wp-config.php"
if grep -q $'\r' $wp_config_path; then
echo "=== removing CRLF from wp-config.php"
tr -d '\r' < $wp_config_path > /tmp/wp-config.php && mv /tmp/wp-config.php $wp_config_path
chown $user:$user $wp_config_path
fi
db_name=$(grep "DB_NAME" $wp_config_path | grep -oP "define\s*\(\s*'DB_NAME'\s*,\s*'\K[^']+")
db_user=$(grep "DB_USER" $wp_config_path | grep -oP "define\s*\(\s*'DB_USER'\s*,\s*'\K[^']+")
if [ -z "$db_name" ]; then
db_name=$(grep "DB_NAME" $wp_config_path | grep -oP "define\s*\(\s*'DB_NAME'\s*,\s*\"\K[^\"]+")
fi
if [ -z "$db_user" ]; then
db_user=$(grep "DB_USER" $wp_config_path | grep -oP "define\s*\(\s*'DB_USER'\s*,\s*\"\K[^\"]+")
fi
new_password=''
found_existing_password=0
if [ -f "/root/remember-db-user-pass.txt" ]; then
db_user_pass=$(grep "$db_user:" /root/remember-db-user-pass.txt)
if [ -n "$db_user_pass" ]; then
new_password=$(echo "$db_user_pass" | cut -d':' -f2)
echo "= Using existing password for $db_user"
found_existing_password=1
fi
fi
if [ -z "$new_password" ]; then
new_password=$(generate_password)
fi
echo "DB name: $db_name"
echo "DB user: $db_user"
echo "New DB password: $new_password"
if [ $found_existing_password -eq 0 ]; then
touch /root/remember-db-user-pass.txt
echo "$db_user:$new_password" >> /root/remember-db-user-pass.txt
chown root:root /root/remember-db-user-pass.txt
chmod 600 /root/remember-db-user-pass.txt
fi
/usr/local/vesta/bin/v-change-database-password "$user" "$db_name" "$new_password"
if [ $? -ne 0 ]; then
echo "*************** ERROR: Failed to change database password ***************"
exit 1;
fi
line="define('DB_PASSWORD', '$new_password');"
chattr -i $wp_config_path
sed -i "s/.*define(.*DB_PASSWORD'.*/$line/" $wp_config_path
new_password_line=$(grep "DB_PASSWORD" $wp_config_path)
echo "New DB password line: $new_password_line"
if [ "$new_password_line" != "$line" ]; then
echo "*************** ERROR: line in wp-config.php is not what we expected ***************"
echo "Expected: $line"
echo "Actual : $new_password_line"
echo "*************** ERROR: Please check wp-config.php manually ***************"
exit 1;
fi
else
echo "ERROR: WP-config.php not found"
exit 1;
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit 0;

71
bin/v-change-dir-www Normal file
View file

@ -0,0 +1,71 @@
#!/bin/bash
# info: Change directory to the public_html folder of a domain
# usage: source v-cd-www DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "This script must be sourced to change the current directory."
echo "Usage: source v-cd-www DOMAIN"
exit 1
fi
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
return 1
fi
# Importing system environment
source /etc/profile
PATH=$PATH:/usr/local/vesta/bin && export PATH
SILENT_MODE=1
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
if [ -z "$user" ]; then
echo "Domain $domain doesn't exist"
return 1
fi
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "User $user doesn't exist"
return 1
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain $domain doesn't have a public_html directory"
return 1
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd "/home/$user/web/$domain/public_html"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
return 0

View file

@ -35,6 +35,9 @@ if [ "$owner" = "$user" ]; then
exit
fi
USER_DATA=$VESTA/data/users/$owner
is_object_unsuspended 'user' 'USER' "$owner"
USER_DATA=$VESTA/data/users/$user
#----------------------------------------------------------#
# Action #
@ -57,11 +60,11 @@ if [ ! -z "$web_data" ]; then
ssl_key=$VESTA/data/users/$owner/ssl/$domain.key
ssl_ca=$VESTA/data/users/$owner/ssl/$domain.ca
ssl_pem=$VESTA/data/users/$owner/ssl/$domain.pem
mv $ssl_crt $VESTA/data/users/$user/ssl/
mv $ssl_key $VESTA/data/users/$user/ssl/
mv $ssl_ca $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1
mv $ssl_pem $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
cp $ssl_crt $VESTA/data/users/$user/ssl/
cp $ssl_key $VESTA/data/users/$user/ssl/
cp $ssl_ca $VESTA/data/users/$user/ssl/ > /dev/null 2>&1
cp $ssl_pem $VESTA/data/users/$user/ssl/ > /dev/null 2>&1
# rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
fi
# Check ftp user account
@ -79,10 +82,23 @@ if [ ! -z "$web_data" ]; then
# Move data
mv $HOMEDIR/$owner/web/$domain $HOMEDIR/$user/web/
if [ -d "/hdd/home/$owner/web/$domain" ]; then
$BIN/v-move-folder-and-make-symlink /hdd/home/$owner/web/$domain /hdd/home/$user/web/$domain
fi
# Change ownership
find $HOMEDIR/$user/web/$domain -user $owner \
-exec chown -h $user:$user {} \;
if [ "$SSL" = 'yes' ]; then
sleep 10
rm $ssl_crt
rm $ssl_key
rm $ssl_ca > /dev/null 2>&1
rm $ssl_pem > /dev/null 2>&1
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
fi
# Rebuild config
$BIN/v-unsuspend-web-domain $user $domain no >> /dev/null 2>&1
$BIN/v-rebuild-web-domains $owner no
@ -140,6 +156,10 @@ if [ ! -z "$mail_data" ]; then
# Move data
mv $HOMEDIR/$owner/mail/$domain $HOMEDIR/$user/mail/
if [ -d "/hdd/home/$owner/mail/$domain" ]; then
$BIN/v-move-folder-and-make-symlink /hdd/home/$owner/mail/$domain /hdd/home/$user/mail/$domain
fi
# Change ownership
find $HOMEDIR/$user/mail/$domain -user $owner \
-exec chown -h $user {} \;

View file

@ -62,6 +62,8 @@ str="RULE='$rule' ACTION='$action' PROTOCOL='$protocol' PORT='$port_ext'"
str="$str IP='$ip' COMMENT='$comment' SUSPENDED='no'"
str="$str TIME='$time' DATE='$date'"
oldvalues=$(grep "RULE='$rule'" $VESTA/data/firewall/rules.conf)
# Deleting old rule
sed -i "/RULE='$rule' /d" $VESTA/data/firewall/rules.conf
@ -74,6 +76,14 @@ sort_fw_rules
# Updating system firewall
$BIN/v-update-firewall
if [ "$WEB_SYSTEM" == 'nginx' ] || [ "$PROXY_SYSTEM" == 'nginx' ]; then
if [ "$port_ext" == "80,443" ] && [ "$action" == "DROP" ]; then
NEWIP=$ip
parse_object_kv_list_non_eval "$oldvalues"
sed -i "s|$IP|$NEWIP|g" /etc/nginx/conf.d/block-firewall.conf
systemctl restart nginx
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -28,6 +28,7 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
check_args '2' "$#" 'KEY VALUE'
is_format_valid 'key'
format_no_quotes "$value" 'value'
#----------------------------------------------------------#
# Action #

View file

@ -16,6 +16,7 @@ force=$3
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf
is_package_avalable() {
@ -23,7 +24,7 @@ is_package_avalable() {
usr_data=$(cat $USER_DATA/user.conf)
IFS=$'\n'
for key in $usr_data; do
eval ${key%%=*}=${key#*=}
parse_object_kv_list_non_eval $key
done
WEB_DOMAINS='0'
@ -35,7 +36,7 @@ is_package_avalable() {
pkg_data=$(cat $VESTA/data/packages/$package.pkg |grep -v TIME |\
grep -v DATE)
eval $pkg_data
parse_object_kv_list_non_eval $pkg_data
# Checking usage agains package limits
if [ "$WEB_DOMAINS" != 'unlimited' ]; then
@ -73,11 +74,15 @@ is_package_avalable() {
check_result $E_LIMIT "Package doesn't cover BANDWIDTH usage"
fi
fi
is_web_template_valid $WEB_TEMPLATE
is_dns_template_valid $DNS_TEMPLATE
is_proxy_template_valid $PROXY_TEMPLATE
}
change_user_package() {
eval $(cat $USER_DATA/user.conf)
eval $(cat $VESTA/data/packages/$package.pkg |egrep -v "TIME|DATE")
parse_object_kv_list_non_eval $(cat $USER_DATA/user.conf)
parse_object_kv_list_non_eval $(cat $VESTA/data/packages/$package.pkg |egrep -v "TIME|DATE")
echo "FNAME='$FNAME'
LNAME='$LNAME'
PACKAGE='$package'

60
bin/v-change-user-rkey Normal file
View file

@ -0,0 +1,60 @@
#!/bin/bash
# info: change user rkey
# options: USER
#
# The function changes user's RKEY value.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
if [ "$user" = "root" ]; then
check_result $E_FORBIDEN "Changing root password is forbiden"
fi
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
hash=$(generate_password)
d=$(date +%s)
# Changing RKEY value
update_user_value "$user" '$RKEY' "$hash"
#check if RKEYEXP exists
if [ -z "$(grep RKEYEXP $USER_DATA/user.conf)" ]; then
sed -i "s/^RKEY/RKEYEXP='$d'\nRKEY/g" $USER_DATA/user.conf
else
update_user_value "$user" '$RKEYEXP' "$d"
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_history "changed rkey"
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -41,6 +41,7 @@ is_int_format_valid "$port" 'port number'
#----------------------------------------------------------#
sed -i "s|$oldport;|$port;|g" $VESTA/nginx/conf/nginx.conf
sed -i "s|$oldport ssl;|$port ssl;|g" $VESTA/nginx/conf/nginx.conf
if [ -f "/etc/roundcube/plugins/password/config.inc.php" ]; then
sed -i "s|'$oldport'|'$port'|g" /etc/roundcube/plugins/password/config.inc.php
fi

View file

@ -0,0 +1,201 @@
#!/bin/bash
# info: interactively delete or change WordPress admin passwords for a given domain
# options: DOMAIN
#
# d → delete user (with content reassignment)
# c → change password (random 10-char alnum)
# s → skip
# x → exit
#----------------------------------------------------------#
# Variable & Function #
#----------------------------------------------------------#
[ "$(whoami)" != "root" ] && { echo "You must be root to run this command."; exit 1; }
source /etc/profile
DOMAIN="$1"
[ -z "$DOMAIN" ] && { echo "Usage: v-change-wp-admins-pass DOMAIN"; exit 1; }
USER="$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN")"
[ -z "$USER" ] && { echo "Domain $DOMAIN does not exist."; exit 1; }
WP_PATH="/home/$USER/web/$DOMAIN/public_html"
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
# WP-CLI wrapper
if [ ! -z "$PHP" ]; then
WP_RUN="PHP=$PHP /usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes"
else
WP_RUN="/usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes"
fi
# random 10-char password
gen_pass() { tr -dc 'A-Za-z0-9' </dev/urandom | head -c 10; }
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd "$WP_PATH" || exit 1
echo
echo "WordPress administrators for $DOMAIN:"
echo "-------------------------------------"
if [ -f /home/$USER/web/$DOMAIN/wp-admin-password-change.txt ]; then
rm /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
fi
RUN="$WP_RUN user list --role=administrator --fields=ID,user_login,user_email --format=csv --skip-plugins --skip-themes"
ADMIN_LIST_CSV=$(eval "$RUN")
return_code=$?
if [ $return_code -ne 0 ]; then
echo "WP-CLI error:"
echo "return code: $return_code"
cat /home/$USER/web/$DOMAIN/wp-cli-error.log
exit $return_code
fi
ADMIN_LIST_CSV=$(echo "$ADMIN_LIST_CSV" | tail -n +2)
[ -z "$ADMIN_LIST_CSV" ] && { echo "No administrator accounts found."; exit 0; }
DEFAULT_USER=""
printf "%-6s %-20s %s\n" "ID" "Username" "Email"
while IFS=',' read -r PID PLOGIN PEMAIL; do
printf "%-6s %-20s %s\n" "$PID" "$PLOGIN" "$PEMAIL"
if [ "$PID" = "1" ]; then
DEFAULT_USER="$PLOGIN"
fi
done <<< "$ADMIN_LIST_CSV"
echo
echo "For each admin choose: (d) delete, (c) change password, (s) skip, (x) exit."
# interactive loop
while IFS=',' read -r ID LOGIN EMAIL; do
[ -n "$EMAIL" ] && TARGET="$LOGIN <$EMAIL>" || TARGET="$LOGIN"
while true; do
echo "-------------------------------------"
read -r -p "Action for \"$TARGET\" [d/c/s/x]? " ACT < /dev/tty
skip=0;
case "$ACT" in
[Dd]* )
# read -r -p "Really DELETE \"$TARGET\" ? (y/n, default: y) " CONF < /dev/tty
CONF="y"
if [[ ! "$CONF" =~ ^[Nn]$ ]]; then
# build an array of OTHER admin usernames
mapfile -t OTHER_USERS < <(echo "$ADMIN_LIST_CSV" | awk -F',' -v cur="$ID" '$1!=cur {print $2}')
if [ "${#OTHER_USERS[@]}" -eq 0 ]; then
echo "Cannot delete the only administrator account."
break
fi
if [ "$DEFAULT_USER" = "" ]; then
DEFAULT_USER="${OTHER_USERS[0]}"
fi
echo "Available admin usernames for reassignment: ${OTHER_USERS[*]}"
while true; do
read -r -p "Reassign content to which username? [default: $DEFAULT_USER, s: skip] " REASSIGN < /dev/tty
REASSIGN=${REASSIGN:-$DEFAULT_USER}
DEFAULT_USER=$REASSIGN
if printf '%s\n' "${OTHER_USERS[@]}" | grep -qx "$REASSIGN"; then
break
fi
if [[ "$REASSIGN" =~ ^[Ss]$ ]]; then
echo "Skipping reassignment."
skip=1;
break
fi
if [[ "$REASSIGN" =~ ^[0-9]+$ ]]; then
break
fi
echo "Invalid username. Please choose one of: ${OTHER_USERS[*]}"
done
if [ $skip -eq 1 ]; then
break
fi
# delete by username, reassign by username
RUN="$WP_RUN user delete $ID --reassign=$REASSIGN --yes --skip-plugins --skip-themes"
eval "$RUN"
if [ $? -eq 0 ]; then
echo "$TARGET deleted (content reassigned to $REASSIGN)."
else
cat /home/$USER/web/$DOMAIN/wp-cli-error.log
echo "Failed to delete $TARGET."
fi
else
echo "Deletion cancelled."
fi
break
;;
[Cc]* )
NEW_PASS=$(gen_pass)
RUN="$WP_RUN user update $ID --user_pass=$NEW_PASS --skip-plugins --skip-themes"
eval "$RUN"
if [ $? -eq 0 ]; then
echo "Password for username '$TARGET' changed to: $NEW_PASS"
echo "Password for username '$TARGET' changed to: $NEW_PASS" >> /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
chown $USER:$USER /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
chmod 600 /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
else
cat /home/$USER/web/$DOMAIN/wp-cli-error.log
echo "Failed to change password for $TARGET."
fi
break
;;
[Ss]* )
echo "Skipping $TARGET."
break
;;
[Xx]* )
echo "Exiting."
exit 0
;;
* ) echo "Please answer d, c, s, or x." ;;
esac
done
done <<< "$ADMIN_LIST_CSV"
if [ -f /home/$USER/web/$DOMAIN/wp-admin-password-change.txt ]; then
echo ""
echo ""
echo "-------------------------------------"
echo "For website $DOMAIN - new wp-admin passwords have been set."
echo "-------------------------------------"
cat /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
echo "-------------------------------------"
echo ""
echo ""
read -r -p "Do you want to save the new passwords to a file /home/$USER/web/$DOMAIN/wp-admin-password-change.txt ? (y/n, default: n) " SAVE_PASSWORDS < /dev/tty
if [ -z "$SAVE_PASSWORDS" ]; then
SAVE_PASSWORDS="n"
fi
if [[ $SAVE_PASSWORDS =~ ^[Nn]$ ]]; then
rm /home/$USER/web/$DOMAIN/wp-admin-password-change.txt
fi
fi
#----------------------------------------------------------#
# flush cache and refresh all security salts #
#----------------------------------------------------------#
echo "-------------------------------------"
echo
echo "Flushing cache and refreshing salts..."
RUN="$WP_RUN cache flush"
eval "$RUN"
RUN="$WP_RUN config shuffle-salts WP_CACHE_KEY_SALT --force"
eval "$RUN"
RUN="$WP_RUN config shuffle-salts"
eval "$RUN"
echo "Cache flushed and salts refreshed."
echo
echo "Done."
exit 0

View file

@ -1,13 +1,44 @@
#!/bin/bash
# info: Clean all unnecessary files like logs
# options: NONE
#
# The function is cleaning all unnecessary files like logs
nice -n 19 ionice -c 3 find /home/*/tmp/ -type f -delete
find /home/ -name '.wp-cli' -type d -exec rm -rf {} \;
#----------------------------------------------------------#
# Verifications & Variable & Function #
#----------------------------------------------------------#
rm /var/backups/*
rm /var/cache/apt/archives/*
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
echo "===== Before cleaning ====="
df -h
echo "==========================="
# Includes
source /usr/local/vesta/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# turn off tailf watcher process
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
kill $(ps aux | grep 'tailf_apache_error' | grep -v "grep tailf_apache_error" | awk '{print $2}')
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
kill $(ps aux | grep 'tailf_exim' | grep -v "grep tailf_exim" | awk '{print $2}')
fi
find /tmp/ -type f -mtime +7 -delete
rm /var/backups/* > /dev/null 2>&1
rm /var/cache/apt/archives/* > /dev/null 2>&1
cd /var/log
truncate -s 0 xferlog lastlog faillog btmp syslog;
find /var/log/ -name "*.log" -type f -exec truncate -s 0 {} \;
find /var/log/ -name "*.log" -not -path "/var/log/apt/*" -type f -exec truncate -s 0 {} \;
find /var/log/ -name "*.err" -type f -exec truncate -s 0 {} \;
find /var/log/ -name "errors" -type f -exec truncate -s 0 {} \;
find /var/log/ -name "*.info" -type f -exec truncate -s 0 {} \;
@ -19,17 +50,84 @@ find /var/log/ -type f -name "*.4" -delete
find /var/log/ -type f -name "*.5" -delete
find /var/log/ -type f -name "*.6" -delete
find /var/log/ -type f -name "*.7" -delete
find /var/log/ -type f -name "*.8" -delete
find /var/log/ -type f -name "*.9" -delete
find /var/log/ -name "*.gz" -type f -delete
find /usr/local/vesta/log/ -type f -name "*.log" -exec truncate -s 0 {} \;
find /usr/local/vesta/log/ -type f -not -name "*.log" -delete
find /var/log/exim4/ -type f -exec truncate -s 0 {} \;
truncate -s 0 /*.log > /dev/null 2>&1
rm /panic-*.log > /dev/null 2>&1
rm /var/log/panic-*.log > /dev/null 2>&1
find /home/*/web/*/public_html/wp-content/aiowps_backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete
find /home/*/web/*/public_html/wp-content/envato-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete
find /home/*/web/*/public_html/wp-content/ai1wm-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete
find /home/*/web/*/public_html/wp-content/updraft/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete
find /home/*/web/*/public_html/ -type f -name "error_log" -delete
find /home/*/web/*/public_html/ -type f -name "error_log.txt" -delete
find /home/ -type f -name "*.log" -delete
clean_home() {
nice -n 19 ionice -c 3 find $1/*/tmp/ -type f -delete > /dev/null 2>&1
find $1/ -name '.wp-cli' -type d -exec rm -rf {} \; > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/aiowps_backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/envato-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/ai1wm-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/wpvividbackups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/updraft/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/plugins/ezpz-one-click-backup/backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/backups-dup-lite/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/wp-content/cache/ -type f -not -name ".htaccess" -delete > /dev/null 2>&1
find $1/*/web/*/public_html/ -type f -name "*.wpress" -delete > /dev/null 2>&1
nice -n 19 ionice -c 3 find $1/*/tmp/ -type f -mtime +1 -delete > /dev/null 2>&1
nice -n 19 ionice -c 3 find $1/*/web/*/public_html/ -type f -name "error_log" -exec truncate -s 0 {} \;
nice -n 19 ionice -c 3 find $1/*/web/*/public_html/ -type f -name "error_log.txt" -exec truncate -s 0 {} \;
nice -n 19 ionice -c 3 find $1/ -type f -name "*.log" -exec truncate -s 0 {} \;
}
echo "=== Garbage cleaned ==="
clean_home "/home"
if [ -d "/hdd/home" ]; then
clean_home "/hdd/home"
fi
# Cleaning fail2ban database
fail2ban_running=$(/usr/local/vesta/bin/v-list-sys-services | grep 'fail2ban' | grep -c 'running')
if [ $fail2ban_running -eq 1 ]; then
systemctl stop fail2ban
fi
if [ -f "/var/lib/fail2ban/fail2ban.sqlite3" ]; then
rm /var/lib/fail2ban/fail2ban.sqlite3
if [ -f "/etc/nginx/conf.d/block.conf" ]; then
truncate -s 0 /etc/nginx/conf.d/block.conf
nginx_running=$(/usr/local/vesta/bin/v-list-sys-services | grep 'nginx' | grep -c 'running')
if [ $nginx_running -eq 1 ]; then
systemctl restart nginx
fi
fi
fi
if [ $fail2ban_running -eq 1 ]; then
systemctl start fail2ban
fi
# turn on tailf watcher process
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
nohup php /usr/local/bin/tailf_apache_error.php > /var/log/tailf_apache_error.log 2>&1 &
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
nohup php /usr/local/bin/tailf_exim.php > /var/log/tailf_exim.log 2>&1 &
fi
exim_installed=$(/usr/local/vesta/bin/v-list-sys-services | grep -c 'exim')
if [ $exim_installed -gt 0 ]; then
systemctl restart exim4
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo ""
echo "***** Garbage cleaned *****"
echo ""
echo "===== After cleaning ======"
df -h
echo "==========================="
log_event "$OK" "$ARGUMENTS"
exit

59
bin/v-clear-fail2ban Normal file
View file

@ -0,0 +1,59 @@
#!/bin/bash
# info: Clean fail2ban database
# options: NONE
#
# The function is cleaning fail2ban database
#----------------------------------------------------------#
# Verifications & Variable & Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# check if fail2ban is installed
fail2ban_installed=$(/usr/local/vesta/bin/v-list-sys-services | grep -c 'fail2ban')
if [ $fail2ban_installed -eq 0 ]; then
echo "Fail2ban is not installed"
exit 1
fi
# Includes
source /usr/local/vesta/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Cleaning fail2ban database
fail2ban_running=$(/usr/local/vesta/bin/v-list-sys-services | grep 'fail2ban' | grep -c 'running')
if [ $fail2ban_running -eq 1 ]; then
echo "== Stopping fail2ban"
systemctl stop fail2ban
fi
if [ -f "/var/lib/fail2ban/fail2ban.sqlite3" ]; then
echo "== Cleaning fail2ban database"
rm /var/lib/fail2ban/fail2ban.sqlite3
if [ -f "/etc/nginx/conf.d/block.conf" ]; then
echo "== Cleaning nginx block.conf"
truncate -s 0 /etc/nginx/conf.d/block.conf
nginx_running=$(/usr/local/vesta/bin/v-list-sys-services | grep 'nginx' | grep -c 'running')
if [ $nginx_running -eq 1 ]; then
echo "== Restarting nginx"
systemctl restart nginx
fi
fi
fi
if [ $fail2ban_running -eq 1 ]; then
echo "== Starting fail2ban"
systemctl start fail2ban
fi
echo "== Done, fail2ban database cleaned"
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -9,16 +9,18 @@
if [ $# -lt 2 ]; then
echo "USAGE: v-clone-website FROM_DOMAIN TO_DOMAIN"
echo "Available parameters:"
echo "--DATABASE_SUFIX=... (default is '_migrated')"
echo "--DATABASE_SUFIX=... (will be added to database name)"
echo "--TO_DATABASE=... (this will override --TO_DATABASE_NAME, --TO_DATABASE_USERNAME and --DATABASE_SUFIX)"
echo "--FROM_DATABASE_NAME=..."
echo "--FROM_DATABASE_USERNAME=..."
echo "--FROM_DATABASE_PASSWORD=..."
echo "--FROM_CONFIG_FILE=..."
echo "--CONFIG_FILE=..."
echo "--TO_USER=..."
echo "--TO_DATABASE_NAME=..."
echo "--TO_DATABASE_USERNAME=..."
echo "--TO_DATABASE_PASSWORD=..."
echo "--SITE_SUBFOLDER=..."
echo "--EXCLUDE_UPLOADS=1 (or do not set it)"
exit 1
fi
@ -41,6 +43,7 @@ source /etc/profile
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/db.sh
source /usr/local/vesta/conf/vesta.conf
FROM_DATABASE_NAME=''
FROM_DATABASE_USERNAME=''
@ -50,6 +53,13 @@ TO_DATABASE_NAME=''
TO_DATABASE_USERNAME=''
TO_DATABASE_PASSWORD=''
DATABASE_SUFIX='_migrated'
SITE_SUBFOLDER=''
SEARCH_FOR_CONFIGS_DATABASE_NAME=''
SEARCH_FOR_CONFIGS_DATABASE_USERNAME=''
if [ ! -z "$MAX_DBUSER_LEN" ] && [ "$MAX_DBUSER_LEN" -ge 80 ]; then
DATABASE_SUFIX=''
fi
#----------------------------------------------------------#
# Verifications #
@ -61,7 +71,16 @@ is_domain_format_valid "$TO_DOMAIN"
FROM_USER=$user
r=$(/usr/local/vesta/bin/v-get-database-credentials-of-domain "$FROM_DOMAIN")
# take --parameters
source /usr/local/vesta/func/handle_parameters.sh
if [ -z "$SITE_SUBFOLDER" ]; then
r=$(/usr/local/vesta/bin/v-get-database-credentials-of-domain "$FROM_DOMAIN")
else
r=$(/usr/local/vesta/bin/v-get-database-credentials-of-domain "$FROM_DOMAIN" "$SITE_SUBFOLDER")
fi
#echo $r
#exit
eval $r
# take --parameters
@ -155,11 +174,19 @@ CHECK_PUBLIC_SHTML=$(/usr/local/vesta/bin/v-list-web-domain "$TO_USER" "$TO_DOMA
if [ $CHECK_PUBLIC_SHTML -eq 1 ]; then
TO_FOLDER="/home/$TO_USER/web/$TO_DOMAIN/public_shtml"
fi
if [ ! -z "$SITE_SUBFOLDER" ]; then
TO_FOLDER="$TO_FOLDER/$SITE_SUBFOLDER"
fi
TO_CONFIG_FILE_FULL_PATH="$TO_FOLDER/$FROM_CONFIG_FILE"
LENGTH_OF_DATABASE_SUFIX=${#DATABASE_SUFIX}
if [ -z "$TO_DATABASE_NAME" ]; then
if [ ! -z "$MAX_DBUSER_LEN" ] && [ "$MAX_DBUSER_LEN" -ge 80 ] && [ -z "$DATABASE_SUFIX" ]; then
TO_DATABASE_NAME=$(echo "$TO_DOMAIN" | sed 's#\.#_#g')
TO_DATABASE_NAME="${TO_USER}_$TO_DATABASE_NAME"
TO_DATABASE_USERNAME=$TO_DATABASE_NAME
else
LENGTH_OF_DATABASE_SUFIX=${#DATABASE_SUFIX}
if [ -z "$TO_DATABASE_NAME" ]; then
LENGTH_OF_TO_DATABASE_NAME=${#FROM_DATABASE_NAME}
START_FROM=$((LENGTH_OF_TO_DATABASE_NAME-LENGTH_OF_DATABASE_SUFIX))
CHECK_PREFIX=${FROM_DATABASE_NAME:START_FROM}
@ -171,8 +198,8 @@ if [ -z "$TO_DATABASE_NAME" ]; then
else
TO_DATABASE_NAME="${TO_USER}_${FROM_DATABASE_NAME_WITHOUT_PREFIX}${DATABASE_SUFIX}"
fi
fi
if [ -z "$TO_DATABASE_USERNAME" ]; then
fi
if [ -z "$TO_DATABASE_USERNAME" ]; then
LENGTH_OF_TO_DATABASE_USERNAME=${#FROM_DATABASE_USERNAME}
START_FROM=$((LENGTH_OF_TO_DATABASE_USERNAME-LENGTH_OF_DATABASE_SUFIX))
CHECK_PREFIX=${FROM_DATABASE_USERNAME:START_FROM}
@ -184,7 +211,9 @@ if [ -z "$TO_DATABASE_USERNAME" ]; then
else
TO_DATABASE_USERNAME="${TO_USER}_${FROM_DATABASE_USERNAME_WITHOUT_PREFIX}${DATABASE_SUFIX}"
fi
fi
fi
if [ ! -z "$TO_DATABASE" ]; then
TO_DATABASE_USERNAME=$TO_DATABASE
TO_DATABASE_NAME=$TO_DATABASE
@ -218,25 +247,31 @@ if [ $FROM_DOMAIN_HAS_SSL -eq 1 ] && [ $TO_DOMAIN_HAS_SSL -eq 0 ]; then
SHOULD_INSTALL_SSL=1
fi
FROM_FPM_VER=""
if [[ $FROM_DOMAIN_TPL == "PHP-FPM-"* ]]; then
FROM_FPM_TPL_VER=${FROM_DOMAIN_TPL:8:2}
FROM_FPM_VER="${FROM_DOMAIN_TPL:8:1}.${FROM_DOMAIN_TPL:9:1}"
fi
# ----------- CHECK -------------
if [ $IT_IS_WP -eq 0 ]; then
if [ ! -f "/root/Search-Replace-DB-master/srdb.cli.php" ]; then
echo "Please download https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ and extract to /root/Search-Replace-DB-master/"
exit 13
if [ ! -f "/root/Search-Replace-DB/srdb.cli.php" ]; then
if [ ! -f "/usr/bin/git" ]; then
apt-get update > /dev/null 2>&1
apt-get -y install git > /dev/null 2>&1
fi
if [ ! -f "/usr/bin/php7.0" ]; then
echo "Please download https://c.myvestacp.com/tools/multi-php-install.sh and install php 7.0"
exit 14
fi
else
if [ ! -f "/usr/local/bin/wp" ]; then
echo "=== Downloading latest wp-cli"
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
cd /root
git clone https://github.com/interconnectit/Search-Replace-DB.git
fi
fi
CREATE_TO_DATABASE=0
object=$(grep "DB='$TO_DATABASE_NAME'" $VESTA/data/users/$TO_USER/db.conf)
if [ -z "$object" ]; then
CREATE_TO_DATABASE=1
fi
# ----------- PRINT -------------
echo "==============================================================================="
@ -244,9 +279,12 @@ echo "FROM_DOMAIN = $FROM_DOMAIN"
echo "TO_DOMAIN = $TO_DOMAIN"
echo "FROM_USER = $FROM_USER"
echo "TO_USER = $TO_USER"
echo "SITE_SUBFOLDER = $SITE_SUBFOLDER"
echo "FROM_FOLDER = $FROM_FOLDER"
echo "TO_FOLDER = $TO_FOLDER"
echo "CMS_TYPE = $CMS_TYPE"
echo "IT_IS_WP = $IT_IS_WP"
echo "CONFIG_FILE = $CONFIG_FILE"
echo "FROM_CONFIG_FILE_FULL_PATH = $FROM_CONFIG_FILE_FULL_PATH"
echo "TO_CONFIG_FILE_FULL_PATH = $TO_CONFIG_FILE_FULL_PATH"
echo "FROM_DATABASE_NAME = $FROM_DATABASE_NAME"
@ -262,10 +300,15 @@ echo "TO_DATABASE_USERNAME_WITHOUT_PREFIX = $TO_DATABASE_USERNAME_WITHOUT_PREF
echo "DATABASE_SUFIX = $DATABASE_SUFIX"
echo "CREATE_TO_USER = $CREATE_TO_USER"
echo "CREATE_TO_DOMAIN = $CREATE_TO_DOMAIN"
echo "CREATE_TO_DATABASE = $CREATE_TO_DATABASE"
echo "SHOULD_INSTALL_SSL = $SHOULD_INSTALL_SSL"
echo "FROM_DOMAIN_TPL = $FROM_DOMAIN_TPL"
echo "FROM_FPM_VER = $FROM_FPM_VER"
echo "FROM_DOMAIN_PROXY_TPL = $FROM_DOMAIN_PROXY_TPL"
echo "FROM_DOMAIN_PROXY_EXT = $FROM_DOMAIN_PROXY_EXT"
echo "SEARCH_FOR_CONFIGS_DATABASE_NAME = $SEARCH_FOR_CONFIGS_DATABASE_NAME"
echo "SEARCH_FOR_CONFIGS_DATABASE_USERNAME = $SEARCH_FOR_CONFIGS_DATABASE_USERNAME"
echo "EXCLUDE_UPLOADS = $EXCLUDE_UPLOADS"
echo "==============================================================================="
read -p "=== Press Enter to continue ==="
@ -276,7 +319,7 @@ read -p "=== Press Enter to continue ==="
if [ $CREATE_TO_USER -eq 1 ]; then
pass=$(vesta_generate_pass 10)
echo "=== Create user $TO_USER, pass=$pass"
/usr/local/vesta/bin/v-add-user "$TO_USER" "$pass" "info@$TO_DOMAIN" "default" "Migrated" "site"
/usr/local/vesta/bin/v-add-user "$TO_USER" "$pass" "info@$TO_DOMAIN" "default" "Cloned" "site"
fi
if [ $CREATE_TO_DOMAIN -eq 1 ]; then
@ -297,14 +340,22 @@ if [ ! -z "$FROM_DOMAIN_TPL" ]; then
echo "=== Set $FROM_DOMAIN_TPL template to domain $TO_DOMAIN"
/usr/local/vesta/bin/v-change-web-domain-tpl "$TO_USER" "$TO_DOMAIN" "$FROM_DOMAIN_TPL" "yes"
fi
if [ "$SITE_SUBFOLDER" = ".." ]; then
if [ ! -z "$FROM_FPM_VER" ]; then
POOLD_FILE="/etc/php/$FROM_FPM_VER/fpm/pool.d/$TO_DOMAIN.conf"
echo "=== Removing public_html from open_basedir in $POOLD_FILE"
sed -i "s|/public_html:|:|g" $POOLD_FILE
sed -i "s|/public_shtml:|:|g" $POOLD_FILE
systemctl restart php${FROM_FPM_VER}-fpm
fi
fi
if [ ! -z "$FROM_DOMAIN_PROXY_TPL" ]; then
echo "=== Set $FROM_DOMAIN_PROXY_TPL proxy template to domain $TO_DOMAIN"
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$TO_USER" "$TO_DOMAIN" "$FROM_DOMAIN_PROXY_TPL" "$FROM_DOMAIN_PROXY_EXT" "yes"
fi
object=$(grep "DB='$TO_DATABASE_NAME'" $VESTA/data/users/$TO_USER/db.conf)
if [ -z "$object" ]; then
if [ $CREATE_TO_DATABASE -eq 1 ]; then
echo "=== Create database $TO_DATABASE_NAME"
/usr/local/vesta/bin/v-add-database "$TO_USER" "$TO_DATABASE_NAME_WITHOUT_PREFIX" "$TO_DATABASE_USERNAME_WITHOUT_PREFIX" "$TO_DATABASE_PASSWORD" 'mysql' 'localhost' 'utf8'
fi
@ -315,12 +366,26 @@ if [ -d "/root/temp" ]; then
fi
mkdir -p /root/temp
cd /root/temp
mysqldump $FROM_DATABASE_NAME > $FROM_DATABASE_NAME.sql
mysqldump --max_allowed_packet=1024M $FROM_DATABASE_NAME > $FROM_DATABASE_NAME.sql
echo "=== Importing to database $TO_DATABASE_NAME"
mysql $TO_DATABASE_NAME < $FROM_DATABASE_NAME.sql
rm $FROM_DATABASE_NAME.sql
EXCLUDE=''
if [ ! -z "$EXCLUDE_UPLOADS" ]; then
EXCLUDE="--exclude '/wp-content/uploads/*'"
fi
echo "=== Copying files from $FROM_FOLDER to folder $TO_FOLDER"
rsync -a --delete $FROM_FOLDER/ $TO_FOLDER/
if [ "$SITE_SUBFOLDER" != ".." ]; then
run="rsync -a --delete $EXCLUDE $FROM_FOLDER/ $TO_FOLDER/"
echo "====== Executing: $run"
eval $run
else
run="rsync -a --delete $EXCLUDE --exclude 'logs/*' $FROM_FOLDER/ $TO_FOLDER/"
echo "====== Executing: $run"
eval $run
fi
echo "=== Chowning to $TO_USER:$TO_USER in folder $TO_FOLDER"
chown -R $TO_USER:$TO_USER $TO_FOLDER
@ -328,37 +393,65 @@ replace_php_config_value "${FROM_DATABASE_NAME}" "${TO_DATABASE_NAME}" "$TO_CONF
replace_php_config_value "${FROM_DATABASE_USERNAME}" "${TO_DATABASE_USERNAME}" "$TO_CONFIG_FILE_FULL_PATH" "yes"
replace_php_config_value "${FROM_DATABASE_PASSWORD}" "${TO_DATABASE_PASSWORD}" "$TO_CONFIG_FILE_FULL_PATH" "yes"
echo "=== Replacing $FROM_DOMAIN to $TO_DOMAIN in folder $TO_FOLDER"
echo "=== Replacing $FROM_DOMAIN to $TO_DOMAIN by searching in folder $TO_FOLDER"
REGEXP_FROM_DOMAIN="${FROM_DOMAIN//\./\\.}"
grep -rl "$REGEXP_FROM_DOMAIN" $TO_FOLDER | xargs sed -i "s#$REGEXP_FROM_DOMAIN#$TO_DOMAIN#g"
if [ "$FROM_USER" != "$TO_USER" ]; then
echo "=== Replacing /home/$FROM_USER/ to /home/$TO_USER/ in folder $TO_FOLDER"
echo "=== Replacing /home/$FROM_USER/ to /home/$TO_USER/ by searching in folder $TO_FOLDER"
grep -rl "/home/$FROM_USER/" $TO_FOLDER | xargs sed -i "s#/home/$FROM_USER/#/home/$TO_USER/#g"
fi
if [ ! -z "$SEARCH_FOR_CONFIGS_DATABASE_NAME" ]; then
echo "=== Replacing ${FROM_DATABASE_NAME} to ${TO_DATABASE_NAME} by searching in folder $TO_FOLDER [SEARCH_FOR_CONFIGS_DATABASE_NAME]"
grep -rl "${FROM_DATABASE_NAME}" $TO_FOLDER | xargs sed -i "s#${FROM_DATABASE_NAME}#${TO_DATABASE_NAME}#g"
fi
if [ ! -z "$SEARCH_FOR_CONFIGS_DATABASE_USERNAME" ]; then
DO_SEARCH_FOR_CONFIGS_DATABASE_USERNAME=1;
if [ ! -z "$SEARCH_FOR_CONFIGS_DATABASE_NAME" ] && [ "$SEARCH_FOR_CONFIGS_DATABASE_NAME" = "$SEARCH_FOR_CONFIGS_DATABASE_USERNAME" ]; then
DO_SEARCH_FOR_CONFIGS_DATABASE_USERNAME=0
fi
if [ $DO_SEARCH_FOR_CONFIGS_DATABASE_USERNAME -eq 1 ]; then
echo "=== Replacing ${FROM_DATABASE_USERNAME} to ${TO_DATABASE_USERNAME} by searching in folder $TO_FOLDER [SEARCH_FOR_CONFIGS_DATABASE_USERNAME]"
grep -rl "${FROM_DATABASE_USERNAME}" $TO_FOLDER | xargs sed -i "s#${FROM_DATABASE_USERNAME}#${TO_DATABASE_USERNAME}#g"
fi
fi
if [ $IT_IS_WP -eq 0 ]; then
echo "=== Replacing $FROM_DOMAIN to $TO_DOMAIN in database $TO_DATABASE_NAME"
php7.0 /root/Search-Replace-DB-master/srdb.cli.php -h localhost -n "$TO_DATABASE_NAME" -u "$TO_DATABASE_USERNAME" -p "$TO_DATABASE_PASSWORD" -s "$FROM_DOMAIN" -r "$TO_DOMAIN"
php /root/Search-Replace-DB/srdb.cli.php -h localhost -n "$TO_DATABASE_NAME" -u "$TO_DATABASE_USERNAME" -p "$TO_DATABASE_PASSWORD" -s "$FROM_DOMAIN" -r "$TO_DOMAIN"
if [ "$FROM_USER" != "$TO_USER" ]; then
echo "=== Replacing /home/$FROM_USER/ to /home/$TO_USER/ in database $TO_DATABASE_NAME"
php7.0 /root/Search-Replace-DB-master/srdb.cli.php -h localhost -n "$TO_DATABASE_NAME" -u "$TO_DATABASE_USERNAME" -p "$TO_DATABASE_PASSWORD" -s "/home/$FROM_USER/" -r "/home/$TO_USER/"
php /root/Search-Replace-DB/srdb.cli.php -h localhost -n "$TO_DATABASE_NAME" -u "$TO_DATABASE_USERNAME" -p "$TO_DATABASE_PASSWORD" -s "/home/$FROM_USER/" -r "/home/$TO_USER/"
fi
else
cd $TO_FOLDER
if [ -d "wp-content/plugins/w3-total-cache" ]; then
rm -f wp-content/object-cache.php
rm -f wp-content/db.php
rm -f wp-content/advanced-cache.php
rm -rf wp-content/w3tc-config
rm -rf wp-content/plugins/w3-total-cache
fi
echo "=== Replacing $FROM_DOMAIN to $TO_DOMAIN in database $TO_DATABASE_NAME"
sudo -H -u$TO_USER wp search-replace "$FROM_DOMAIN" "$TO_DOMAIN" --precise --all-tables --skip-columns=guid
/usr/local/vesta/bin/v-run-wp-cli $TO_DOMAIN search-replace "$FROM_DOMAIN" "$TO_DOMAIN" --precise --all-tables --skip-columns=guid --skip-plugins --skip-themes;
if [ "$FROM_USER" != "$TO_USER" ]; then
echo "=== Replacing /home/$FROM_USER/ to /home/$TO_USER/ in database $TO_DATABASE_NAME"
sudo -H -u$TO_USER wp search-replace "/home/$FROM_USER/" "/home/$TO_USER/" --precise --all-tables --skip-columns=guid
/usr/local/vesta/bin/v-run-wp-cli $TO_DOMAIN search-replace "/home/$FROM_USER/" "/home/$TO_USER/" --precise --all-tables --skip-columns=guid --skip-plugins --skip-themes;
fi
/usr/local/vesta/bin/v-run-wp-cli $TO_DOMAIN cache flush --skip-plugins --skip-themes;
/usr/local/vesta/bin/v-run-wp-cli $TO_DOMAIN config shuffle-salts WP_CACHE_KEY_SALT --force --skip-plugins --skip-themes;
/usr/local/vesta/bin/v-run-wp-cli $TO_DOMAIN config shuffle-salts --skip-plugins --skip-themes;
fi
# ----------- Update Wordfence WAF Path -------------
# Path to .user.ini file in the new domain directory
user_ini="/home/$TO_USER/web/$TO_DOMAIN/public_html/.user.ini"
# Check if .user.ini exists
if [ -f "$user_ini" ]; then
echo "Updating .user.ini with new path..."
# Change path from old domain to new domain
sed -i "s|/home/.*/public_html|/home/$TO_USER/web/$TO_DOMAIN/public_html|g" $user_ini
# Check if replacement was successful and update .user.ini
if [ $? -eq 0 ]; then
echo ".user.ini updated successfully."
else
echo "Failed to update .user.ini file."
fi
sudo -H -u$TO_USER wp cache flush
fi
echo "===== DONE ===="

634
bin/v-commander Normal file
View file

@ -0,0 +1,634 @@
#!/bin/bash
numargs=$#
SHOWHEADER=0
if [ $numargs -eq 0 ]; then
SHOWHEADER=1
fi
if [ $numargs -eq 1 ] && [ "$1" = "q" ]; then
SHOWHEADER=1
fi
source /etc/profile
PATH=$PATH:/usr/local/vesta/bin && export PATH
if [ $SHOWHEADER -eq 1 ]; then
echo "======================= mvVesta-commander ================================"
fi
if [ -f /root/kernelupdate ]; then
rm /root/kernelupdate
fi
apt_updated=0
apt_upgraded=0
quit_on_empty=0
if [ $SHOWHEADER -eq 1 ]; then
hostname
if [ -f "/root/current-status.txt" ]; then
echo "------------------ WAS LONG TIME AGO ------------------"
cat /root/current-status.txt
truncate -s 0 /root/current-status.txt
fi
echo -n 'Debian ' >> /root/current-status.txt && cat /etc/debian_version >> /root/current-status.txt
php -v | grep '^PHP' >> /root/current-status.txt
/usr/local/vesta/bin/v-list-sys-services >> /root/current-status.txt
/usr/local/vesta/bin/v-list-sys-web-status | grep "Server MPM:" >> /root/current-status.txt
w | grep 'load average' >> /root/current-status.txt
df -h | grep "/$" >> /root/current-status.txt
echo "------------------------ NOW ------------------------"
cat /root/current-status.txt
echo "-----------------------------------------------------"
echo "(press 'h' for help)"
echo ""
fi
check_status() {
echo "=============================================================="
hostname
echo "------------------------ WAS ------------------------"
cat /root/current-status.txt
echo "------------------------ NOW ------------------------"
hostname
echo -n 'Debian ' && cat /etc/debian_version
php -v | grep '^PHP'
/usr/local/vesta/bin/v-list-sys-services
/usr/local/vesta/bin/v-list-sys-web-status | grep "Server MPM:"
w | grep 'load average'
df -h | grep "/$"
echo "-----------------------------------------------------"
}
myhelp() {
echo "---------- Press: -----------"
echo "a = Activate Email rate limit"
echo "b = bash"
echo "c = check status"
echo "d = df -h"
echo "e = make sure Apache is in mpm_event"
echo "f = free -h"
echo "g = apt-get upgrade"
echo "h = help"
echo "m = install php-memcached"
echo "p = set version of php as default"
echo "q = quit"
echo "r = reboot"
echo "s = download sury.org apt-get key"
echo "n = download nginx gpg key"
echo "freexian = add Freexian repository"
echo "t = clean the trash"
echo "u = apt-get update"
echo "v = update myVesta"
echo "vo = update myVesta without 'apt-get update'"
echo "w = w"
echo "-----------------------------"
echo "inst v = install myVesta"
echo "inst p = install multi-php"
echo "inst pgw = install php-gate"
echo "inst r = install new Roundcube"
echo "inst memcached = install memcached"
echo "inst redis = install Redis"
echo "inst nginx-rate-limit = install nginx-rate-limit templates"
echo "dis fb = stop and disable fail2ban"
echo "dis dove = stop and disable dovecot"
echo "dis spam = stop and disable spamassassin"
echo "dis clam = stop and disable ClamAV"
echo "p 7.0 = set default php 7.0"
echo "p 7.3 = set default php 7.3"
echo "p 7.4 = set default php 7.4"
echo "p def = set proper default php"
echo "e def = set mpm_event if needed"
echo "m def = install php-memcached if needed"
echo "check fc = check if FreshClam is up"
echo "-----------------------------"
echo "enable-ssh-root-password-login = Allow root password authentication via SSH"
echo "id_rsa = generate id_rsa and id_rsa.pub if it does not exist and show id_rsa.pub"
echo "-----------------------------"
}
apt_update() {
echo "============================="
echo "== running: apt-get update"
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -lt 10 ]; then
apt-get update
else
apt-get update --allow-releaseinfo-change
fi
apt_updated=1
}
COUNTER=0
HAS_PARAMETERS=0
while true
do
COUNTER=$((COUNTER + 1))
if [ $COUNTER -le $numargs ]; then
HAS_PARAMETERS=1
answer=$1
shift
else
if [ $HAS_PARAMETERS -eq 1 ]; then
exit;
fi
read -p 'What to do: ' answer
fi
if [ "$answer" = 'prompt' ] || [ "$answer" = 'PROMPT' ]; then
echo "============================="
echo "hostname: $HOSTNAME"
read -p 'What to do [or press Enter to continue]: ' answer
fi
if [ "$answer" = '' ] && [ $quit_on_empty -eq 1 ]; then
answer='q'
fi
if [ "$answer" = 'quit-on-empty' ]; then
echo "== the script will quit on next enter"
quit_on_empty=1
HAS_PARAMETERS=0
fi
if [ "$answer" = 'a' ] || [ "$answer" = 'A' ]; then
mv /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template-backup
cp /usr/local/vesta/install/debian/12/exim/exim4.conf.template /etc/exim4/exim4.conf.template
touch /etc/exim4/limit_per_email_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_email_account_max_recipients
touch /etc/exim4/limit_per_hosting_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_hosting_account_max_recipients
check_grep=$(grep -c '#SPAMASSASSIN' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#SPAMASSASSIN|SPAMASSASSIN|g" /etc/exim4/exim4.conf.template
fi
check_grep=$(grep -c '#SPAM_SCORE' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#SPAM_SCORE|SPAM_SCORE|g" /etc/exim4/exim4.conf.template
fi
check_grep=$(grep -c '#CLAMD' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#CLAMD|CLAMD|g" /etc/exim4/exim4.conf.template
fi
systemctl restart exim4
echo "Email rate limit activated."
fi
if [ "$answer" = 'u' ] || [ "$answer" = 'U' ]; then
apt_update
fi
if [ "$answer" = 'g' ] || [ "$answer" = 'G' ]; then
echo "============================="
echo "== running: apt-get upgrade"
if [ $apt_upgraded -eq 0 ]; then
cp /var/log/apt/history.log /var/log/apt/history-`date +"%Y%m%d%H%M%S"`.log
truncate -s 0 /var/log/apt/history.log
fi
apt-get -y --with-new-pkgs upgrade
apt-get -y dist-upgrade
apt_upgraded=1
kernelupdate=$(grep -c 'linux-image-' /var/log/apt/history.log)
dbusupdate=$(grep -c ' dbus:a' /var/log/apt/history.log)
if [ $kernelupdate -gt 0 ] || [ $dbusupdate -gt 0 ] || [ -f "/run/reboot-required" ] || [ -f "/var/run/reboot-required" ]; then
touch /root/kernelupdate
echo "== kernel is updated, reboot is required!"
fi
fi
if [ "$answer" = 'c' ] || [ "$answer" = 'C' ]; then
check_status
fi
if [ "$answer" = 's' ] || [ "$answer" = 'S' ]; then
if [ -f "/etc/apt/trusted.gpg.d/php.gpg" ]; then
echo "============================="
echo "== renewing sury.org gpg key"
wget -nv -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
fi
fi
if [ "$answer" = 'n' ] || [ "$answer" = 'N' ]; then
if [ -f "/etc/apt/sources.list.d/nginx.list" ]; then
echo "============================="
echo "== renewing nginx gpg key"
apt-get update
apt-get -y install curl gnupg2 ca-certificates lsb-release debian-archive-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list
fi
fi
if [ "$answer" = 'freexian' ] || [ "$answer" = 'FREEXIAN' ]; then
if [ "$release" -lt 11 ]; then
echo "============================="
echo "== adding Freexian repository"
apt-get update
apt-get install lsb-release
wget https://deb.freexian.com/extended-lts/pool/main/f/freexian-archive-keyring/freexian-archive-keyring_2022.06.08_all.deb && sudo dpkg -i freexian-archive-keyring_2022.06.08_all.deb
cat /etc/apt/sources.list
mv /etc/apt/sources.list /etc/apt/sources.list.old
echo "deb http://deb.freexian.com/extended-lts `lsb_release -cs` main contrib non-free" > /etc/apt/sources.list
rm /etc/apt/sources.list.d/hetzner*
else
echo "== Freexian is not supported on Debian 11 or higher"
fi
fi
if [ "$answer" = 'e def' ] || [ "$answer" = 'E DEF' ]; then
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
echo "============================="
echo "== checking if we need mpm_event mode"
echo "== detected Debian $release"
if [ "$release" -eq 10 ] || [ "$release" -eq 11 ] || [ -f "/root/switch-apache-to-event-mode.sh" ]; then
isevent=$(/usr/local/vesta/bin/v-list-sys-web-status | grep -c "Server MPM: event")
if [ $isevent -eq 0 ]; then
echo "== Apache should be switched to mpm_event mode"
answer='e'
else
echo "== Apache is already in mpm_event mode"
fi
fi
fi
if [ "$answer" = 'e' ] || [ "$answer" = 'E' ]; then
echo "============================="
echo "== switching to mpm_event mode"
apt-get -y remove libapache2-mod-php*
a2dismod ruid2
a2dismod suexec
a2dismod php5.6
a2dismod php7.0
a2dismod php7.1
a2dismod php7.2
a2dismod php7.3
a2dismod php7.4
a2dismod php8.0
a2dismod php8.1
a2dismod php8.2
a2dismod mpm_prefork
a2enmod mpm_event
systemctl restart apache2
fi
if [ "$answer" = 'dis fb' ] || [ "$answer" = 'DIS FB' ]; then
echo "============================="
echo "== disabling fail2ban"
systemctl stop fail2ban
systemctl disable fail2ban
systemctl status fail2ban
fi
if [ "$answer" = 'dis dove' ] || [ "$answer" = 'DIS DOVE' ]; then
echo "============================="
echo "== disabling dovecot"
systemctl stop dovecot.service
systemctl stop dovecot.socket
systemctl disable dovecot.service
fi
if [ "$answer" = 'dis clam' ] || [ "$answer" = 'DIS CLAM' ]; then
echo "============================="
echo "== disabling ClamAV"
systemctl stop clamav-daemon.service
systemctl disable clamav-daemon.service
systemctl stop clamav-daemon.socket
systemctl disable clamav-daemon.socket
systemctl stop clamav-freshclam.service
systemctl disable clamav-freshclam.service
sed -i "s/^CLAMD =/#CLAMD =/g" /etc/exim4/exim4.conf.template
systemctl restart exim4
fi
if [ "$answer" = 'dis spam' ] || [ "$answer" = 'DIS SPAM' ]; then
echo "============================="
echo "== disabling SpamAssassin"
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -lt 12 ]; then
systemctl stop spamassassin.service
systemctl disable spamassassin.service
else
systemctl stop spamd.service
systemctl disable spamd.service
fi
sed -i "s/^SPAMASSASSIN =/#SPAMASSASSIN =/g" /etc/exim4/exim4.conf.template
sed -i "s/^SPAM_SCORE =/#SPAM_SCORE =/g" /etc/exim4/exim4.conf.template
systemctl restart exim4
fi
if [ "$answer" = 'p' ] || [ "$answer" = 'P' ]; then
echo "============================="
echo "== changing default php version"
update-alternatives --config php
echo "--- NEW ---"
php -v | grep '^PHP'
fi
if [ "$answer" = 'p 7.0' ] || [ "$answer" = 'P 7.0' ]; then
echo "============================="
echo "== changing default php version to 7.0"
update-alternatives --set php /usr/bin/php7.0
echo "--- NEW ---"
php -v | grep '^PHP'
fi
if [ "$answer" = 'p 7.3' ] || [ "$answer" = 'P 7.3' ]; then
echo "============================="
echo "== changing default php version to 7.3"
update-alternatives --set php /usr/bin/php7.3
echo "--- NEW ---"
php -v | grep '^PHP'
fi
if [ "$answer" = 'p 7.4' ] || [ "$answer" = 'P 7.4' ]; then
echo "============================="
echo "== changing default php version to 7.4"
update-alternatives --set php /usr/bin/php7.4
echo "--- NEW ---"
php -v | grep '^PHP'
fi
if [ "$answer" = 'p def' ] || [ "$answer" = 'P DEF' ]; then
echo "============================="
echo "== checking if we need to change default php version"
automode=$(update-alternatives --display php | grep -c 'auto mode')
echo "============================="
if [ $automode -ge 1 ]; then
echo "=== php auto mode detected"
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
echo "== detected Debian $release"
if [ "$release" -eq 8 ]; then
echo "== set default php 5"
update-alternatives --set php /usr/bin/php5
fi
if [ "$release" -eq 9 ]; then
echo "== set default php 7.0"
update-alternatives --set php /usr/bin/php7.0
fi
if [ "$release" -eq 10 ]; then
echo "== set default php 7.3"
update-alternatives --set php /usr/bin/php7.3
fi
if [ "$release" -eq 11 ]; then
echo "== set default php 7.4"
update-alternatives --set php /usr/bin/php7.4
fi
echo "--- NEW ---"
php -v | grep '^PHP'
else
echo "== php is already in manual mode"
php -v | grep '^PHP'
fi
fi
if [ "$answer" = 'v' ] || [ "$answer" = 'V' ]; then
echo "============================="
echo "== updating myVesta"
if [ -f "/usr/local/vesta/bin/v-update-myvesta" ]; then
/usr/local/vesta/bin/v-update-myvesta
else
number_of_files=$(ls /var/cache/apt/archives/vesta_.* 2>/dev/null | wc -l)
if [ $number_of_files -gt 0 ]; then
rm /var/cache/apt/archives/vesta_* > /dev/null 2>&1
fi
apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" > /usr/local/vesta/log/update-$package.log 2>&1
apt-get install --reinstall vesta
fi
fi
if [ "$answer" = 'vo' ] || [ "$answer" = 'VO' ]; then
echo "============================="
echo "== updating myVesta (without 'apt-get update')"
number_of_files=$(ls /var/cache/apt/archives/vesta_.* 2>/dev/null | wc -l)
if [ $number_of_files -gt 0 ]; then
rm /var/cache/apt/archives/vesta_* > /dev/null 2>&1
fi
apt-get install --reinstall vesta
fi
if [ "$answer" = 'vor' ] || [ "$answer" = 'VOR' ]; then
echo "============================="
echo "== updating myVesta (without apt-get update and without reinstall)"
number_of_files=$(ls /var/cache/apt/archives/vesta_.* 2>/dev/null | wc -l)
if [ $number_of_files -gt 0 ]; then
rm /var/cache/apt/archives/vesta_* > /dev/null 2>&1
fi
apt-get install vesta
fi
if [ "$answer" = 't' ] || [ "$answer" = 'T' ]; then
echo "============================="
echo "== cleaning trash"
df -m
echo "------"
ps -Af | grep tailf | grep -v "grep tailf"
echo "------"
/usr/local/vesta/bin/v-clean-garbage
echo "--------------"
df -m
echo "--------------"
ps -Af | grep tailf | grep -v "grep tailf"
fi
if [ "$answer" = 'm def' ] || [ "$answer" = 'M DEF' ]; then
phpupdate=$(grep -c 'php' /var/log/apt/history.log)
if [ $phpupdate -gt 0 ]; then
answer='m'
fi
fi
if [ "$answer" = 'm' ] || [ "$answer" = 'M' ]; then
echo "============================="
echo "== installing php-memcache modules"
apt-get install -y $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcache ")
apt-get install -y $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcached ")
fi
if [ "$answer" = 'd' ] || [ "$answer" = 'D' ]; then
echo "============================="
echo "== running: df -h"
df -h
fi
if [ "$answer" = 'f' ] || [ "$answer" = 'F' ]; then
echo "============================="
echo "== running: free -h"
free -h
fi
if [ "$answer" = 'w' ] || [ "$answer" = 'W' ]; then
echo "== running: free -h"
w
fi
if [ "$answer" = 'inst p' ] || [ "$answer" = 'INST P' ]; then
echo "============================="
echo "== installing new PHP versions"
cd /root
wget -nv -O /root/vesta-inst-php.sh https://c.myvestacp.com/tools/multi-php-install.sh
chmod u+x ./vesta-inst-php.sh
mcedit ./vesta-inst-php.sh
sudo ./vesta-inst-php.sh
fi
if [ "$answer" = 'inst pgw' ] || [ "$answer" = 'INST PGW' ]; then
echo "============================="
echo "== Installing phpgate"
wget -nv http://dl.myvestacp.com/vesta/install-phpgate.sh -O /root/install-phpgate.sh
chmod u+x /root/install-phpgate.sh
/root/install-phpgate.sh
fi
if [ "$answer" = 'inst memcache' ] || [ "$answer" = 'inst memcached' ] || [ "$answer" = 'INST MEMCACHE' ] || [ "$answer" = 'INST MEMCACHED' ]; then
echo "============================="
echo "== Installing memcached"
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get -y install memcached
apt-get -y install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcache ")
apt-get -y install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcached ")
if [ $memory -lt 15000000 ]; then
sed -i "s/-m 64/-m 256/" /etc/memcached.conf
else
sed -i "s/-m 64/-m 1024/" /etc/memcached.conf
fi
systemctl restart memcached
echo "== memcached installed."
echo "-----------------------"
fi
if [ "$answer" = 'inst redis' ] || [ "$answer" = 'INST REDIS' ]; then
echo "============================="
echo "== Installing Redis"
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get install -y redis-server
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-redis ")
sed -i "s|^supervised no|supervised systemd|g" /etc/redis/redis.conf
sed -i "s|^save |# save |g" /etc/redis/redis.conf
sed -i 's|^# save ""|save ""|g' /etc/redis/redis.conf
if [ $memory -lt 15000000 ]; then
sed -i "s|^# maxmemory .*|maxmemory 256m|g" /etc/redis/redis.conf
else
sed -i "s|^# maxmemory .*|maxmemory 1g|g" /etc/redis/redis.conf
fi
sed -i "s|^# maxmemory-policy .*|maxmemory-policy allkeys-lru|g" /etc/redis/redis.conf
systemctl restart redis
redis-cli info memory
echo "== Redis installed."
echo "-------------------"
fi
if [ "$answer" = 'inst nginx-rate-limit' ] || [ "$answer" = 'INST NGINX-RATE-LIMIT' ]; then
echo "============================="
echo "== Installing inst nginx-rate-limit templates"
curl -O https://c.myvestacp.com/tools/rate-limit-tpl/install_rate_limit_tpl.sh
bash install_rate_limit_tpl.sh
echo "== nginx-rate-limit templates installed."
echo "-------------------"
fi
if [ "$answer" = 'check fc' ] || [ "$answer" = 'CHECK FC' ]; then
echo "== Checking if FreshClam is up"
clamavup=$(/usr/local/vesta/bin/v-list-sys-services | grep 'clamav-daemon' | grep -c 'running')
freshclamdown=$(/usr/local/vesta/bin/v-list-sys-services | grep 'clamav-freshclam' | grep -c 'off')
if [ $clamavup -eq 1 ] && [ $freshclamdown -eq 1 ]; then
echo "== Starting FreshClam"
systemctl enable clamav-freshclam.service
systemctl start clamav-freshclam.service
fi
fi
if [ "$answer" = 'enable-ssh-root-password-login' ] || [ "$answer" = 'ENABLE-SSH-ROOT-PASSWORD-LOGIN' ]; then
sed -i "s|^PermitRootLogin .*|PermitRootLogin yes|g" /etc/ssh/sshd_config
sed -i "s|^#PermitRootLogin .*|PermitRootLogin yes|g" /etc/ssh/sshd_config
systemctl restart sshd
echo "--- New settings ---"
grep '^PermitRoot' /etc/ssh/sshd_config
echo "--------------------"
echo "Port 22 opened in Firewall for all IP addresses."
/usr/local/vesta/bin/v-unsuspend-firewall-rule "11"
echo "--------------------"
echo "Type 'passwd' in the terminal to set the root password."
echo "--------------------"
fi
if [ "$answer" = 'r' ] || [ "$answer" = 'R' ]; then
echo "============================="
echo "== Rebooting the server"
reboot
fi
if [ "$answer" = 'b' ] || [ "$answer" = 'B' ]; then
echo "============================="
echo "== Running bash"
bash
fi
if [ "$answer" = 'q' ] || [ "$answer" = 'Q' ]; then
echo "============================="
echo "== Exiting... bye bye :)"
exit 0
fi
if [ "$answer" = 'h' ] || [ "$answer" = 'H' ]; then
myhelp
fi
if [ "$answer" = 'inst v' ] || [ "$answer" = 'INST V' ]; then
echo "============================="
echo "== installing myVesta"
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -lt 10 ]; then
apt-get update
else
apt-get update --allow-releaseinfo-change
fi
apt-get -y --with-new-pkgs upgrade && apt-get -y dist-upgrade
apt-get -y install curl wget mc git sudo dnsutils screen
cd ~
curl -O http://c.myvestacp.com/vst-install-debian.sh
sudo bash vst-install-debian.sh
source /etc/profile
PATH=$PATH:/usr/local/vesta/bin && export PATH
fi
if [ "$answer" = 'inst r' ] || [ "$answer" = 'INST R' ]; then
echo "============================="
echo "== Installing new Roundcube"
wget -nv https://c.myvestacp.com/tools/install-new-roundcube.sh -O /root/install-new-roundcube.sh
chmod u+x /root/install-new-roundcube.sh
mcedit /root/install-new-roundcube.sh
/root/install-new-roundcube.sh
fi
if [ "$answer" = 'id_rsa' ] || [ "$answer" = 'ID_RSA' ]; then
if [ ! -f "/root/.ssh/id_rsa.pub" ]; then
ssh-keygen -q -t rsa -N '' -C "$HOSTNAME" -b 4096 -f /root/.ssh/id_rsa 2>/dev/null <<< y >/dev/null
fi
echo "=== YOUR id_rsa.pub IS BELOW ==="
cat /root/.ssh/id_rsa.pub
echo "======"
fi
done

View file

@ -43,7 +43,7 @@ fi
# Checking destination path
rpath=$(readlink -f "$dst_file")
if [ -z "$(echo $rpath |egrep "^/tmp|^$homedir")" ]; then
echo "Error: ivalid destination path $dst_file"
echo "Error: invalid destination path $dst_file"
exit 2
fi

View file

@ -0,0 +1,69 @@
#!/bin/bash
# info: delete database if domain has database
# options: DOMAIN
#
# The function for deleting database if domain has database
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
RET=$OK
# echo "================================="
r=$(/usr/local/vesta/bin/v-get-database-credentials-of-domain $domain)
# echo $r
eval $r
# echo "================================="
if [ ! -z "$DATABASE_NAME" ]; then
echo "=== v-delete-database $USER $DATABASE_NAME"
/usr/local/vesta/bin/v-delete-database $USER $DATABASE_NAME
if [ $? -ne 0 ]; then
echo "=== v-delete-database failed"
RET=$E_NOTEXIST
fi
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
log_event "$RET" "$ARGUMENTS"
exit

View file

@ -37,9 +37,10 @@ is_object_unsuspended 'user' 'USER' "$user"
if [ ! -z "$WEB_SYSTEM" ]; then
str=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf)
if [ ! -z "$str" ]; then
$BIN/v-delete-database-of-domain $domain
domain_found='yes'
$BIN/v-delete-web-domain $user $domain 'no'
check_result $? "can't suspend web" > /dev/null
check_result $? "can't delete web" > /dev/null
fi
fi
@ -49,7 +50,7 @@ if [ ! -z "$DNS_SYSTEM" ]; then
if [ ! -z "$str" ]; then
domain_found='yes'
$BIN/v-delete-dns-domain $user $domain 'no'
check_result $? "can't suspend dns" > /dev/null
check_result $? "can't delete dns" > /dev/null
fi
fi
@ -59,7 +60,7 @@ if [ ! -z "$MAIL_SYSTEM" ]; then
if [ ! -z "$str" ]; then
domain_found='yes'
$BIN/v-delete-mail-domain $user $domain
check_result $? "can't suspend mail" > /dev/null
check_result $? "can't delete mail" > /dev/null
fi
fi

View file

@ -53,6 +53,11 @@ $iptables -D fail2ban-$chain $b 2>/dev/null
# Changing permissions
chmod 660 $conf
# nginx deny rules conf
if [ "$chain" = "WEB" ] && [ -f "/etc/nginx/conf.d/block.conf" ]; then
sed -i "/deny $ip;/d" /etc/nginx/conf.d/block.conf
systemctl reload nginx
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -34,12 +34,21 @@ is_object_valid '../../data/firewall/rules' 'RULE' "$rule"
# Action #
#----------------------------------------------------------#
oldvalues=$(grep "RULE='$rule'" $VESTA/data/firewall/rules.conf)
# Deleting rule
sed -i "/RULE='$rule' /d" $VESTA/data/firewall/rules.conf
# Updating system firewall
$BIN/v-update-firewall
if [ "$WEB_SYSTEM" == 'nginx' ] || [ "$PROXY_SYSTEM" == 'nginx' ]; then
parse_object_kv_list_non_eval "$oldvalues"
if [ "$PORT" == "80,443" ] && [ "$ACTION" == "DROP" ]; then
sed -i "\#$IP#d" /etc/nginx/conf.d/block-firewall.conf
systemctl restart nginx
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -0,0 +1,165 @@
#!/bin/bash
# info: delete inactive WordPress plugins and themes
# options: DOMAIN
#----------------------------------------------------------#
# Variable & Function #
#----------------------------------------------------------#
[ "$(whoami)" != "root" ] && { echo "You must be root to run this command."; exit 1; }
source /etc/profile
DOMAIN="$1"
[ -z "$DOMAIN" ] && { echo "Usage: v-delete-inactive-wordpress-plugins-and-themes DOMAIN"; exit 1; }
USER="$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN")"
[ -z "$USER" ] && { echo "Domain $DOMAIN does not exist."; exit 1; }
WP_PATH="/home/$USER/web/$DOMAIN/public_html"
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
# WP-CLI wrapper
if [ ! -z "$PHP" ]; then
WP_RUN="PHP=$PHP /usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes"
else
WP_RUN="/usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes"
fi
quarantined=0;
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd "$WP_PATH" || exit 1
echo "Inactive WordPress plugins for $DOMAIN:"
echo "-------------------------------------"
RUN="$WP_RUN plugin list --format=csv --skip-plugins --skip-themes"
PLUGINS_LIST_CSV=$(eval "$RUN")
return_code=$?
if [ $return_code -ne 0 ]; then
echo "WP-CLI error:"
echo "return code: $return_code"
cat /home/$USER/web/$DOMAIN/wp-cli-error.log
exit $return_code
fi
PLUGINS_LIST_CSV=$(echo "$PLUGINS_LIST_CSV" | tail -n +2)
DEACTIVATED_PLUGINS_LIST_CSV=""
if [ ! -z "$PLUGINS_LIST_CSV" ]; then
printf "%-30s %-20s %-20s %-20s %-20s %-20s\n" "name" "status" "update" "version" "update_version" "auto_update"
while IFS=',' read -r NAME STATUS UPDATE VERSION UPDATE_VERSION AUTO_UPDATE; do
if [ "$STATUS" = "inactive" ]; then
printf "%-30s %-20s %-20s %-20s %-20s %-20s\n" "$NAME" "$STATUS" "$UPDATE" "$VERSION" "$UPDATE_VERSION" "$AUTO_UPDATE"
DEACTIVATED_PLUGINS_LIST_CSV="$DEACTIVATED_PLUGINS_LIST_CSV\n$NAME"
fi
done <<< "$PLUGINS_LIST_CSV"
else
echo "No plugins found."
fi
if [ ! -z "$DEACTIVATED_PLUGINS_LIST_CSV" ]; then
echo ""
read -r -p "Do you want to move inactive plugins to quarantine? (y/n, default: y): " RESPONSE < /dev/tty
if [ "$RESPONSE" == "y" ] || [ "$RESPONSE" == "Y" ] || [ -z "$RESPONSE" ]; then
while IFS=',' read -r NAME STATUS UPDATE VERSION UPDATE_VERSION AUTO_UPDATE; do
if [ "$STATUS" = "inactive" ]; then
folder="/home/$USER/web/$DOMAIN/public_html/wp-content/plugins/$NAME"
file="/home/$USER/web/$DOMAIN/public_html/wp-content/plugins/$NAME.php"
if [ -d "$folder" ] || [ -f "$file" ]; then
destination_base_folder="/srv/wp-deactivated-plugins/$DOMAIN"
if [ -d "$folder" ]; then
source_path="$folder"
destination_path="$destination_base_folder/$NAME"
elif [ -f "$file" ]; then
source_path="$file"
destination_path="$destination_base_folder/$NAME.php"
fi
mkdir -p $destination_base_folder
chown $USER:$USER $destination_base_folder
mv $source_path $destination_path
if [ -d "$destination_path" ]; then
echo "= Folder $source_path moved to $destination_path"
quarantined=1;
fi
if [ -f "$destination_path" ]; then
echo "= File $source_path moved to $destination_path"
quarantined=1;
fi
else
echo "=== ERROR: Folder $folder or file $file not found - it does not exist?"
fi
fi
done <<< "$PLUGINS_LIST_CSV"
fi
fi
echo ""
echo "Inactive WordPress themes for $DOMAIN:"
echo "-------------------------------------"
RUN="$WP_RUN theme list --format=csv --skip-plugins --skip-themes"
THEMES_LIST_CSV=$(eval "$RUN")
return_code=$?
if [ $return_code -ne 0 ]; then
echo "WP-CLI error:"
echo "return code: $return_code"
cat /home/$USER/web/$DOMAIN/wp-cli-error.log
exit $return_code
fi
THEMES_LIST_CSV=$(echo "$THEMES_LIST_CSV" | tail -n +2)
DEACTIVATED_THEMES_LIST_CSV=""
if [ ! -z "$THEMES_LIST_CSV" ]; then
printf "%-30s %-20s %-20s %-20s %-20s %-20s\n" "name" "status" "update" "version" "update_version" "auto_update"
while IFS=',' read -r NAME STATUS UPDATE VERSION UPDATE_VERSION AUTO_UPDATE; do
if [ "$STATUS" = "inactive" ]; then
printf "%-30s %-20s %-20s %-20s %-20s %-20s\n" "$NAME" "$STATUS" "$UPDATE" "$VERSION" "$UPDATE_VERSION" "$AUTO_UPDATE"
DEACTIVATED_THEMES_LIST_CSV="$DEACTIVATED_THEMES_LIST_CSV\n$NAME"
fi
done <<< "$THEMES_LIST_CSV"
else
echo "No themes found."
fi
if [ ! -z "$DEACTIVATED_THEMES_LIST_CSV" ]; then
echo ""
read -r -p "Do you want to move inactive themes to quarantine? (y/n, default: y): " RESPONSE < /dev/tty
if [ "$RESPONSE" == "y" ] || [ "$RESPONSE" == "Y" ] || [ -z "$RESPONSE" ]; then
while IFS=',' read -r NAME STATUS UPDATE VERSION UPDATE_VERSION AUTO_UPDATE; do
if [ "$STATUS" = "inactive" ]; then
folder="/home/$USER/web/$DOMAIN/public_html/wp-content/themes/$NAME"
if [ -d "$folder" ]; then
destination_base_folder="/srv/wp-deactivated-themes/$DOMAIN"
source_path="$folder"
destination_path="$destination_base_folder/$NAME"
mkdir -p $destination_base_folder
chown $USER:$USER $destination_base_folder
mv $source_path $destination_path
if [ -d "$destination_path" ]; then
echo "= Folder $source_path moved to $destination_path"
quarantined=1;
fi
else
echo "=== ERROR: Folder $folder not found - it does not exist?"
fi
fi
done <<< "$THEMES_LIST_CSV"
fi
fi
echo ""
if [ $quarantined -eq 1 ]; then
echo "= All deactivated plugins and themes moved to quarantine."
echo "= You can find them in /srv/wp-deactivated-plugins/$DOMAIN and /srv/wp-deactivated-themes/$DOMAIN"
else
echo "= No deactivated plugins or themes found."
fi
exit 0;

View file

@ -51,6 +51,9 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then
rm -f /etc/$MAIL_SYSTEM/domains/$domain_idn
rm -rf $HOMEDIR/$user/conf/mail/$domain
rm -rf $HOMEDIR/$user/mail/$domain_idn
if [ -d "/hdd/home/$user/mail/$domain_idn" ]; then
rm -rf /hdd/home/$user/mail/$domain_idn
fi
fi
# Deleting dkim dns record

View file

@ -48,7 +48,7 @@ fi
# Deleting dns record
if [ ! -z "$DNS_SYSTEM" ] && [ -e "$USER_DATA/dns/$domain.conf" ]; then
records=$($BIN/v-list-dns-records $user $domain plain)
dkim_records=$(echo "$records" |grep -w '_domainkey' | cut -f 1 -d ' ')
dkim_records=$(echo "$records" |grep -w '_domainkey' | awk '{print $1}')
for id in $dkim_records; do
$BIN/v-delete-dns-record $user $domain $id
done

127
bin/v-delete-mails Normal file
View file

@ -0,0 +1,127 @@
#!/bin/bash
# info: delete old emails (by mtime) for user/domain/account, with optional scope
# usage: v-delete-mails USER DOMAIN ACCOUNT MTIME_DAYS|all SCOPE
# SCOPE: all clean every Maildir folder (cur, new, tmp, custom subfolders)
# trash clean only Trash/Junk/Spam folders
# load Vesta functions & config
source "$VESTA/func/main.sh"
source "$VESTA/conf/vesta.conf"
# read arguments
user="$1"
domain="$2"
account="$3"
mtime="$4"
scope="$5"
# verify argument count
check_args '5' "$#" 'USER DOMAIN ACCOUNT MTIME_DAYS|all SCOPE'
# validate scope
if [[ "$scope" != "all" && "$scope" != "trash" ]]; then
echo "ERROR: SCOPE must be 'all' or 'trash'."
exit 1
fi
# validate logical combinations
if [[ "$user" == "all" ]]; then
if [[ "$domain" != "all" || "$account" != "all" ]]; then
echo "ERROR: When USER is 'all', both DOMAIN and ACCOUNT must be 'all'."
exit 1
fi
elif [[ "$domain" == "all" && "$account" != "all" ]]; then
echo "ERROR: When DOMAIN is 'all', ACCOUNT must also be 'all'."
exit 1
fi
# build a detailed summary for the warning
declare -a summary_parts
if [[ "$user" == "all" ]]; then
summary_parts+=("all users")
else
summary_parts+=("user '$user'")
fi
if [[ "$domain" == "all" ]]; then
summary_parts+=("all domains")
else
summary_parts+=("domain '$domain'")
fi
if [[ "$account" == "all" ]]; then
summary_parts+=("all accounts")
else
summary_parts+=("account '$account'")
fi
# join with commas
summary=$(printf ", %s" "${summary_parts[@]}")
summary=${summary:2}
# only warn if any of them is 'all' or if mtime is 'all'
if [[ "$mtime" == "all" || "$user" == "all" || "$domain" == "all" || "$account" == "all" ]]; then
echo "WARNING: This will delete emails older than '$mtime' days for ${summary}."
read -p "Are you sure? (yes/no): " confirm
[[ "$confirm" != "yes" ]] && { echo "Aborted."; exit 1; }
fi
# function to delete emails
delete_emails() {
local u="$1" d="$2" a="$3"
local maildir="/home/$u/mail/$d/$a"
[[ ! -d "$maildir" ]] && return
echo "→ Cleaning '$a@$d' (user: $u), scope: $scope, mtime: $mtime"
# build find predicates
if [[ "$scope" == "all" ]]; then
folder_expr=( -path "*/cur/*" -o -path "*/new/*" -o -path "*/tmp/*" )
else
folder_expr=( -ipath "*/trash/*" -o -ipath "*/junk/*" -o -ipath "*/spam/*" )
fi
# assemble and run find
if [[ "$mtime" == "all" ]]; then
find "$maildir" -type f \( "${folder_expr[@]}" \) -print -delete 2>/dev/null
else
find "$maildir" -type f \( "${folder_expr[@]}" \) -mtime +"$mtime" -print -delete 2>/dev/null
fi
}
# collect users
if [[ "$user" == "all" ]]; then
users=$(v-list-users plain | awk '{print $1}')
else
users="$user"
fi
# iterate through users, domains, accounts
for u in $users; do
if [[ "$domain" == "all" ]]; then
domains=$(v-list-mail-domains "$u" plain | awk '{print $1}')
else
domains="$domain"
fi
for d in $domains; do
if [[ "$account" == "all" ]]; then
accounts=$(v-list-mail-accounts "$u" "$d" plain | awk '{print $1}')
else
accounts="$account"
fi
for a in $accounts; do
delete_emails "$u" "$d" "$a"
done
done
done
# restart dovecot to refresh mailbox state
systemctl restart dovecot
# log the action (status first, then message)
log_event "$OK" "Deleted emails (>$mtime days, scope=$scope) for $user $domain $account"
exit 0

View file

@ -94,6 +94,9 @@ fi
# Deleting user directories
chattr -i $HOMEDIR/$user/conf
rm -rf $HOMEDIR/$user
if [ -d "/hdd/home/$user" ]; then
rm -rf /hdd/home/$user
fi
rm -f /var/spool/mail/$user
rm -f /var/spool/cron/$user
rm -f /var/spool/cron/crontabs/$user

View file

@ -62,36 +62,24 @@ if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/5.6/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
for PHPV in /etc/php/*; do
if [ -d "${PHPV}" ]; then
# PHPVER=$(basename ${PHPV})
POOLD="${PHPV}/fpm/pool.d"
fpmconf="$POOLD/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/7.0/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
fi
POOLD="${PHPV}/fpm/pool.d-ioncube"
fpmconf="$POOLD/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/7.1/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/7.2/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/7.3/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fpmconf="/etc/php/7.4/fpm/pool.d/$domain.conf"
if [ -f "$fpmconf" ]; then
rm $fpmconf
echo "Deleted: $fpmconf" >> /usr/local/vesta/log/system.log
fi
fi
fi
done
# Deleting domain from web.conf
sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf
@ -142,6 +130,9 @@ rm -f /var/log/$WEB_SYSTEM/domains/$domain.error*
# Deleting directory
rm -rf $HOMEDIR/$user/web/$domain
if [ -d "/hdd/home/$user/web/$domain" ]; then
rm -rf /hdd/home/$user/web/$domain
fi
#----------------------------------------------------------#

View file

@ -57,8 +57,14 @@ fi
# Deleting old certificate
tmpdir=$(mktemp -p $HOMEDIR/$user/web/$domain/private -d)
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.*
mv $USER_DATA/ssl/$domain.* $tmpdir
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.ca
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.crt
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.key
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.pem
mv $USER_DATA/ssl/$domain.ca $tmpdir
mv $USER_DATA/ssl/$domain.crt $tmpdir
mv $USER_DATA/ssl/$domain.key $tmpdir
mv $USER_DATA/ssl/$domain.pem $tmpdir
chown -R $user:$user $tmpdir

View file

@ -0,0 +1,64 @@
#!/bin/bash
# info: delete PHP files from WordPress uploads folder
# options: DOMAIN
#----------------------------------------------------------#
# Variable & Function #
#----------------------------------------------------------#
[ "$(whoami)" != "root" ] && { echo "You must be root to run this command."; exit 1; }
source /etc/profile
DOMAIN="$1"
[ -z "$DOMAIN" ] && { echo "Usage: v-delete-wordpress-uploads-php-files DOMAIN"; exit 1; }
USER="$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN")"
[ -z "$USER" ] && { echo "Domain $DOMAIN does not exist."; exit 1; }
WP_PATH="/home/$USER/web/$DOMAIN/public_html"
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
quarantined=0;
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd "$WP_PATH" || exit 1
files=$(find wp-content/uploads/ -type f -name "*.php")
if [ -z "$files" ]; then
echo "= No PHP files found in WordPress uploads folder."
exit 0;
fi
echo "= Found PHP files in WordPress uploads folder for domain $DOMAIN :"
echo "-------------------------------------"
echo "$files"
echo "-------------------------------------"
read -r -p "Do you want to move these files to quarantine? (y/n, default: y): " RESPONSE < /dev/tty
if [ "$RESPONSE" == "y" ] || [ "$RESPONSE" == "Y" ] || [ -z "$RESPONSE" ]; then
for file in $files; do
source_file="/home/$USER/web/$DOMAIN/public_html/$file"
destination_file="/srv/wp-uploads-php-files-quarantine/$DOMAIN/$file"
destination_folder=$(dirname "$destination_file")
mkdir -p "$destination_folder"
chown $USER:$USER "$destination_folder"
mv "$source_file" "$destination_file"
echo "= File $source_file moved to $destination_file"
quarantined=1;
done
chown -R $USER:$USER "/srv/wp-uploads-php-files-quarantine/$DOMAIN"
fi
echo ""
if [ $quarantined -eq 1 ]; then
echo "= All PHP files moved to quarantine."
echo "= You can find them in /srv/wp-uploads-php-files-quarantine/$DOMAIN"
else
echo "= No PHP files found in WordPress uploads folder."
fi
exit 0;

86
bin/v-desinfect-wordpress Normal file
View file

@ -0,0 +1,86 @@
#!/bin/bash
# info: disinfect a WordPress site with several maintenance commands
# options: DOMAIN
# -------------------------------------------------------- #
# variables and checks #
# -------------------------------------------------------- #
if [ "$(whoami)" != "root" ]; then
echo "You must be root to run this command."
exit 1
fi
# make sure all Vesta helper scripts are reachable
export PATH="/usr/local/vesta/bin:$PATH"
source /etc/profile
domain="$1"
if [ -z "$domain" ]; then
echo "Usage: v-desinfect-wp DOMAIN"
exit 1
fi
user=$(/usr/local/vesta/bin/v-search-domain-owner "$domain")
if [ -z "$user" ]; then
echo "Domain $domain does not exist."
exit 1
fi
if [ ! -f "/usr/local/vesta/bin/v-wf-malware-hyperscan-with-remediate" ]; then
echo "= WordFence CLI is not installed. Installing..."
/usr/local/vesta/bin/v-install-wordfence-cli
fi
# absolute paths to maintenance scripts, in desired order
declare -a tasks=(
"/usr/local/vesta/bin/v-change-database-password-for-wordpress"
"/usr/local/vesta/bin/v-change-wordpress-admin-passwords"
"/usr/local/vesta/bin/v-fix-wordpress-core"
"/usr/local/vesta/bin/v-delete-inactive-wordpress-plugins-and-themes"
"/usr/local/vesta/bin/v-delete-wordpress-uploads-php-files"
"/usr/local/vesta/bin/v-wf-malware-hyperscan-with-remediate"
"INTERACTIVE=1 /usr/local/vesta/bin/v-wf-malware-hyperscan-with-remediate"
)
# -------------------------------------------------------- #
# execution strategy #
# -------------------------------------------------------- #
echo
read -r -p "Run all maintenance steps automatically? (y/n) " run_all < /dev/tty
if [[ "$run_all" =~ ^[Yy]$ ]]; then
echo "Running all maintenance steps for $domain"
automatic=true
else
echo
echo "Selective mode. You will be asked for each step."
automatic=false
fi
for cmd in "${tasks[@]}"; do
if [ ! -x "$cmd" ]; then
echo "Command $cmd not found or not executable, skipping."
continue
fi
if [ "$automatic" = false ]; then
while true; do
read -r -p "Run $(basename "$cmd") for $domain? (y/n) " yn < /dev/tty
case "$yn" in
[Yy]* ) break ;;
[Nn]* ) echo "Skipping $(basename "$cmd")."; continue 2 ;;
* ) echo "Please answer y or n." ;;
esac
done
fi
echo
echo "=== $(basename "$cmd") $domain ==="
"$cmd" "$domain"
done
echo
echo "Done."
exit 0

102
bin/v-df-snapshot-diff Normal file
View file

@ -0,0 +1,102 @@
#!/bin/bash
# info: Make a diff between two snapshots of the disk usage
# options: FILE1 FILE2
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Let's declare three associative arrays
declare -A FILE1
declare -A FILE2
declare -A FILED
file1=$1
file2=$2
if [[ ! "$file1" =~ ^/usr/local/vesta/data/df/snapshot-.*\.txt$ ]]; then
file1="/usr/local/vesta/data/df/$file1"
fi
if [[ ! "$file2" =~ ^/usr/local/vesta/data/df/snapshot-.*\.txt$ ]]; then
file2="/usr/local/vesta/data/df/$file2"
fi
if [ ! -f "$file1" ]; then
echo "File $file1 not found"
exit 1
fi
if [ ! -f "$file2" ]; then
echo "File $file2 not found"
exit 1
fi
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
mkdir -p /usr/local/vesta/data/df-diff
file0="/usr/local/vesta/data/df-diff/diff-$timestamp.txt"
file0s="/usr/local/vesta/data/df-diff/diff-size-sorted-$timestamp.txt"
file0f="/usr/local/vesta/data/df-diff/diff-folder-sorted-$timestamp.txt"
touch $file0
# Let's load the first file and fill the array FILE1
while IFS=$'\t' read SIZE DIRECTORY; do
# Skip blank lines or lines that are not in the correct format
[[ -z "$DIRECTORY" ]] && continue
[[ "$DIRECTORY" = "total" ]] && continue
# Insert values into the array
FILE1["$DIRECTORY"]="$SIZE"
done < "$file1"
# Let's load the second file and fill the array FILE2
while IFS=$'\t' read SIZE DIRECTORY; do
# Skip blank lines or lines that are not in the correct format
[[ -z "$DIRECTORY" ]] && continue
[[ "$DIRECTORY" = "total" ]] && continue
# Insert values into the array
FILE2["$DIRECTORY"]="$SIZE"
done < "$file2"
# We iterate through FILE1 and look for the matching key in FILE2
for k in "${!FILE1[@]}"; do
if [[ -v FILE2["$k"] ]]; then
# If there is the same folder (KEY) in FILE2
DIFF=$(( ${FILE2[$k]} - ${FILE1[$k]} ))
FILED["$k"]=$DIFF
echo -e "${DIFF}\t${k}" >> $file0
else
# If the folder (KEY) is not found in FILE2
FILED["$k"]=${FILE1["$k"]}
echo -e "${FILE1["$k"]}\t${k}" >> $file0
fi
done
# sorted by size
sort -nr -k1,1 $file0 > $file0s
# sorted by folders
while IFS=$'\t' read SIZE DIRECTORY; do
[[ -z "$DIRECTORY" ]] && continue
[[ "$DIRECTORY" = "total" ]] && continue
echo -e "$DIRECTORY\t${FILED["$DIRECTORY"]}" >> $file0f
done < "$file2"
chmod 600 $file0 $file0s $file0f
chown root:root $file0 $file0s $file0f
echo "Done."
echo "You can do:"
echo "mcview $file0"
echo "mcview $file0s"
echo "mcview $file0f"
echo "--------------------------------"
echo "Here is the first 30 lines of the diff, sorted by size (descending, in MB):"
head -n 30 $file0s
echo "--------------------------------"
echo "Here is the first 30 lines of the diff, sorted by folders (in MB):"
head -n 30 $file0f
echo "--------------------------------"
exit 0

View file

@ -0,0 +1,11 @@
#!/bin/bash
# info: Clean up old snapshots of the disk usage
# options: NONE
folder="/usr/local/vesta/data/df"
mkdir -p $folder
find $folder -type f -mtime +30 -delete
folder="/usr/local/vesta/data/df-diff"
mkdir -p $folder
find $folder -type f -mtime +30 -delete

52
bin/v-df-snapshot-make Normal file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# info: Make a snapshot of the disk usage
# options: NONE
folder="/usr/local/vesta/data/df"
mkdir -p $folder
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
du --max-depth=1 -m -x / > $folder/snapshot-$timestamp.txt
du --max-depth=6 -m -x /home > $folder/snapshot-temp.txt
for i in {2..7}; do
while IFS= read -r line; do
count=0
for (( j=0; j<${#line}; j++ )); do
if [[ ${line:j:1} == "/" ]]; then
((count++))
fi
done
if [ $count -eq $i ]; then
printf '%s\n' "$line" >> $folder/snapshot-$timestamp.txt
fi
done < $folder/snapshot-temp.txt
done
rm $folder/snapshot-temp.txt
if [ -d "/hdd" ]; then
du --max-depth=7 -m -x /hdd > $folder/snapshot-temp.txt
for i in {1..8}; do
while IFS= read -r line; do
count=0
for (( j=0; j<${#line}; j++ )); do
if [[ ${line:j:1} == "/" ]]; then
((count++))
fi
done
if [ $count -eq $i ]; then
printf '%s\n' "$line" >> $folder/snapshot-$timestamp.txt
fi
done < $folder/snapshot-temp.txt
done
rm $folder/snapshot-temp.txt
fi
du --max-depth=1 -m -x /var/lib/mysql >> $folder/snapshot-$timestamp.txt
du --max-depth=1 -m -x /var/log >> $folder/snapshot-$timestamp.txt
chmod 600 $folder/snapshot-$timestamp.txt
chown root:root $folder/snapshot-$timestamp.txt
exit 0

90
bin/v-edit-domain-php-ini Normal file
View file

@ -0,0 +1,90 @@
#!/bin/bash
# info: Edit php.ini for certain domain
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
SILENT_MODE=1
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
# echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
# echo "Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
fpm_ver=$(/usr/local/vesta/bin/v-get-php-version-of-domain $domain)
if [ -z "$fpm_ver" ]; then
echo "PHP version for domain $domain could not be determined."
exit 1
fi
config_file="/etc/php/${fpm_ver}/fpm/pool.d/${domain}.conf"
if command -v mcedit >/dev/null; then
mcedit "$config_file"
else
nano "$config_file"
fi
echo "Restarting PHP-FPM service for PHP version ${fpm_ver}"
systemctl restart php${fpm_ver}-fpm
if [ $? -ne 0 ]; then
systemctl status php${fpm_ver}-fpm
echo "========================="
echo ""
echo "ERROR: php${fpm_ver}-fpm restart failed - please re-run the command and fix the problem !!!"
echo ""
exit $E_RESTART;
else
echo "The PHP-FPM service for PHP version ${fpm_ver} has been restarted successfully."
fi
echo ""
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit 0;

70
bin/v-edit-php-ini Normal file
View file

@ -0,0 +1,70 @@
#!/bin/bash
# info: Edit php.ini for a specific PHP version
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# List available PHP versions and store them into an array
mapfile -t php_versions < <(/usr/local/vesta/bin/v-list-php)
echo "Available PHP versions:"
PS3="Please select the PHP version you want to edit php.ini for: "
select php_version in "${php_versions[@]}"; do
if [[ -n $php_version ]]; then
break
else
echo "Invalid choice. Please try again."
fi
done
# Define path to the php.ini file
php_ini_path="/etc/php/${php_version}/fpm/php.ini"
# Check if php.ini exists for the selected version
if [[ ! -f "$php_ini_path" ]]; then
echo "The php.ini file for the selected PHP version ($php_version) does not exist."
exit 1
fi
# Determine the text editor to use
if command -v mcedit >/dev/null 2>&1; then
editor_cmd="mcedit"
elif command -v nano >/dev/null 2>&1; then
editor_cmd="nano"
else
echo "No supported text editor found. Please install 'mcedit' or 'nano'."
exit 1
fi
# Open php.ini for the chosen PHP version in the selected editor
echo "Opening $php_ini_path in editor $editor_cmd..."
$editor_cmd "$php_ini_path"
# Restart the PHP-FPM service for the selected version
echo "Restarting the PHP-FPM service for PHP version $php_version..."
systemctl restart php${php_version}-fpm
if [ $? -ne 0 ]; then
systemctl status php${php_version}-fpm
echo "========================="
echo ""
echo "ERROR: php${php_version}-fpm restart failed - please re-run the command and fix the problem !!!"
echo ""
exit $E_RESTART;
else
echo "The PHP-FPM service for PHP version ${php_version} has been restarted successfully."
fi
#----------------------------------------------------------#
# Exit #
#----------------------------------------------------------#
exit 0;

View file

@ -0,0 +1,31 @@
#!/bin/bash
# info: ensure that pool.d folders are not empty
# options:
#
# The function ensure that pool.d folders are not empty
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
ensure_poold_folders_not_empty
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -0,0 +1,35 @@
#!/bin/bash
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1;
fi
if [ -f "/tmp/patched" ]; then rm /tmp/patched; fi;
echo "=== Fixing php.ini files to have the correct disable_functions line"
export NOTFOUNDVAL="exec,system,passthru,shell_exec"
export LINEBEGINSWITH="disable_functions ="
export NEWVAL="disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,exec,system,passthru,shell_exec,proc_open,popen"
find /etc/php/*/fpm/ -type f -name "php.ini" -exec grep -L "$NOTFOUNDVAL" {} \; | xargs sh -c 'found=0; for arg do if [ ! -f "$arg.disable_patching" ]; then if [ $found -eq 0 ]; then echo "== Fixing existing lines"; found=1; touch /tmp/patched; fi; echo "= Patching $arg"; sed -i "s|^$LINEBEGINSWITH.*|$NEWVAL|g" $arg; fi; done' _
export NOTFOUNDVAL2="^$LINEBEGINSWITH"
export REMOVELINETHATCONTAINS=$LINEBEGINSWITH
find /etc/php/*/fpm/ -type f -name "php.ini" -exec grep -L "$NOTFOUNDVAL2" {} \; | xargs sh -c 'found=0; for arg do if [ ! -f "$arg.disable_patching" ]; then if [ $found -eq 0 ]; then echo "== Adding missing lines"; found=1; touch /tmp/patched; fi; echo "= Patching $arg"; sed -i "s|.*$REMOVELINETHATCONTAINS.*||g" $arg; echo "$NEWVAL" >> $arg; fi; done' _
if [ -f "/tmp/patched" ]; then
rm /tmp/patched
echo "== Restarting all PHP-FPM services"
systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | xargs systemctl restart
echo "=== Everything done."
else
echo "=== Everything is already correct."
fi
exit 0;

View file

@ -0,0 +1,62 @@
#!/bin/bash
# info:
# This script will fix files permissions for desired user (if ownership is lost or files have wrong chmod)
# options: user
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
echo "You must be root or admin to execute this script";
exit 1;
fi
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
find /home/$user/conf/mail/ -type d -exec chown Debian-exim:mail {} \;
find /home/$user/conf/mail/*/ -type f -exec chown Debian-exim:mail {} \;
find /home/$user/conf/mail/*/ -name "passwd" -type f -exec chown dovecot:mail {} \;
find /home/$user/mail/ -type d -exec chown $user:mail {} \;
find /home/$user/mail/*/ -type d -exec chown $user:mail {} \;
find /home/$user/mail/*/ -type f -exec chown $user:mail {} \;
find /home/$user/mail/*/ -type d -exec chmod u+rwx {} \;
find /home/$user/mail/*/ -type d -exec chmod g+rwx {} \;
find /home/$user/mail/*/ -type f -exec chmod u+rw {} \;
find /home/$user/mail/*/ -type f -exec chmod g+rw {} \;
find /home/$user/mail/*/ -maxdepth 1 -type d -exec chmod g-rwx {} \;
find /home/$user/conf/dns/ -type f -exec chown root:bind {} \;
find /home/$user/conf/ -type d -exec chown root:root {} \;
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
/usr/local/vesta/bin/v-fix-website-permissions $domain $user
echo "--------------------------------"
done
echo "Done, permissions fixed for user: $user"
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -0,0 +1,161 @@
#!/bin/bash
# info: Fixing chown and chmod permissions for a website
# options: DOMAIN [USER]
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
# Check if number of arguments is 2
if [ $# -eq 2 ]; then
user=$2
else
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
fi
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/conf/vesta.conf
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "Error: Folder /home/$user doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Error: Folder /home/$user/web/$domain/public_html doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Going to domain directory
cd /home/$USER/web/$domain
# Ownership check
if [ -z "$SKIP_OWNERSHIP_CHECK" ] && [ -f "public_html/index.php" ]; then
owner=$(stat -c '%U' "public_html/index.php")
if [ "$owner" = "root" ] || [ "$owner" = "www-data" ]; then
echo "Skipping permission fix for $domain, because v-lock-wordpress is used (index.php is owned by $owner)"
exit 1
fi
fi
echo "Updating permissions and ownership for /home/$USER/web/$domain/"
php_chmod_allowed=1
if [ -f "/home/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/web/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/web/$domain/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
# === General files and directories permissions ===
if [ "$php_chmod_allowed" -eq 1 ]; then
# New way of fixing permissions
# Fixing permissions
find public_html/ -type d ! -perm 755 -exec chmod 755 {} +
find public_html/ -type f ! \( -name "*.php" -o -name "*.env" \) ! -perm 644 -exec chmod 644 {} +
# Fixing ownership
find public_html/ -type d ! -user $USER -exec chown $USER:$USER {} +
find public_html/ -type f ! \( -name "*.php" -o -name "*.env" \) ! -user $USER -exec chown $USER:$USER {} +
else
# Old way of fixing permissions
# Fixing permissions
find public_html/ -type d ! -perm 755 -exec chmod 755 {} +
find public_html/ -type f ! -perm 644 -exec chmod 644 {} +
# Fixing ownership
find public_html/ -type d ! -user $USER -exec chown $USER:$USER {} +
find public_html/ -type f ! -user $USER -exec chown $USER:$USER {} +
fi
# === PHP and .env permissions ===
if [ "$php_chmod_allowed" -eq 1 ]; then
php_chmod="600"
if [ "$WEB_SYSTEM" = 'nginx' ]; then
php_chmod="644"
fi
if [ -f "/home/php_chmod" ]; then
php_chmod=$(cat /home/php_chmod)
fi
if [ -f "/home/$USER/php_chmod" ]; then
php_chmod=$(cat /home/$USER/php_chmod)
fi
if [ -f "/home/$USER/web/php_chmod" ]; then
php_chmod=$(cat /home/$USER/web/php_chmod)
fi
if [ -f "/home/$USER/web/$domain/php_chmod" ]; then
php_chmod=$(cat /home/$USER/web/$domain/php_chmod)
fi
# Setting chmod 600 for all .php and .env files
echo "= Setting chmod $php_chmod for all .php and .env files"
# Fixing permissions
find -type f \( -name "*.php" -o -name "*.env" \) ! -perm $php_chmod -exec chmod $php_chmod {} +
# Fixing ownership
find -type f \( -name "*.php" -o -name "*.env" \) ! -user $USER -exec chown $USER:$USER {} +
fi
# === Symlinks ownership ===
symlink_chown_allowed=1
if [ -f "/home/symlink_chown_disabled" ]; then
symlink_chown_allowed=0
fi
if [ -f "/home/$USER/symlink_chown_disabled" ]; then
symlink_chown_allowed=0
fi
if [ -f "/home/$USER/web/symlink_chown_disabled" ]; then
symlink_chown_allowed=0
fi
if [ -f "/home/$USER/web/$domain/symlink_chown_disabled" ]; then
symlink_chown_allowed=0
fi
if [ "$symlink_chown_allowed" -eq 1 ]; then
find -type l ! -user $USER -exec chown -h $USER:$USER {} +
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "Permissions for $domain have been successfully updated."
exit 0

View file

@ -0,0 +1,41 @@
#!/bin/bash
# info: fix website permissions for all websites
# options:
#
# The command is used for fixing website permissions for all websites on the server.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Importing system variables
source /etc/profile
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
continue;
fi
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
/usr/local/vesta/bin/v-fix-website-permissions $domain $user
echo "--------------------------------"
done
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -0,0 +1,44 @@
#!/bin/bash
# info: fix website permissions for all websites
# options:
#
# The command is used for fixing website permissions for all websites on the server.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Importing system variables
source /etc/profile
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
touch /usr/local/vesta/log/fix-website-permissions-for-all-websites-only-php.log
truncate -s 0 /usr/local/vesta/log/fix-website-permissions-for-all-websites-only-php.log
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
continue;
fi
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
/usr/local/vesta/bin/v-fix-website-permissions-only-php $domain $user >> /usr/local/vesta/log/fix-website-permissions-for-all-websites-only-php.log 2>&1
echo "--------------------------------" >> /usr/local/vesta/log/fix-website-permissions-for-all-websites-only-php.log
done
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -0,0 +1,121 @@
#!/bin/bash
# info: Fixing PHP and .env permissions and ownership for a website
# options: DOMAIN [USER]
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
# Check if number of arguments is 2
if [ $# -eq 2 ]; then
user=$2
else
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
fi
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/conf/vesta.conf
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "Error: Folder /home/$user doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Error: Folder /home/$user/web/$domain/public_html doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Going to domain directory
cd /home/$USER/web/$domain
# Ownership check
if [ -z "$SKIP_OWNERSHIP_CHECK" ] && [ -f "public_html/index.php" ]; then
owner=$(stat -c '%U' "public_html/index.php")
if [ "$owner" = "root" ] || [ "$owner" = "www-data" ]; then
echo "Skipping permission fix for $domain, because v-lock-wordpress is used (index.php is owned by $owner)"
exit 1
fi
fi
echo "Updating PHP and .env permissions and ownership for /home/$USER/web/$domain/"
php_chmod_allowed=1
if [ -f "/home/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/web/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
if [ -f "/home/$USER/web/$domain/php_chmod_disabled" ]; then
php_chmod_allowed=0
fi
# === PHP and .env permissions ===
if [ "$php_chmod_allowed" -eq 1 ]; then
php_chmod="600"
if [ "$WEB_SYSTEM" = 'nginx' ]; then
php_chmod="644"
fi
if [ -f "/home/php_chmod" ]; then
php_chmod=$(cat /home/php_chmod)
fi
if [ -f "/home/$USER/php_chmod" ]; then
php_chmod=$(cat /home/$USER/php_chmod)
fi
if [ -f "/home/$USER/web/php_chmod" ]; then
php_chmod=$(cat /home/$USER/web/php_chmod)
fi
if [ -f "/home/$USER/web/$domain/php_chmod" ]; then
php_chmod=$(cat /home/$USER/web/$domain/php_chmod)
fi
# Setting chmod 600 for all .php and .env files
echo "= Setting chmod $php_chmod for all .php and .env files"
# Fixing permissions
find -type f \( -name "*.php" -o -name "*.env" \) ! -perm $php_chmod -exec chmod $php_chmod {} +
# Fixing ownership
find -type f \( -name "*.php" -o -name "*.env" \) ! -user $USER -exec chown $USER:$USER {} +
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "PHP and .env permissions and ownership for $domain have been successfully updated."
exit 0

115
bin/v-fix-wordpress-core Normal file
View file

@ -0,0 +1,115 @@
#!/bin/bash
# info: fix compromised wp-admin and wp-includes
# options: DOMAIN [CACHE_DIR]
#
# Replaces wp-admin and wp-includes with clean copies that match
# the WordPress core version detected on the site.
#
# Example:
# v-fix-wp-core example.com
# v-fix-wp-core example.com /srv/wp-cache
#----------------------------------------------------------#
# Variable & Function #
#----------------------------------------------------------#
# Arguments
DOMAIN="$1"
CACHE_DIR="${2-/srv/wp-cache}" # default cache location
QUARANTINE_DIR="/srv/wp-quarantine"
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN [CACHE_DIR]'
is_format_valid 'domain'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
TMP_DIR="$(mktemp -d /tmp/wpfix.XXXXXX)" # temp workspace
trap 'rm -rf "$TMP_DIR"' EXIT
# 1etermine WP version
if [ -z "$PHP" ]; then
WP_VERSION="$(/usr/local/vesta/bin/v-run-wp-cli "$DOMAIN" core version | tr -d '[:space:]')"
else
WP_VERSION="$(PHP=$PHP /usr/local/vesta/bin/v-run-wp-cli "$DOMAIN" core version | tr -d '[:space:]')"
fi
check_result $? "cannot detect WP version" > /dev/null
if [ -z "$WP_VERSION" ]; then
check_result 1 "empty WP version string"
fi
echo "Detected WordPress version $WP_VERSION"
# 2ind site owner and path
USER="$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN")"
check_result $? "cannot find domain owner" > /dev/null
SITE_PATH="/home/$USER/web/$DOMAIN/public_html"
if [ ! -d "$SITE_PATH" ]; then
check_result 1 "site path $SITE_PATH does not exist"
fi
# ensure cached core is present
CACHE_PATH="$CACHE_DIR/$WP_VERSION"
if [ ! -d "$CACHE_PATH/wp-admin" ] || [ ! -d "$CACHE_PATH/wp-includes" ]; then
echo "Cache for $WP_VERSION missing, downloading ZIP..."
mkdir -p "$CACHE_PATH"
ZIP_URL="https://wordpress.org/wordpress-${WP_VERSION}.zip"
ZIP_FILE="$TMP_DIR/wp.zip"
curl -fSL "$ZIP_URL" -o "$ZIP_FILE"
check_result $? "download failed" > /dev/null
unzip -q "$ZIP_FILE" -d "$TMP_DIR"
check_result $? "unzip failed" > /dev/null
mv "$TMP_DIR/wordpress/wp-admin" "$CACHE_PATH/"
mv "$TMP_DIR/wordpress/wp-includes" "$CACHE_PATH/"
cp "$TMP_DIR/wordpress"/*.php "$CACHE_PATH/"
fi
# backup current core folders
TIMESTAMP="$(date +%Y%m%d%H%M%S)"
BACKUP_DIR="$QUARANTINE_DIR/$DOMAIN/backup-core-$TIMESTAMP"
mkdir -p "$BACKUP_DIR"
mv "$SITE_PATH/wp-admin" "$BACKUP_DIR/"
mv "$SITE_PATH/wp-includes" "$BACKUP_DIR/"
for f in "$SITE_PATH"/*.php; do
[[ $(basename "$f") == "wp-config.php" ]] && continue
mv "$f" "$BACKUP_DIR/"
done
if [ -f "$SITE_PATH/.user.ini" ]; then
mv "$SITE_PATH/.user.ini" "$BACKUP_DIR/"
fi
# chown -R www-data:www-data "$BACKUP_DIR"
check_result $? "backup failed" > /dev/null
echo "Old core folders moved to $BACKUP_DIR"
# deploy clean core
rsync -a --delete "$CACHE_PATH/wp-admin/" "$SITE_PATH/wp-admin/"
rsync -a --delete "$CACHE_PATH/wp-includes/" "$SITE_PATH/wp-includes/"
check_result $? "rsync failed" > /dev/null
for corephp in "$CACHE_PATH"/*.php; do
base=$(basename "$corephp")
[ "$base" = "wp-config.php" ] && continue
rsync -a "$corephp" "$SITE_PATH/$base"
done
# fix permissions
SKIP_OWNERSHIP_CHECK=1 /usr/local/vesta/bin/v-fix-website-permissions $DOMAIN
# chown -R www-data:www-data "$BACKUP_DIR"
echo "Done, core WP files, wp-admin and wp-includes replaced for $DOMAIN"
exit

View file

@ -46,11 +46,12 @@ fi
# Action #
#----------------------------------------------------------#
SITE_FOLDER="/home/$USER/web/$DOMAIN/public_html"
PUBLIC_HTML='public_html';
CHECK_PUBLIC_SHTML=$(/usr/local/vesta/bin/v-list-web-domain "$USER" "$DOMAIN" | grep 'SSL:' | grep -c 'single')
if [ $CHECK_PUBLIC_SHTML -eq 1 ]; then
SITE_FOLDER="/home/$USER/web/$DOMAIN/public_shtml"
PUBLIC_HTML='public_shtml';
fi
SITE_FOLDER="/home/$USER/web/$DOMAIN/$PUBLIC_HTML"
if [ ! -z "$SUBFOLDER" ]; then
SITE_FOLDER="${SITE_FOLDER}/${SUBFOLDER}"
@ -68,11 +69,22 @@ if [ -f "$SITE_FOLDER/configuration.php" ]; then
CONFIG_FILE="configuration.php"
CONFIG_FILE_FULL_PATH="$SITE_FOLDER/$CONFIG_FILE"
fi
if [ -f "$SITE_FOLDER/system/engine/model.php" ]; then
check_grep=$(grep -c 'OpenCart' $SITE_FOLDER/system/engine/model.php)
if [ "$check_grep" -gt 0 ]; then
CMS_TYPE='opencart'
CONFIG_FILE="$PUBLIC_HTML/config.php"
SUBFOLDER='..'
SITE_FOLDER="${SITE_FOLDER}/.."
CONFIG_FILE_FULL_PATH="$SITE_FOLDER/$CONFIG_FILE"
fi
fi
if [ "$CMS_TYPE" = "wordpress" ]; then
CONFIG_FILE_FULL_PATH_BACKUP="${CONFIG_FILE_FULL_PATH}_backup"
cp $CONFIG_FILE_FULL_PATH $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|//.*$||g" $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|\"|'|g" $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|('|( '|g" $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|');|' );|g" $CONFIG_FILE_FULL_PATH_BACKUP
DATABASE_NAME=$(grep 'DB_NAME' $CONFIG_FILE_FULL_PATH_BACKUP | awk '{print $3}' | sed -e "s/^'//" -e "s/'$//")
@ -97,6 +109,20 @@ if [ "$CMS_TYPE" = "joomla" ]; then
rm $CONFIG_FILE_FULL_PATH_BACKUP
fi
if [ "$CMS_TYPE" = "opencart" ]; then
CONFIG_FILE_FULL_PATH_BACKUP="${CONFIG_FILE_FULL_PATH}_backup"
cp $CONFIG_FILE_FULL_PATH $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|//.*$||g" $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|('|( '|g" $CONFIG_FILE_FULL_PATH_BACKUP
sed -i "s|');|' );|g" $CONFIG_FILE_FULL_PATH_BACKUP
DATABASE_NAME=$(grep 'DB_DATABASE' $CONFIG_FILE_FULL_PATH_BACKUP | awk '{print $3}' | sed -e "s/^'//" -e "s/'$//")
DATABASE_USERNAME=$(grep 'DB_USERNAME' $CONFIG_FILE_FULL_PATH_BACKUP | awk '{print $3}' | sed -e "s/^'//" -e "s/'$//")
DATABASE_PASSWORD=$(grep 'DB_PASSWORD' $CONFIG_FILE_FULL_PATH_BACKUP | awk '{print $3}' | sed -e "s/^'//" -e "s/'$//")
DATABASE_HOSTNAME=$(grep 'DB_HOST' $CONFIG_FILE_FULL_PATH_BACKUP | awk '{print $3}' | sed -e "s/^'//" -e "s/'$//")
rm $CONFIG_FILE_FULL_PATH_BACKUP
fi
if [ ! -z "$DATABASE_NAME" ]; then
DATABASE_NAME_WITHOUT_USER_PREFIX=$(get_database_name_without_user_prefix "$USER" "$DATABASE_NAME")
fi
@ -134,9 +160,17 @@ echo "CMS_TYPE=$CMS_TYPE"
SITE_FOLDER=$(escape_shell_quote $SITE_FOLDER)
echo "SITE_FOLDER=$SITE_FOLDER"
SUBFOLDER=$(escape_shell_quote $SUBFOLDER)
echo "SITE_SUBFOLDER=$SUBFOLDER"
USER=$(escape_shell_quote $USER)
echo "SITE_USER=$USER"
if [ "$CMS_TYPE" = "'opencart'" ]; then
echo "SEARCH_FOR_CONFIGS_DATABASE_NAME=1"
echo "SEARCH_FOR_CONFIGS_DATABASE_USERNAME=1"
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#

70
bin/v-get-dns-config Normal file
View file

@ -0,0 +1,70 @@
#!/bin/bash
# info: Get domain DNS config.db file content
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
SILENT_MODE=1
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
# echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
# echo "Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
DNS_FILE="/home/$user/conf/dns/$domain.db"
if [ -f "$DNS_FILE" ]; then
cat "$DNS_FILE"
else
echo "DNS configuration file for $domain does not exist."
exit 1
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit 0;

View file

@ -0,0 +1,72 @@
#!/bin/bash
# info: Check PHP version used for certain domain
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
SILENT_MODE=1
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
# echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
# echo "Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
TPL=$(/usr/local/vesta/bin/v-list-web-domain $user $domain shell | grep 'TEMPLATE:' | awk '{print $2}')
if [[ $TPL == "PHP-FPM-"* ]]; then
fpm_tpl_ver=${TPL:8:2}
fpm_ver="${TPL:8:1}.${TPL:9:1}"
echo "$fpm_ver"
exit 0;
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit 1;

27
bin/v-grep Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# info: calling myvesta_grep PHP function
# options: PARAMETERS
#
# The function is calling myVesta PHP replacement for GNU 'grep' command (but without regular expression)
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$1" == "--stdin" ] && [ -p /dev/stdin ]; then
STDIN=$(cat -)
if [ ! -z "$STDIN" ]; then
shift;
echo "$STDIN" | php /usr/local/vesta/func/bash-to-php-interpreter.php '--stdin' 'myvesta_grep' "$@"
exit $?
fi
fi
if [ "$1" == "--stdin" ]; then
shift;
php /usr/local/vesta/func/bash-to-php-interpreter.php '--stdin' 'myvesta_grep' "$@"
else
php /usr/local/vesta/func/bash-to-php-interpreter.php 'myvesta_grep' "$@"
fi
exit $?

View file

@ -155,8 +155,17 @@ for sk_dbr in $sk_db_list
grep -w $sk_dbr server_dbs
if [ $? == "1" ]; then
echo " Create and restore ${sk_dbr} "
sed -i "s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g" mysql/${sk_dbr}.create
sed -i "s/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g" mysql/${sk_dbr}.create
if grep -q ' enable the sandbox mode ' mysql/${sk_dbr}.create; then
v-sed '/*!999999\- enable the sandbox mode */' '' mysql/${sk_dbr}.create
fi
mysql < mysql/${sk_dbr}.create
sed -i "s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g" mysql/${sk_dbr}.sql
sed -i "s/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g" mysql/${sk_dbr}.sql
if grep -q ' enable the sandbox mode ' mysql/${sk_dbr}.sql; then
v-sed '/*!999999\- enable the sandbox mode */' '' mysql/${sk_dbr}.sql
fi
mysql ${sk_dbr} < mysql/${sk_dbr}.sql
else
echo "Error: Cant restore database $sk_dbr alredy exists in mysql server"
@ -269,23 +278,24 @@ if [[ "$sk_maild" != "cur" && "$sk_maild" != "new" && "$sk_maild" != "tmp" ]];
if [ -d "$sk_maild" ]; then
for sk_mail_account in $(ls $sk_maild/)
do
echo "Create and restore mail account: $sk_mail_account@$sk_maild"
sk_mail_pass1=$(generate_password)
/usr/local/vesta/bin/v-add-mail-account $sk_cp_user $sk_maild $sk_mail_account $sk_mail_pass1
mv ${sk_maild}/${sk_mail_account} /home/${sk_cp_user}/mail/${sk_maild}
chown ${sk_cp_user}:mail -R /home/${sk_cp_user}/mail/${sk_maild}
find /home/${sk_cp_user}/mail/${sk_maild} -type f -name 'dovecot*' -delete
# echo "${sk_mail_account}@${sk_maild} | $sk_mail_pass1" >> /root/sk_mail_password_${sk_cp_user}-${sk_cod}
if [ -f "${sk_importer_in}/homedir/etc/${sk_maild}/shadow" ]; then
echo "Set password for ${sk_mail_account}@${sk_maild}"
pass=$(grep "^${sk_mail_account}:" ${sk_importer_in}/homedir/etc/${sk_maild}/shadow | awk -F ":" '{print $2}')
newline="${sk_mail_account}:{SHA512-CRYPT}$pass:${sk_cp_user}:mail::/home/${sk_cp_user}:0"
newline2="ACCOUNT='${sk_mail_account}' ALIAS='' AUTOREPLY='no' FWD='' FWD_ONLY='' MD5='{SHA512-CRYPT}$pass' QUOTA='unlimited' U_DISK='0' SUSPENDED='no' TIME='$time' DATE='$date'"
# echo $newline
escaped=$(printf '%s\n' "$newline" | sed -e 's/[\/&]/\\&/g')
escaped2=$(printf '%s\n' "$newline2" | sed -e 's/[\/&]/\\&/g')
sed -i "s/^${sk_mail_account}:.*/$escaped/g" /home/${sk_cp_user}/conf/mail/${sk_maild}/passwd
sed -i "s/^ACCOUNT='${sk_mail_account}.*/$escaped2/g" /usr/local/vesta/data/users/${sk_cp_user}/mail/${sk_maild}.conf
else
echo "${sk_mail_account}@${sk_maild} | $sk_mail_pass1" >> /root/sk_mail_password_${sk_cp_user}-${sk_cod}
fi
done
fi
#else
@ -364,7 +374,9 @@ tput setaf 4
echo "##############################"
echo "cPanel Backup restored"
echo "Review your content and report any fail"
# echo "I reset mail password not posible restore it yet."
# echo "Check your new passwords runing: cat /root/sk_mail_password_${sk_cp_user}-${sk_cod}"
if [ -f "/root/sk_mail_password_${sk_cp_user}-${sk_cod}" ]; then
echo "I reset mail password not posible restore it yet."
echo "Check your new passwords runing: cat /root/sk_mail_password_${sk_cp_user}-${sk_cod}"
fi
echo "##############################"
tput sgr0

View file

@ -52,6 +52,12 @@ fi
# Action #
#----------------------------------------------------------#
if [ -f "/home/$user/conf/web/ssl.$domain.crt" ]; then
/usr/local/vesta/bin/v-delete-web-domain-ssl "$user" "$domain"
fi
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
email="info@$domain"
TMPLOC="/home/$user/tmp/$domain"
@ -62,8 +68,13 @@ mkdir $TMPLOC
# Parsing certificate file
crt_end=$(grep -n "END CERTIFICATE-" $TMPLOC/vst.pem |cut -f 1 -d:)
key_start=$(grep -n "BEGIN RSA" $TMPLOC/vst.pem |cut -f 1 -d:)
key_end=$(grep -n "END RSA" $TMPLOC/vst.pem |cut -f 1 -d:)
if [ "$release" -lt 12 ]; then
key_start=$(grep -n "BEGIN RSA" $TMPLOC/vst.pem |cut -f 1 -d:)
key_end=$(grep -n "END RSA" $TMPLOC/vst.pem |cut -f 1 -d:)
else
key_start=$(grep -n "BEGIN PRIVATE KEY" $TMPLOC/vst.pem |cut -f 1 -d:)
key_end=$(grep -n "END PRIVATE KEY" $TMPLOC/vst.pem |cut -f 1 -d:)
fi
# Adding SSL certificate
cd $TMPLOC

View file

@ -0,0 +1,37 @@
#!/bin/bash
# info: Script for installing WordFence CLI
# options: NONE
if ! command -v git &> /dev/null; then
echo "= Git is not installed. Installing..."
apt-get update > /dev/null 2>&1
apt-get install -y git
fi
cd /root
if [ ! -d "myvesta-wordfence-cli" ]; then
git clone https://github.com/isscbta/myvesta-wordfence-cli.git
cd ~/myvesta-wordfence-cli/
else
cd ~/myvesta-wordfence-cli/
git pull
fi
echo ""
echo "----------------------------------------------------------------"
echo ""
echo "Which Docker container do you want to install for WordFence CLI?"
echo "1. WordFence CLI official Docker container"
echo "2. WordFence CLI Docker container maintained by myVesta"
read -r -p "Enter your choice: " choice < /dev/tty
if [ "$choice" == "1" ]; then
bash wf-cli-install.sh
fi
if [ "$choice" == "2" ]; then
bash wf-cli-install-our-image.sh
fi
exit 0;

View file

@ -1,6 +1,6 @@
#!/bin/bash
# info: WordPress installer in one command line
# options: DOMAIN USER
# options: DOMAIN [DB_NAME] [EMAIL]
#
# Credits to Luka Paunović for wp-cli implememtation
@ -14,20 +14,28 @@ if [ "$whoami" != "root" ]; then
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
# Importing system environment
source /etc/profile
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/db.sh
source /usr/local/vesta/conf/vesta.conf
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
if [[ $(is_package_full 'DATABASES') = *reached* ]]; then
echo "Database limit is reached. Delete database or upgrade user package."
exit
fi
#----------------------------------------------------------#
# Verifications #
@ -42,20 +50,33 @@ is_object_unsuspended 'user' 'USER' "$user"
source /usr/local/vesta/func/handle_parameters.sh
if [ -z "$database" ]; then
if [ ! -z "$MAX_DBUSER_LEN" ] && [ "$MAX_DBUSER_LEN" -ge 80 ]; then
database=$(echo "$domain" | sed 's#\.#_#g')
else
database="wp"
fi
fi
if [ -z "$emil" ]; then
email="info@$domain";
# Convert domain to IDN if available
if command -v idn2 >/dev/null 2>&1; then
database=$(idn2 "$database")
idn_domain=$(idn2 "$domain")
elif command -v idn >/dev/null 2>&1; then
database=$(idn "$database")
idn_domain=$(idn "$domain")
fi
if [ -z "$email" ]; then
email="info@$idn_domain";
fi
if [ ! -d "/home/$user" ]; then
echo "User doesn't exist";
echo "= Error: Folder /home/$user doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain doesn't exist";
echo "= Error: Folder /home/$user/web/$domain/public_html doesn't exist";
exit 1;
fi
@ -83,50 +104,73 @@ PASSWDDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
# Action #
#----------------------------------------------------------#
PROTOCOL='http'
if [ -z "$SKIP_LE" ]; then
if [ ! -f "/home/$user/conf/web/ssl.$domain.ca" ]; then
PROTOCOL='https'
if [ ! -f "/home/$user/conf/web/ssl.$domain.ca" ]; then
echo "== Trying to install LetsEncrypt for domain $domain"
/usr/local/vesta/bin/v-add-letsencrypt-domain "$user" "$domain" "www.$domain" "yes"
fi
else
PROTOCOL='https'
fi
if [ -f "/home/$user/conf/web/ssl.$domain.ca" ] || [ ! -z "$SKIP_LE" ]; then
PROTOCOL='https'
if [ -f "/usr/local/vesta/data/templates/web/nginx/force-https.stpl" ]; then
if [ ! -z "$FORCE_HTTP" ]; then
# Switch to http:// only if --FORCE_HTTP parameter is set
echo "== Force http://"
PROTOCOL='http'
fi
TPL_CHANGED=0;
if [ "$WEB_SYSTEM" != 'nginx' ]; then
if [ "$PROTOCOL" = "https" ]; then
if [ -f "/usr/local/vesta/data/templates/web/nginx/force-https-firewall-wordpress.stpl" ] && [ $TPL_CHANGED -eq 0 ]; then
TPL_CHANGED=1;
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "force-https-firewall-wordpress" "jpeg,jpg,png,gif,bmp,ico,svg,tif,tiff,css,js,ttf,otf,webp,txt,csv,rtf,doc,docx,xls,xlsx,ppt,pptx,odf,odp,ods,odt,pdf,psd,ai,eot,eps,ps,zip,tar,tgz,gz,rar,bz2,7z,aac,m4a,mp3,mp4,ogg,wav,wma,3gp,avi,flv,m4v,mkv,mov,mpeg,mpg,wmv,exe,iso,dmg,swf,woff,woff2" "yes"
fi
if [ -f "/usr/local/vesta/data/templates/web/nginx/force-https.stpl" ] && [ $TPL_CHANGED -eq 0 ]; then
TPL_CHANGED=1;
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "force-https" "jpeg,jpg,png,gif,bmp,ico,svg,tif,tiff,css,js,ttf,otf,webp,txt,csv,rtf,doc,docx,xls,xlsx,ppt,pptx,odf,odp,ods,odt,pdf,psd,ai,eot,eps,ps,zip,tar,tgz,gz,rar,bz2,7z,aac,m4a,mp3,mp4,ogg,wav,wma,3gp,avi,flv,m4v,mkv,mov,mpeg,mpg,wmv,exe,iso,dmg,swf,woff,woff2" "yes"
fi
fi
if [ "$PROTOCOL" = "http" ]; then
if [ -f "/usr/local/vesta/data/templates/web/nginx/hosting-firewall-wordpress.stpl" ] && [ $TPL_CHANGED -eq 0 ]; then
TPL_CHANGED=1;
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" "hosting-firewall-wordpress" "jpeg,jpg,png,gif,bmp,ico,svg,tif,tiff,css,js,ttf,otf,webp,txt,csv,rtf,doc,docx,xls,xlsx,ppt,pptx,odf,odp,ods,odt,pdf,psd,ai,eot,eps,ps,zip,tar,tgz,gz,rar,bz2,7z,aac,m4a,mp3,mp4,ogg,wav,wma,3gp,avi,flv,m4v,mkv,mov,mpeg,mpg,wmv,exe,iso,dmg,swf,woff,woff2" "yes"
fi
fi
fi
/usr/local/vesta/bin/v-add-database "$user" "$DBUSERSUF" "$DBUSERSUF" "$PASSWDDB" "mysql"
if [ ! -f "/usr/local/bin/wp" ]; then
echo "=== Downloading latest wp-cli"
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
fi
WORKINGDIR="/home/$user/web/$domain/public_html"
rm -rf $WORKINGDIR/*
cd $WORKINGDIR
sudo -H -u$user wp core download
sudo -H -u$user wp core config --dbname=$DBUSER --dbuser=$DBUSER --dbpass=$PASSWDDB
/usr/local/vesta/bin/v-run-wp-cli $domain core download
if [ ! -f "$WORKINGDIR/index.php" ]; then
echo "= WordPress installation failed: WordPress core download failed."
exit 1;
fi
/usr/local/vesta/bin/v-run-wp-cli $domain core config --dbname=$DBUSER --dbuser=$DBUSER --dbpass=$PASSWDDB
if [ ! -f "$WORKINGDIR/wp-config.php" ]; then
echo "= WordPress installation failed: WordPress core config failed, wp-config.php not found."
exit 1;
fi
password=$(LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 12)
sudo -H -u$user wp core install --url="$domain" --title="$domain" --admin_user="admin" --admin_password="$password" --admin_email="$email" --path=$WORKINGDIR
wpadmin=$(echo "$domain" | sed 's#\.#_#g')_4dm1n
/usr/local/vesta/bin/v-run-wp-cli $domain core install --url="$domain" --title="$domain" --admin_user="$wpadmin" --admin_password="$password" --admin_email="$email" --path=$WORKINGDIR
mysql -u$DBUSER -p$PASSWDDB -e "USE $DBUSER; update wp_options set option_value = '$PROTOCOL://$domain' where option_name = 'siteurl'; update wp_options set option_value = '$PROTOCOL://$domain' where option_name = 'home';"
echo "================================================================="
echo "Installation is complete. Your username/password is listed below."
echo "Your WordPress installation is complete."
echo ""
echo "Site: $PROTOCOL://$domain/"
echo "Website URL: $PROTOCOL://$domain/"
echo ""
echo "Login: $PROTOCOL://$domain/wp-admin/"
echo "Username: admin"
echo "WordPress admin login: $PROTOCOL://$domain/wp-admin/"
echo "Username: $wpadmin"
echo "Password: $password"
echo ""
echo "================================================================="

27
bin/v-install-wp-cli Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# info: Download WP CLI
# options: NONE
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
echo "= Installing WP CLI by downloading phar file..."
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
if [ -f "/usr/local/bin/wp" ]; then
echo "= WP CLI installed successfully."
echo "= Usage: v-run-wp-cli DOMAIN WP_CLI_COMMAND"
exit 0;
else
echo "= WP CLI installation failed."
echo "= Please install it manually."
exit 1;
fi

View file

@ -0,0 +1,79 @@
#!/bin/bash
# info: Download myVesta WP CLI
# options: NONE
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
if [ ! -f "/usr/local/bin/composer" ]; then
echo "= Composer is not installed. Installing..."
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
echo "= Composer installed successfully."
fi
if [ -d "/usr/local/bin/wp-cli" ]; then
echo "= Removing old myVesta WP CLI..."
rm -rf /usr/local/bin/wp-cli
fi
echo "= Installing myVesta WP CLI..."
cd /usr/local/bin
git clone https://github.com/wp-cli/wp-cli.git
chown -R www-data:www-data wp-cli
ver_ge() {
# usage: ver_ge 7.2 5.6 --> returns true if $1 is greater than or equal to $2
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}
current_php_version=$(readlink -f /usr/bin/php | grep -oP 'php\K[0-9]+\.[0-9]+')
php_versions=$(/usr/local/vesta/bin/v-list-php)
for php_version in $php_versions; do
if ver_ge "$php_version" "7.2"; then
oldest_allowed_php_version=$php_version
break
fi
done
echo "= Setting PHP version to $oldest_allowed_php_version"
update-alternatives --set php /usr/bin/php$oldest_allowed_php_version
cd wp-cli/
sudo -H -u www-data composer install
echo "= Installing search-replace-command package..."
sudo -H -u www-data WP_CLI_PACKAGES_DIR=/usr/local/bin/wp-cli/packages php /usr/local/bin/wp-cli/php/boot-fs.php package install wp-cli/search-replace-command
echo "= Setting PHP version to $current_php_version"
update-alternatives --set php /usr/bin/php$current_php_version
# Fix terminal columns issue for WP CLI
echo "= Fixing terminal columns issue for WP CLI..."
/usr/local/vesta/bin/v-sed '$columns = 80;' "if (file_exists('/usr/local/bin/wp-cli/COLUMNS')) \$columns=intval(file_get_contents('/usr/local/bin/wp-cli/COLUMNS')); else \$columns = 80;" '/usr/local/bin/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/Shell.php'
echo ""
if [ -f "/usr/local/bin/wp-cli/php/boot-fs.php" ]; then
echo "= myVesta WP CLI installed successfully."
echo "= Usage: v-run-wp-cli-myvesta DOMAIN WP_CLI_COMMAND"
exit 0;
else
echo "= myVesta WP CLI installation failed."
echo "= Please install it manually."
exit 1;
fi

76
bin/v-list-php Normal file
View file

@ -0,0 +1,76 @@
#!/bin/bash
# info: list of installed php versions
# options: [FORMAT]
#
# The function for obtaining the list of installed PHP versions.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
counter=$(echo "$phpversions" | wc -l)
i=1
echo '['
for phpversion in $phpversions; do
if [ "$i" -lt "$counter" ]; then
echo -e "\t\"$phpversion\","
else
echo -e "\t\"$phpversion\""
fi
(( ++i))
done
echo "]"
}
# shell list function
shell_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
# PLAIN list function
plain_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
# CSV list function
csv_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Obtaining the list of installed PHP-FPM versions
phpversions=$(find /etc/php/ -type d -name 'fpm' | sed "s|/etc/php/||" | sed "s|/fpm||" | sort)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list ;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

91
bin/v-list-php-apache Normal file
View file

@ -0,0 +1,91 @@
#!/bin/bash
# info: list of installed php versions that have Apache template.
# options: [FORMAT]
#
# The function obtains the list of installed PHP versions that have Apache template.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
counter=$(echo "$phpversions" | wc -l)
i=1
echo '['
for phpversion in $phpversions; do
if [ "$i" -lt "$counter" ]; then
echo -e "\t\"$phpversion\","
else
echo -e "\t\"$phpversion\""
fi
(( ++i))
done
echo "]"
}
# shell list function
shell_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
# PLAIN list function
plain_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
# CSV list function
csv_list() {
for phpversion in $phpversions; do
echo "$phpversion"
done
}
echo_phpversions_list() {
for element in "${phpversions_list[@]}"; do
echo "$element"
done
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Obtaining the list of installed PHP-FPM versions
fpmphpversions=$(/usr/local/vesta/bin/v-list-php)
for phpversion in $fpmphpversions; do
phpversiontpl=${phpversion//./}
tpl="/usr/local/vesta/data/templates/web/apache2/PHP-FPM-$phpversiontpl.tpl"
if [ -f "$tpl" ]; then
phpversions_list+=("$phpversion")
fi
done
phpversions=$(echo_phpversions_list)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list ;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

View file

@ -54,7 +54,8 @@ json_list() {
"SOFTACULOUS": "'$SOFTACULOUS'",
"MAX_DBUSER_LEN": "'$MAX_DBUSER_LEN'",
"MAIL_CERTIFICATE": "'$MAIL_CERTIFICATE'",
"VESTA_CERTIFICATE": "'$VESTA_CERTIFICATE'"
"VESTA_CERTIFICATE": "'$VESTA_CERTIFICATE'",
"DISABLE_IP_CHECK": "'$DISABLE_IP_CHECK'"
}
}'
}

View file

@ -18,6 +18,8 @@ source $VESTA/conf/vesta.conf
export PATH=$PATH:/sbin
debug=0
# JSON list function
json_list() {
IFS=$'\n'
@ -50,6 +52,9 @@ shell_list() {
echo "---- ----- --- --- ------"
while read str; do
eval $str
if [ "$STATE" = "stopped" ]; then
STATE='off'
fi
echo "$NAME $STATE $CPU $MEM $RTIME"
done < <(echo -e "$data" |grep NAME)
}
@ -77,8 +82,17 @@ csv_list() {
get_srv_state() {
srv=$1
name=${2-$1}
procfolder=$4
procfile=$5
state='running'
mem=0
cpu=0
rtime="0"
if [ $debug -eq 1 ]; then
echo "---------------------"
echo "$srv = $name"
fi
# Searching related pids
if [ -z $3 ]; then
pids=$(pidof $name |tr ' ' '|')
@ -88,10 +102,23 @@ get_srv_state() {
if [ -z "$pids" ] && [ "$name" != 'nginx' ]; then
pids=$(pgrep $name |tr '\n' '|')
fi
if [ "$name" = 'elasticsearch' ]; then
pids=$(ps -Af | grep 'elasticsearch' | grep -v 'grep' | awk '{print $2}' | tr '\n' '|')
fi
if [ "$name" = 'vesta-nginx' ]; then
pids=$(ps -Af | grep 'vesta/nginx' | grep -v 'grep' | awk '{print $2}' | tr '\n' '|')
fi
if [ "$name" = 'vesta-php' ]; then
pids=$(ps -Af | grep 'vesta/php' | grep -v 'grep' | awk '{print $2}' | tr '\n' '|')
fi
if [ $debug -eq 1 ]; then
echo "pids = $pids"
fi
# Checking pid
if [ ! -z "$pids" ]; then
if [ -n "$pids" ]; then
pid=$(echo "$pids" |cut -f 1 -d '|')
pids=${pids%|}
pids=$(egrep "$pids" $tmp_file)
# Calculating CPU usage
@ -103,7 +130,22 @@ get_srv_state() {
# Searching pid file
pid_file=''
if [ -e "/var/run/$srv.pid" ]; then
if [ ! -z "$procfolder" ]; then
if [ -f "/var/run/$procfolder/$srv.pid" ]; then
pid_file="/var/run/$procfolder/$srv.pid"
fi
fi
if [ -z "$pid_file" ] && [ ! -z "$procfolder" ] && [ ! -z "$procfile" ]; then
if [ -f "/var/run/$procfolder/$procfile.pid" ]; then
pid_file="/var/run/$procfolder/$procfile.pid"
fi
fi
if [ -z "$pid_file" ] && [ -z "$procfolder" ] && [ ! -z "$procfile" ]; then
if [ -f "/var/run/$procfile.pid" ]; then
pid_file="/var/run/$procfile.pid"
fi
fi
if [ -z "$pid_file" ] && [ -e "/var/run/$srv.pid" ]; then
pid_file="/var/run/$srv.pid"
fi
if [ -z "$pid_file" ] && [ -e "/var/run/$srv/$srv.pid" ]; then
@ -112,18 +154,31 @@ get_srv_state() {
if [ -z "$pid_file" ] && [ -e "/var/run/$name/$name.pid" ]; then
pid_file="/var/run/$name/$name.pid"
fi
if [ -z "$pid_file" ] && [ -f "/var/run/$name.pid" ]; then
pid_file="/var/run/$name.pid"
fi
if [ -z "$pid_file" ] && [ -e "/proc/$pid" ]; then
pid_file="/proc/$pid"
fi
if [ $debug -eq 1 ]; then
echo "$srv = $name = $pid_file"
fi
# Calculating uptime
if [ ! -z "$pid_file" ]; then
if [ -n "$pid_file" ]; then
mtime=$(stat -c "%Y" $pid_file)
rtime=$((ctime - mtime))
rtime=$((rtime / 60))
else
rtime=0
fi
if [ "$pid_file" = "/proc/$pid" ]; then
if [ $debug -eq 1 ]; then
echo "getting pid lifetime via ps"
fi
rtime=$(ps -p $pid -o etimes | tail -n 1 | awk '{print $1}')
rtime=$((rtime / 60))
fi
else
state='stopped'
mem=0
@ -151,14 +206,6 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'remote' ]; then
data="$data MEM='$mem' RTIME='$rtime'"
fi
# Checking WEB Backend
if [ ! -z "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
proc_name=$(ls /usr/sbin/php*fpm* | rev | cut -d'/' -f 1 | rev)
get_srv_state $proc_name
data="$data\nNAME='$WEB_BACKEND' SYSTEM='backend server' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking WEB Proxy
if [ ! -z "$PROXY_SYSTEM" ] && [ "$PROXY_SYSTEM" != 'remote' ]; then
get_srv_state $PROXY_SYSTEM
@ -166,6 +213,18 @@ if [ ! -z "$PROXY_SYSTEM" ] && [ "$PROXY_SYSTEM" != 'remote' ]; then
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking WEB Backend
if [ "$WEB_BACKEND" != 'remote' ]; then
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
for version in $php_versions; do
proc_name="php-fpm${version}"
service_name="php${version}-fpm"
get_srv_state "$service_name" "$proc_name" '' 'php'
data="$data\nNAME='$service_name' SYSTEM='backend server' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
done
fi
# DNS
service=$DNS_SYSTEM
if [ ! -z "$service" ] && [ "$service" != 'remote' ]; then
@ -177,14 +236,22 @@ fi
# Checking MAIL system
if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'remote' ]; then
if [ "$MAIL_SYSTEM" = "exim4" ]; then
get_srv_state "$MAIL_SYSTEM" "$MAIL_SYSTEM" '' 'exim4' 'exim'
else
get_srv_state $MAIL_SYSTEM
fi
data="$data\nNAME='$MAIL_SYSTEM' SYSTEM='mail server' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking MAIL IMAP
if [ ! -z "$IMAP_SYSTEM" ] && [ "$IMAP_SYSTEM" != 'remote' ]; then
if [ "$IMAP_SYSTEM" = "dovecot" ]; then
get_srv_state "$IMAP_SYSTEM" "$IMAP_SYSTEM" '' 'dovecot' 'master'
else
get_srv_state $IMAP_SYSTEM
fi
data="$data\nNAME='$IMAP_SYSTEM' SYSTEM='pop/imap server' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
@ -200,11 +267,19 @@ if [ ! -z "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
if [ "$ANTIVIRUS_SYSTEM" == 'clamav-daemon' ];then
proc_name='clamd'
fi
get_srv_state $ANTIVIRUS_SYSTEM $proc_name
get_srv_state $ANTIVIRUS_SYSTEM $proc_name '' 'clamav' 'clamd'
fi
data="$data\nNAME='$ANTIVIRUS_SYSTEM' SYSTEM='email antivirus'"
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
proc_name=''
if [ ! -d "/etc/sysconfig" ]; then
if [ "$ANTIVIRUS_SYSTEM" == 'clamav-daemon' ];then
get_srv_state "clamav-freshclam" "freshclam"
data="$data\nNAME='clamav-freshclam' SYSTEM='email antivirus updater'"
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
proc_name=''
fi
fi
fi
# Checking MAIL ANTISPAM
@ -220,8 +295,13 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
proc_name=''
service="$db"
if [ "$service" = 'mysql' ]; then
proc_name='mysqld'
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -eq 11 ]; then
if [ "$release" -gt 10 ] && [ ! -f "/etc/apt/sources.list.d/mysql.list" ]; then
service='mariadb'
proc_name='mariadbd'
fi
if [ -f "/etc/apt/sources.list.d/mariadb.list" ]; then
service='mariadb'
proc_name='mariadbd'
fi
@ -243,7 +323,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
proc_name='postgres'
fi
fi
get_srv_state $service $proc_name
get_srv_state $service $proc_name '' 'mysqld' 'mysqld'
data="$data\nNAME='$service' SYSTEM='database server' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
proc_name=''
@ -259,11 +339,28 @@ fi
# Checking CRON system
if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'remote' ]; then
get_srv_state $CRON_SYSTEM
get_srv_state "$CRON_SYSTEM" "$CRON_SYSTEM" '' '' 'crond'
data="$data\nNAME='$CRON_SYSTEM' SYSTEM='job scheduler' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking SSH daemon
if [ -e "/etc/ssh/sshd_config" ]; then
get_srv_state 'ssh' 'ssh' '' '' 'sshd'
data="$data\nNAME='ssh' SYSTEM='SSH Access' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking Vesta nginx
get_srv_state 'vesta' 'vesta-nginx' '' '' 'vesta-nginx'
data="$data\nNAME='vesta-nginx' SYSTEM='Vesta nginx service' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
# Checking Vesta php-fpm
get_srv_state 'vesta' 'vesta-php' '' '' 'vesta-php'
data="$data\nNAME='vesta-php' SYSTEM='Vesta php service' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
# Checking FIREWALL system
if [ ! -z "$FIREWALL_SYSTEM" ] && [ "$FIREWALL_SYSTEM" != 'remote' ]; then
state="stopped"
@ -277,11 +374,33 @@ fi
# Checking FIREWALL Fail2ban extention
if [ ! -z "$FIREWALL_EXTENSION" ]; then
get_srv_state $FIREWALL_EXTENSION fail2ban-server script
get_srv_state "$FIREWALL_EXTENSION" 'fail2ban-server' 'script'
data="$data\nNAME='$FIREWALL_EXTENSION' SYSTEM='brute-force monitor'"
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking ElasticSearch
if [ -d "/etc/elasticsearch" ]; then
get_srv_state 'elasticsearch'
data="$data\nNAME='elasticsearch' SYSTEM='ElasticSearch' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking Redis
if [ -d "/etc/redis" ]; then
get_srv_state 'redis' 'redis-server' '' 'redis' 'redis-server'
data="$data\nNAME='redis' SYSTEM='Redis' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Checking Memcached
if [ -f "/etc/memcached.conf" ]; then
get_srv_state 'memcached'
data="$data\nNAME='memcached' SYSTEM='Memcached' STATE='$state'"
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
fi
# Listing data
case $format in
json) json_list ;;

View file

@ -12,6 +12,7 @@
# Argument definition
user=$1
format=${2-shell}
limit=${3-300}
# Includes
source $VESTA/func/main.sh
@ -34,6 +35,9 @@ json_list() {
"TIME": "'$TIME'",
"DATE": "'$DATE'"
}'
if [ "$limit" -gt 0 ] && [ "$i" = "$limit" ]; then
break;
fi
if [ "$i" -lt "$objects" ]; then
echo ','
else
@ -83,7 +87,7 @@ csv_list() {
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [FORMAT]'
check_args '1' "$#" 'USER [FORMAT] [LIMIT]'
is_format_valid 'user'
is_object_valid 'user' 'USER' "$user"
@ -93,7 +97,7 @@ is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Parsing history log
logs=$(tail -n 300 $USER_DATA/history.log 2>/dev/null)
logs=$(tail -n $limit $USER_DATA/history.log | tac)
case $format in
json) json_list ;;

93
bin/v-lock-wordpress Normal file
View file

@ -0,0 +1,93 @@
#!/bin/bash
# info: Lock WordPress files if they are potentially infected (somewhere) by PHP malware, in order to stop further infection
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
unlock_folder() {
chown -R $user:$user $1/
# block .php execution inside folder
cat <<EOF >$1/.htaccess
RewriteEngine on
RewriteRule ^.*\.(?:php[1-6]?|pht|phtml?)$ - [NC,F]
EOF
chown root:root $1/.htaccess
}
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd /home/$user/web/$domain
# lock files
chown -R www-data:www-data public_html/
# set correct chmod just in case
find public_html/ -type d -exec chmod 755 {} +
find public_html/ -type f -exec chmod 644 {} +
# unlock /wp-content/uploads/ for uploading
if [ -d "/home/$user/web/$domain/public_html/wp-content/uploads" ]; then
unlock_folder "public_html/wp-content/uploads"
fi
# unlock /wp-content/cache/ for caching
if [ -d "/home/$user/web/$domain/public_html/wp-content/cache" ]; then
unlock_folder "public_html/wp-content/cache"
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "v-lock-wordpress: Done."
log_event "$OK" "$ARGUMENTS"
exit

31
bin/v-log-failed-login Normal file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# info: log failed login attempt
# options: USER [IP]
#
# The function log failed login attempt
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
ip=${2-127.0.0.1}
time_n_date=$(date +'%T %F')
time=$(echo "$time_n_date" |cut -f 1 -d \ )
date=$(echo "$time_n_date" |cut -f 2 -d \ )
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit 0

View file

@ -0,0 +1,14 @@
#!/bin/bash
touch /var/log/apache2/time.log
# truncate -s 0 /var/log/apache2/time.log
chmod 0640 /var/log/apache2/time.log
chown root:adm /var/log/apache2/time.log
find /home/*/conf/web/ -type f \( -name "apache2.conf" -or -name "sapache2.conf" -or -name "*.apache2.conf" -or -name "*.apache2.ssl.conf" \) -exec grep -L "time\.log" {} \; | xargs sed -i 's|ServerName |CustomLog /var/log/apache2/time.log time\n ServerName |g'
find /usr/local/vesta/data/templates/web/apache2 -type f \( -name "*.tpl" -or -name "*.stpl" \) -exec grep -L "time\.log" {} \; | xargs sed -i 's|ServerName |CustomLog /var/log/apache2/time.log time\n ServerName |g'
if ! /usr/local/vesta/bin/v-grep 'LogFormat "%t %v %a %D %r %>s \"%{User-Agent}i\"" time' '/etc/apache2/apache2.conf' '-q'; then
sed -i 's|LogFormat "%b" bytes|LogFormat "%b" bytes\nLogFormat "%t %v %a %D %r %>s \\\"%{User-Agent}i\\\" pid=%P" time|g' /etc/apache2/apache2.conf
fi
systemctl restart apache2
wget -nv http://dl.myvestacp.com/vesta/apache_requests_analyzer/analyze-traffic.php -O /root/analyze-traffic.php

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
# info: add new ip and makes email to be sent via that IP only for SMTP authenticated users
# options: MAIL_HOSTNAME MAIL_IP
@ -40,7 +40,7 @@ fi
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'MAIL_HOSTNAME MAIL_IP'
check_args '2' "$#" 'MAIL_HOSTNAME MAIL_IP [NETMASK] [INTERFACE]'
is_domain_format_valid "$MAIL_HOSTNAME"
is_ip_format_valid "$MAIL_IP"
@ -137,18 +137,55 @@ $VESTA/bin/v-make-ip-ssl "$MAIL_USER" "$MAIL_HOSTNAME"
check_grep=$(grep -c 'smtp_active_hostname' /etc/exim4/exim4.conf.template)
if [ "$check_grep" -eq 0 ]; then
echo "=== patching exim4.conf.template"
patch /etc/exim4/exim4.conf.template < /usr/local/vesta/src/deb/for-download/tools/patches/separate-mail-ip.patch
if [ $? -ne 0 ]; then
echo "=== Patching failed, aborting"
exit 1
else
echo "=== Patching successful"
sed -i "s|IP1|$HOST_IP|g" /etc/exim4/exim4.conf.template
sed -i "s|IP2|$MAIL_IP|g" /etc/exim4/exim4.conf.template
sed -i "s|HOST1|$HOSTNAME|g" /etc/exim4/exim4.conf.template
sed -i "s|HOST2|$MAIL_HOSTNAME|g" /etc/exim4/exim4.conf.template
service exim4 restart
mv /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template-backup
cp /usr/local/vesta/install/debian/12/exim/exim4.conf.template /etc/exim4/exim4.conf.template
eximversion=$(exim4 --version | grep '^Exim version ' | awk '{print $3}')
if (( $(echo "$eximversion < 4.96" | bc -l) )); then
cp /usr/local/vesta/install/debian/12/exim/exim4.conf.template.without-srs /etc/exim4/exim4.conf.template
sed -i "s|message_linelength_limit|#message_linelength_limit|g" /etc/exim4/exim4.conf.template
fi
if (( $(echo "$eximversion < 4.94" | bc -l) )); then
sed -i "s|smtputf8_advertise_hosts|#smtputf8_advertise_hosts|g" /etc/exim4/exim4.conf.template
fi
sed -i "s|FIRSTIP|$HOST_IP|g" /etc/exim4/exim4.conf.template
sed -i "s|SECONDIP|$MAIL_IP|g" /etc/exim4/exim4.conf.template
sed -i "s|FIRSTHOST|$HOSTNAME|g" /etc/exim4/exim4.conf.template
sed -i "s|SECONDHOST|$MAIL_HOSTNAME|g" /etc/exim4/exim4.conf.template
sed -i "s|#local_interfaces|local_interfaces|g" /etc/exim4/exim4.conf.template
sed -i "s|#smtp_active_hostname|smtp_active_hostname|g" /etc/exim4/exim4.conf.template
sed -i "s|#smtp_banner|smtp_banner|g" /etc/exim4/exim4.conf.template
sed -i "s|#interface =|interface =|g" /etc/exim4/exim4.conf.template
sed -i "s|#helo_data =|helo_data =|g" /etc/exim4/exim4.conf.template
/usr/local/vesta/bin/v-sed 'tls_certificate = /usr/local/vesta/ssl/certificate.crt' 'tls_certificate = /usr/local/vesta/ssl/$received_ip_address.crt' '/etc/exim4/exim4.conf.template'
/usr/local/vesta/bin/v-sed 'tls_privatekey = /usr/local/vesta/ssl/certificate.key' 'tls_privatekey = /usr/local/vesta/ssl/$received_ip_address.key' '/etc/exim4/exim4.conf.template'
touch /etc/exim4/limit_per_email_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_email_account_max_recipients
touch /etc/exim4/limit_per_hosting_account_max_sent_emails_per_hour
touch /etc/exim4/limit_per_hosting_account_max_recipients
check_grep=$(grep -c '#SPAMASSASSIN' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#SPAMASSASSIN|SPAMASSASSIN|g" /etc/exim4/exim4.conf.template
fi
check_grep=$(grep -c '#SPAM_SCORE' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#SPAM_SCORE|SPAM_SCORE|g" /etc/exim4/exim4.conf.template
fi
check_grep=$(grep -c '#CLAMD' /etc/exim4/exim4.conf.template-backup)
if [ "$check_grep" -eq 0 ]; then
sed -i "s|#CLAMD|CLAMD|g" /etc/exim4/exim4.conf.template
fi
systemctl restart exim4
if [ $? -ne 0 ]; then
systemctl status exim4
cp /etc/exim4/exim4.conf.template-backup /etc/exim4/exim4.conf.template
systemctl restart exim4
echo "=== Patching failed, old exim conf returned, exim4 restarted again."
exit 1
fi
echo "=== Patching successful"
else
echo "=== exim4.conf.template already patched"
fi

View file

@ -40,6 +40,7 @@ is_format_valid 'domain' 'user'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
FROM_DATABASE_NAME=''
FROM_DATABASE_USERNAME=''
FROM_DATABASE_PASSWORD=''
@ -94,6 +95,8 @@ if [ "$DB_EXISTS" = "no" ]; then
exit 6
fi
phpver=$(/usr/local/vesta/bin/v-get-php-version-of-domain "$FROM_DOMAIN")
# ----------- CHECK -------------
FROM_REPLACE1="http://$FROM_DOMAIN"
@ -102,19 +105,13 @@ FROM_REPLACE2="http://www.$FROM_DOMAIN"
TO_REPLACE2="https://www.$FROM_DOMAIN"
if [ $IT_IS_WP -eq 0 ]; then
if [ ! -f "/root/Search-Replace-DB-master/srdb.cli.php" ]; then
echo "Please download https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ and extract to /root/Search-Replace-DB-master/"
exit 7
if [ ! -f "/root/Search-Replace-DB/srdb.cli.php" ]; then
if [ ! -f "/usr/bin/git" ]; then
apt-get update > /dev/null 2>&1
apt-get -y install git > /dev/null 2>&1
fi
if [ ! -f "/usr/bin/php7.0" ]; then
echo "Please download https://c.myvestacp.com/tools/multi-php-install.sh and install php 7.0"
exit 8
fi
else
if [ ! -f "/usr/local/bin/wp" ]; then
echo "=== Downloading latest wp-cli"
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
cd /root
git clone https://github.com/interconnectit/Search-Replace-DB.git
fi
fi
@ -164,15 +161,15 @@ grep -rl "$FROM_DOMAIN" $SITE_FOLDER | xargs sed -i "s#$FROM_REPLACE2#$TO_REPLAC
if [ $IT_IS_WP -eq 0 ]; then
echo "=== Replacing $FROM_REPLACE1 to $TO_REPLACE1 in database $FROM_DATABASE_NAME"
php7.0 /root/Search-Replace-DB-master/srdb.cli.php -h localhost -n "$FROM_DATABASE_NAME" -u "$FROM_DATABASE_USERNAME" -p "$FROM_DATABASE_PASSWORD" -s "$FROM_REPLACE1" -r "$TO_REPLACE1"
php /root/Search-Replace-DB/srdb.cli.php -h localhost -n "$FROM_DATABASE_NAME" -u "$FROM_DATABASE_USERNAME" -p "$FROM_DATABASE_PASSWORD" -s "$FROM_REPLACE1" -r "$TO_REPLACE1"
echo "=== Replacing $FROM_REPLACE2 to $TO_REPLACE2 in database $FROM_DATABASE_NAME"
php7.0 /root/Search-Replace-DB-master/srdb.cli.php -h localhost -n "$FROM_DATABASE_NAME" -u "$FROM_DATABASE_USERNAME" -p "$FROM_DATABASE_PASSWORD" -s "$FROM_REPLACE2" -r "$TO_REPLACE2"
php /root/Search-Replace-DB/srdb.cli.php -h localhost -n "$FROM_DATABASE_NAME" -u "$FROM_DATABASE_USERNAME" -p "$FROM_DATABASE_PASSWORD" -s "$FROM_REPLACE2" -r "$TO_REPLACE2"
else
cd $SITE_FOLDER
echo "=== Replacing $FROM_REPLACE1 to $TO_REPLACE1 in database $FROM_DATABASE_NAME"
sudo -H -u$FROM_USER wp search-replace "$FROM_REPLACE1" "$TO_REPLACE1" --precise --all-tables --skip-columns=guid
/usr/local/vesta/bin/v-run-wp-cli $FROM_DOMAIN search-replace "$FROM_REPLACE1" "$TO_REPLACE1" --precise --all-tables --skip-columns=guid --skip-plugins --skip-themes;
echo "=== Replacing $FROM_REPLACE2 to $TO_REPLACE2 in database $FROM_DATABASE_NAME"
sudo -H -u$FROM_USER wp search-replace "$FROM_REPLACE2" "$TO_REPLACE2" --precise --all-tables --skip-columns=guid
/usr/local/vesta/bin/v-run-wp-cli $FROM_DOMAIN search-replace "$FROM_REPLACE2" "$TO_REPLACE2" --precise --all-tables --skip-columns=guid --skip-plugins --skip-themes;
fi
echo "===== DONE ===="

View file

@ -40,6 +40,10 @@ if [ "$owner" = "$user" ]; then
exit
fi
USER_DATA=$VESTA/data/users/$owner
is_object_unsuspended 'user' 'USER' "$owner"
USER_DATA=$VESTA/data/users/$user
USER_TO=$user
#----------------------------------------------------------#
@ -84,6 +88,56 @@ if [ $? -ne 0 ]; then
RET=$E_NOTEXIST
fi
#----------------------------------------------------------#
# Update Wordfence WAF Path #
#----------------------------------------------------------#
filepath="/home/USER_TO/web/$domain/public_html/.user.ini"
filename=$(basename $filepath)
# Check if file exists
if [ -f "$filepath" ]; then
echo "Updating $filename with new user path..."
# Temporary file for modification
tmp_file=$(mktemp)
# Change path from old USER to new USER_TO
sed "s|/home/$owner/public_html|/home/$USER_TO/public_html|g" "$filepath" > "$tmp_file"
# Check if replacement was successful and update file
if [ $? -eq 0 ]; then
mv "$tmp_file" "$filepath"
echo "$filename updated successfully."
else
echo "Failed to update $filename file."
rm "$tmp_file" # Deletes temporary file
fi
fi
filepath="/home/USER_TO/web/$domain/public_html/wordfence-waf.php"
filename=$(basename $filepath)
# Check if file exists
if [ -f "$filepath" ]; then
echo "Updating $filename with new user path..."
# Temporary file for modification
tmp_file=$(mktemp)
# Change path from old USER to new USER_TO
sed "s|/home/$owner/public_html|/home/$USER_TO/public_html|g" "$filepath" > "$tmp_file"
# Check if replacement was successful and update file
if [ $? -eq 0 ]; then
mv "$tmp_file" "$filepath"
echo "$filename updated successfully."
else
echo "Failed to update $filename file."
rm "$tmp_file" # Deletes temporary file
fi
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#

View file

@ -0,0 +1,114 @@
#!/bin/bash
# info:
# This script will move a folder to the new destination and make a symlink from the old path to the new destination
# options: FROMFOLDER TOFOLDER
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
echo "You must be root or admin to execute this script";
exit 1;
fi
# Argument definition
FROMFOLDER=$1
TOFOLDER=$2
echo "Executing: v-move-folder-and-make-symlink $1 $2"
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
if [ -z "$FROMFOLDER" ]; then
echo "First parameter is empty, aborting"
exit 1
fi
if [ -z "$TOFOLDER" ]; then
echo "Second parameter is empty, aborting"
exit 1
fi
# Trimming the ending slash, just in case
FROMFOLDER=$(echo "$FROMFOLDER" | sed 's:/*$::')
TOFOLDER=$(echo "$TOFOLDER" | sed 's:/*$::')
if [ ! -d "$FROMFOLDER" ]; then
echo "Folder $FROMFOLDER does not exists, aborting"
exit 1
fi
if [ -L "$FROMFOLDER" ]; then
echo "Folder $FROMFOLDER is already symlink, aborting"
exit 1
fi
if [ -d "$TOFOLDER" ]; then
echo "Folder $TOFOLDER already exists, aborting"
exit 1
fi
if [ -L "$TOFOLDER" ]; then
echo "Folder $TOFOLDER already exists (as symlink), aborting"
exit 1
fi
USER=$(stat -c '%U' "$FROMFOLDER")
GROUP=$(stat -c '%G' "$FROMFOLDER")
PARENTFOLDER=$(dirname "$TOFOLDER")
if [ ! -d "$PARENTFOLDER" ]; then
PUSER=$(stat -c '%U' "$PARENTFOLDER")
PGROUP=$(stat -c '%G' "$PARENTFOLDER")
echo "= Creating parent folder..."
mkdir -p "$PARENTFOLDER"
chown $PUSER:$PGROUP "$PARENTFOLDER"
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$FROMFOLDER" = "/home/$USER" ] && [ -d "$FROMFOLDER/conf" ]; then
# if we are moving myVesta home folder, we must remove immutable attribute from conf/ files
chattr -R -i "$FROMFOLDER/conf/" > /dev/null 2>&1
# with slashes on the end of the path of the folder
fi
# rsync -a "$FROMFOLDER/" "$TOFOLDER/"
# with slashes on the end of the path of both folders
mv "$FROMFOLDER" "$TOFOLDER"
if [ "$?" -ne 0 ]; then
echo "Error happened, aborting"
exit 1
fi
rm -rf "$FROMFOLDER"
# without slash on the end of the path of the folder
ln -s "$TOFOLDER" "$FROMFOLDER"
# without slashes on the end of the path of both folders
chown -h $USER:$GROUP $FROMFOLDER
# without slash on the end of the path of the folder
#----------------------------------------------------------#
# Log and print result #
#----------------------------------------------------------#
echo "Done, folder $FROMFOLDER moved to $TOFOLDER and symlinked"
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -45,7 +45,7 @@ NEWNS2=${arrNS[1]}
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
if [ -f "/usr/local/vesta/data/users/$user/dns/$domain.conf" ]; then
NEWIPV4=$(v-list-dns-domain "$user" "$domain" | grep 'IP:' | awk '{print $2}')
NEWIPV4=$(/usr/local/vesta/bin/v-list-dns-domain "$user" "$domain" | grep 'IP:' | awk '{print $2}')
res=$(grep "'www'" /usr/local/vesta/data/users/$user/dns/$domain.conf)
eval $res
OLDIPV4=$VALUE
@ -79,7 +79,7 @@ sed -i "s#$OLDIPV4#$NEWIPV4#g" /usr/local/vesta/data/users/$user/dns.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/$user/dns.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/$user/user.conf
sed -i "s#$OLDNS2#$NEWNS2#g" /usr/local/vesta/data/users/$user/user.conf
service bind9 reload
systemctl reload bind9
echo "Done!"

21
bin/v-php-func Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# info: calling myVesta PHP functions
# options: FUNCTION
#
# The function is calling myVesta or standard PHP functions directly from bash
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$1" == "--stdin" ] && [ -p /dev/stdin ]; then
STDIN=$(cat -)
if [ ! -z "$STDIN" ]; then
echo "$STDIN" | php /usr/local/vesta/func/bash-to-php-interpreter.php "$@"
exit $?
fi
fi
php /usr/local/vesta/func/bash-to-php-interpreter.php "$@"
exit $?

View file

@ -55,9 +55,10 @@ if [ -z "$DNS_SYSTEM" ] || [ "$DNS_SYSTEM" = 'remote' ] ; then
fi
# Restart system
service $DNS_SYSTEM reload >/dev/null 2>&1
systemctl reset-failed $DNS_SYSTEM
systemctl reload $DNS_SYSTEM >/dev/null 2>&1
if [ $? -ne 0 ]; then
service $DNS_SYSTEM restart >/dev/null 2>&1
systemctl restart $DNS_SYSTEM >/dev/null 2>&1
if [ $? -ne 0 ]; then
send_email_report
check_result $E_RESTART "$DNS_SYSTEM restart failed"

View file

@ -64,7 +64,9 @@ fi
# Resart web system if reload didn't work
if [ "$rc" -ne 0 ]; then
service $WEB_SYSTEM restart >/dev/null 2>&1
# service $WEB_SYSTEM restart >/dev/null 2>&1
systemctl reset-failed $WEB_SYSTEM
systemctl restart $WEB_SYSTEM >/dev/null 2>&1
if [ $? -ne 0 ]; then
send_email_report
check_result $E_RESTART "$WEB_SYSTEM restart failed"

View file

@ -417,6 +417,7 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
# Restoring web domain data
chown $user $tmpdir
chmod u+w $HOMEDIR/$user/web/$domain
chmod 0755 $tmpdir/web/$domain
sudo -u $user tar -xzpf $tmpdir/web/$domain/domain_data.tar.gz \
-C $HOMEDIR/$user/web/$domain/ --exclude=./logs/* \
2> $HOMEDIR/$user/web/$domain/restore_errors.log
@ -476,7 +477,7 @@ if [ "$dns" != 'no' ] && [ ! -z "$DNS_SYSTEM" ]; then
if [ -z "$dns" ] || [ "$dns" = '*' ]; then
domains="$backup_domains"
else
echo "$dns" |tr ',' '\n' > $tmpdir/selected.txt
echo "$dns" | tr ',' '\n' | sed -e "s/^/^/" > $tmpdir/selected.txt
domains=$(echo "$backup_domains" |egrep -f $tmpdir/selected.txt)
fi
@ -556,7 +557,7 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
if [ -z "$mail" ] || [ "$mail" = '*' ]; then
domains="$backup_domains"
else
echo "$mail" |tr ',' '\n' > $tmpdir/selected.txt
echo "$mail" | tr ',' '\n' | sed -e "s/^/^/" > $tmpdir/selected.txt
domains=$(echo "$backup_domains" |egrep -f $tmpdir/selected.txt)
fi
@ -618,6 +619,7 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
if [ -e "$tmpdir/mail/$domain/accounts.tar.gz" ]; then
chown $user $tmpdir
chmod u+w $HOMEDIR/$user/mail/$domain_idn
chmod 0755 $tmpdir/mail/$domain
sudo -u $user tar -xzpf $tmpdir/mail/$domain/accounts.tar.gz \
-C $HOMEDIR/$user/mail/$domain_idn/
if [ "$?" -ne 0 ]; then
@ -653,7 +655,7 @@ if [ "$db" != 'no' ] && [ ! -z "$DB_SYSTEM" ]; then
if [ -z "$db" ] || [ "$db" = '*' ]; then
databases="$backup_databases"
else
echo "$db" |tr ',' '\n' > $tmpdir/selected.txt
echo "$db" |tr ',' '\n' | sed -e "s/$/$/" > $tmpdir/selected.txt
databases=$(echo "$backup_databases" |egrep -f $tmpdir/selected.txt)
fi

146
bin/v-run-wp-cli Normal file
View file

@ -0,0 +1,146 @@
#!/bin/bash
# info: Run WP CLI command for a specific domain
# options: DOMAIN WP_CLI_COMMAND
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
SILENT_MODE=1
# Argument definition
domain=$1
wp_command=${@:2}
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
source /usr/local/vesta/func/domain.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
VERBOSE_MODE=1
check_args '2' "$#" 'DOMAIN WP_CLI_COMMAND'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
if [ ! -d "/home/$user" ]; then
echo "= User doesn't exist";
exit 1;
fi
if [[ "$wp_command" != core\ download* ]] && [[ "$wp_command" != core\ config* ]] && [ ! -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
echo '= Please install WordPress first.'
exit 1;
fi
wpcli=""
if [ ! -f "/usr/local/bin/wp" ]; then
echo "= WP CLI is not installed. Installing..."
/usr/local/vesta/bin/v-install-wp-cli
fi
if [ -z "$USE_WP_CLI_MYVESTA" ]; then
if [ -f "/usr/local/bin/wp" ]; then
# Get current time and file ctime in seconds since epoch
current_time=$(date +%s)
file_ctime=$(stat -c %Z /usr/local/bin/wp)
# Calculate age in days
age_days=$(( (current_time - file_ctime) / 86400 ))
if [ "$age_days" -gt 30 ]; then
echo "= The /usr/local/bin/wp file is older than 30 days (based on CTime)."
echo "= Updating WP CLI..."
/usr/local/vesta/bin/v-install-wp-cli
fi
fi
fi
if [ -t 1 ]; then
output='terminal'
else
output='file'
fi
if [ -f "/usr/local/bin/wp" ]; then
wpcli="/usr/local/bin/wp"
WP_CLI_PACKAGES_DIR=""
fi
if [ ! -z "$USE_WP_CLI_MYVESTA" ] && [ -f "/usr/local/bin/wp-cli/php/boot-fs.php" ] && [ -d "/usr/local/bin/wp-cli/packages/vendor/wp-cli/search-replace-command" ] && [ "$output" == "terminal" ]; then
wpcli="/usr/local/bin/wp-cli/php/boot-fs.php"
COLUMNS=$(/usr/bin/env stty size 2>/dev/null | awk '{print $2}')
echo $COLUMNS > /usr/local/bin/wp-cli/COLUMNS
WP_CLI_PACKAGES_DIR="WP_CLI_PACKAGES_DIR=/usr/local/bin/wp-cli/packages"
fi
if [ -z "$wpcli" ]; then
echo "= WP CLI is not installed. Please install it manually."
exit 1;
fi
mkdir -p /home/$user/.wp-cli
chown $user:$user /home/$user/.wp-cli
if [ -z "$PHP" ]; then
phpver=$(/usr/local/vesta/bin/v-get-php-version-of-domain "$domain")
else
phpver=$PHP
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd /home/$USER/web/$domain/public_html
if [ -z "$OPEN_BASEDIR" ]; then
OPEN_BASEDIR="/home/$user/web/$domain:/home/$user/.wp-cli:/home/$user/tmp:/usr/local/bin:/tmp"
fi
if [ -z "$DISABLE_FUNCTIONS" ]; then
DISABLE_FUNCTIONS="pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,exec,system,passthru,shell_exec,proc_open,popen"
fi
if [ -z "$SHOW_ERRORS" ]; then
sudo -u $USER $WP_CLI_PACKAGES_DIR /usr/bin/php$phpver -d disable_functions=$DISABLE_FUNCTIONS -d open_basedir=$OPEN_BASEDIR $wpcli --path=/home/$user/web/$domain/public_html/ $wp_command 2>/home/$user/web/$domain/wp-cli-error.log
else
sudo -u $USER $WP_CLI_PACKAGES_DIR /usr/bin/php$phpver -d disable_functions=$DISABLE_FUNCTIONS -d open_basedir=$OPEN_BASEDIR $wpcli --path=/home/$user/web/$domain/public_html/ $wp_command
fi
return_code=$?
if [ -f "/usr/local/bin/wp-cli/COLUMNS" ]; then
rm /usr/local/bin/wp-cli/COLUMNS
fi
if [ -z "$SHOW_ERRORS" ]; then
if grep -q "PHP Fatal error" /home/$user/web/$domain/wp-cli-error.log || [ $return_code -ne 0 ]; then
cat /home/$user/web/$domain/wp-cli-error.log
fi
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit $return_code;

21
bin/v-run-wp-cli-myvesta Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [ ! -f "/usr/local/bin/wp-cli/php/boot-fs.php" ]; then
echo "= myVesta WP CLI is not installed. Installing..."
/usr/local/vesta/bin/v-install-wp-cli-myvesta
fi
if [ -f "/usr/local/bin/wp-cli/php/boot-fs.php" ]; then
# Get current time and file ctime in seconds since epoch
current_time=$(date +%s)
file_ctime=$(stat -c %Z /usr/local/bin/wp-cli/php/boot-fs.php)
# Calculate age in days
age_days=$(( (current_time - file_ctime) / 86400 ))
if [ "$age_days" -gt 30 ]; then
echo "= The /usr/local/bin/wp-cli/php/boot-fs.php file is older than 30 days (based on CTime)."
echo "= Updating myVesta WP CLI..."
/usr/local/vesta/bin/v-install-wp-cli-myvesta
fi
fi
USE_WP_CLI_MYVESTA=1 /usr/local/vesta/bin/v-run-wp-cli "$@"

View file

@ -9,6 +9,8 @@
# Variable&Function #
#----------------------------------------------------------#
SILENT_MODE=1
# Argument definition
domain=$(idn -t --quiet -u "$1" )
type=${2-any}

27
bin/v-sed Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# info: calling myvesta_sed PHP function
# options: PARAMETERS
#
# The function is calling myVesta PHP replacement for GNU 'sed' command (but without regular expression)
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$1" == "--stdin" ] && [ -p /dev/stdin ]; then
STDIN=$(cat -)
if [ ! -z "$STDIN" ]; then
shift;
echo "$STDIN" | php /usr/local/vesta/func/bash-to-php-interpreter.php '--stdin' 'myvesta_sed' "$@"
exit $?
fi
fi
if [ "$1" == "--stdin" ]; then
shift;
php /usr/local/vesta/func/bash-to-php-interpreter.php '--stdin' 'myvesta_sed' "$@"
else
php /usr/local/vesta/func/bash-to-php-interpreter.php 'myvesta_sed' "$@"
fi
exit $?

View file

@ -32,12 +32,21 @@ is_object_unsuspended '../../data/firewall/rules' 'RULE' "$rule"
# Action #
#----------------------------------------------------------#
oldvalues=$(grep "RULE='$rule'" $VESTA/data/firewall/rules.conf)
# Suspending rule
update_object_value ../../data/firewall/rules RULE $rule '$SUSPENDED' yes
# Updating system firewall
$BIN/v-update-firewall
if [ "$WEB_SYSTEM" == 'nginx' ] || [ "$PROXY_SYSTEM" == 'nginx' ]; then
parse_object_kv_list_non_eval "$oldvalues"
if [ "$PORT" == "80,443" ] && [ "$ACTION" == "DROP" ]; then
sed -i "\#$IP#d" /etc/nginx/conf.d/block-firewall.conf
systemctl restart nginx
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -17,6 +17,10 @@ domain=$2
domain_idn=$2
restart=$3
if [ -z "$restart" ]; then
restart='yes'
fi
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
@ -80,12 +84,14 @@ fi
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_WEB'
# Restarting web server
$BIN/v-restart-web $restart
check_result $? "Web restart failed" >/dev/null
if [ "$restart" = "yes" ]; then
# Restarting web server
$BIN/v-restart-web $restart
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy $restart
check_result $? "Proxy restart failed" >/dev/null
$BIN/v-restart-proxy $restart
check_result $? "Proxy restart failed" >/dev/null
fi
# Logging
log_event "$OK" "$ARGUMENTS"

71
bin/v-unlock-wordpress Normal file
View file

@ -0,0 +1,71 @@
#!/bin/bash
# info: Unlock previously locked WordPress files if they were potentially infected (somewhere) by PHP malware
# options: DOMAIN
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Importing system environment
source /etc/profile
# Argument definition
domain=$1
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
USER=$user
# Includes
source /usr/local/vesta/func/main.sh
if [ -z "$user" ]; then
check_result $E_NOTEXIST "domain $domain doesn't exist"
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'DOMAIN'
is_format_valid 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
if [ ! -d "/home/$user" ]; then
echo "User doesn't exist";
exit 1;
fi
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
echo "Domain doesn't exist";
exit 1;
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
cd /home/$user/web/$domain
# lock files
chown -R $user:$user public_html/
rm public_html/wp-content/uploads/.htaccess
/usr/local/vesta/bin/v-fix-website-permissions $domain
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "v-unlock-wordpress: Done."
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -32,12 +32,25 @@ is_object_suspended '../../data/firewall/rules' 'RULE' "$rule"
# Action #
#----------------------------------------------------------#
oldvalues=$(grep "RULE='$rule'" $VESTA/data/firewall/rules.conf)
# Suspending rule
update_object_value ../../data/firewall/rules RULE $rule '$SUSPENDED' no
# Updating system firewall
$BIN/v-update-firewall
if [ "$WEB_SYSTEM" == 'nginx' ] || [ "$PROXY_SYSTEM" == 'nginx' ]; then
parse_object_kv_list_non_eval "$oldvalues"
if [ "$PORT" == "80,443" ] && [ "$ACTION" == "DROP" ]; then
touch /etc/nginx/conf.d/block-firewall.conf
if ! grep -q "deny $IP;" /etc/nginx/conf.d/block-firewall.conf; then
echo "deny $IP;" >> /etc/nginx/conf.d/block-firewall.conf
systemctl restart nginx
fi
fi
fi
#----------------------------------------------------------#
# Vesta #

View file

@ -0,0 +1,48 @@
#!/bin/bash
# info: fix website permissions for all websites
# options:
#
# The command is used for fixing website permissions for all websites on the server.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Importing system variables
source /etc/profile
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
continue;
fi
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
cp /usr/local/vesta/data/templates/web/skel/document_errors/403.html /home/$user/web/$domain/document_errors/403.html
cp /usr/local/vesta/data/templates/web/skel/document_errors/404.html /home/$user/web/$domain/document_errors/404.html
cp /usr/local/vesta/data/templates/web/skel/document_errors/50x.html /home/$user/web/$domain/document_errors/50x.html
sed -i "s/%domain%/$domain/g" /home/$user/web/$domain/document_errors/403.html
sed -i "s/%domain%/$domain/g" /home/$user/web/$domain/document_errors/404.html
sed -i "s/%domain%/$domain/g" /home/$user/web/$domain/document_errors/50x.html
chown $user:$user /home/$user/web/$domain/document_errors/*
chmod 644 /home/$user/web/$domain/document_errors/*
done
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -67,7 +67,7 @@ echo "$iptables -P INPUT ACCEPT" >> $tmp
echo "$iptables -F INPUT" >> $tmp
# Enabling stateful support
if [ "$conntrack" != 'no' ] || grep --quiet container=lxc /proc/1/environ; then
if [ "$FIREWALL_STATEFUL" == "yes" ] || [ "$conntrack" != 'no' ] || grep --quiet container=lxc /proc/1/environ; then
str="$iptables -A INPUT -m state"
str="$str --state ESTABLISHED,RELATED -j ACCEPT"
echo "$str" >> $tmp
@ -164,12 +164,12 @@ if [ ! -z "$FIREWALL_EXTENSION" ]; then
fi
# Saving rules to the master iptables file
if [ -d "/etc/sysconfig" ]; then
/sbin/iptables-save > /etc/sysconfig/iptables
if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
/sbin/chkconfig iptables on
fi
else
# if [ -d "/etc/sysconfig" ]; then
# /sbin/iptables-save > /etc/sysconfig/iptables
# if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
# /sbin/chkconfig iptables on
# fi
# else
/sbin/iptables-save > /etc/iptables.rules
preup="/etc/network/if-pre-up.d/iptables"
if [ ! -e "$preup" ]; then
@ -178,7 +178,7 @@ else
echo "exit 0" >> $preup
chmod +x $preup
fi
fi
# fi
# Worarkound for OpenVZ
if [ -e "/proc/vz/veinfo" ]; then

View file

@ -36,6 +36,12 @@ for user in $($BIN/v-list-users plain |cut -f 1); do
limit_check=1
fail_counter=$(get_web_counter "$user" "$domain" 'LETSENCRYPT_FAIL_COUNT')
# proxy_tpl=$(/usr/local/vesta/bin/v-list-web-domain "$user" "$domain" "shell" | grep 'PROXY:' | cut -d ' ' -f11-)
# if [ "$proxy_tpl" = "forward" ]; then
# echo "[$(date)] : $domain is using forward proxy, skipping" >> /usr/local/vesta/log/letsencrypt_cron.log
# continue;
# fi
if [[ "$hostname" = "$domain" ]]; then
if [[ "$fail_counter" -eq 7 ]]; then
limit_check=0

View file

@ -49,7 +49,8 @@ dom_diks=0
for account in $(search_objects "mail/$domain" 'SUSPENDED' "no" 'ACCOUNT'); do
home_dir=$HOMEDIR/$user/mail/$domain/$account
if [ -e "$home_dir" ]; then
udisk=$(nice -n 19 du -shm $home_dir | cut -f 1 )
cd $home_dir
udisk=$(nice -n 19 du -shm ./ | cut -f 1 )
else
udisk=0
fi

View file

@ -35,13 +35,14 @@ fi
#----------------------------------------------------------#
# Starting loop
for domain in $(search_objects 'mail' 'SUSPENDED' "no" 'DOMAIN'); do
for domain in $(list_objects 'mail' 'DOMAIN'); do
dom_diks=0
accounts=$(search_objects "mail/$domain" 'SUSPENDED' "no" 'ACCOUNT')
accounts=$(list_objects "mail/$domain" 'ACCOUNT')
for account in $accounts; do
home_dir=$HOMEDIR/$user/mail/$domain/$account
if [ -e "$home_dir" ]; then
udisk=$(nice -n 19 du -shm $home_dir | cut -f 1 )
cd $home_dir
udisk=$(nice -n 19 du -shm ./ | cut -f 1 )
else
udisk=0
fi

36
bin/v-update-myvesta Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash
# info: Get the very latest build of myVesta
# options: NONE
#
# The function is downloading the very latest build of myVesta
#----------------------------------------------------------#
# Verifications & Variable & Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ]; then
echo "You must be root to execute this script"
exit 1
fi
# Includes
source /usr/local/vesta/func/main.sh
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
rm /var/cache/apt/archives/vesta_* > /dev/null 2>&1
apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" > /usr/local/vesta/log/update-$package.log 2>&1
apt-get install --reinstall vesta
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
echo "=== myVesta updated ==="
log_event "$OK" "$ARGUMENTS"
exit

Some files were not shown because too many files have changed in this diff Show more