Skip to content

Commit f871faf

Browse files
committed
Merge branch 'master' of github.com:serghey-rodin/vesta
2 parents d3390d7 + a93d9c5 commit f871faf

24 files changed

+635
-99
lines changed

bin/v-backup-user

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,8 @@ TIME=$(date +%T)
536536

537537
# Defining local storage function
538538
local_backup(){
539-
# Removing dublicate for this day
540-
if [ -e "$BACKUP/$user.$DATE.tar" ]; then
541-
deprecated="$DATE"
542-
rm -f $BACKUP/$user.$DATE.tar
543-
fi
539+
540+
rm -f $BACKUP/$user.$DATE.tar
544541

545542
# Checking retention
546543
backup_list=$(ls -lrt $BACKUP/ | awk '{print $9}' |grep "^$user\.")
@@ -549,10 +546,9 @@ local_backup(){
549546
backups_rm_number=$((backups_count - BACKUPS))
550547
(( ++backups_rm_number))
551548

549+
# Removing old backup
552550
for backup in $(echo "$backup_list" | head -n $backups_rm_number); do
553-
# Removing old backup
554551
backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
555-
deprecated="$deprecated $backup_date"
556552
echo -e "$(date "+%F %T") Roated: $backup_date"
557553
msg="$msg\n$(date "+%F %T") Rotated: $backup_date"
558554
rm -f $BACKUP/$backup
@@ -672,7 +668,6 @@ ftp_backup() {
672668
backups_rm_number=$((backups_count - BACKUPS + 1))
673669
for backup in $(echo "$backup_list" | head -n $backups_rm_number); do
674670
backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
675-
deprecated="$deprecated $backup"
676671
echo -e "$(date "+%F %T") Roated ftp backup: $backup_date"
677672
msg="$msg\n$(date "+%F %T") Roated ftp backup: $backup_date"
678673
ftpc "cd $BPATH" "delete $backup"
@@ -732,7 +727,7 @@ expect -f "-" <<EOF "$@"
732727
set rc $OK
733728
}
734729
}
735-
exp_continue
730+
exp_continue
736731
}
737732
738733
timeout {
@@ -745,7 +740,7 @@ expect -f "-" <<EOF "$@"
745740
puts "\$output"
746741
}
747742
748-
exit \$rc
743+
exit \$rc
749744
EOF
750745
}
751746

@@ -813,7 +808,7 @@ sftp_backup() {
813808
exit "$rc"
814809
fi
815810
echo -e "$(date "+%F %T") Connection established"
816-
811+
817812
# Checking retention
818813
echo -e "$(date "+%F %T") Checking retention ..."
819814
backup_list=$(sftpc "cd $BPATH" "ls -l" |awk '{print $9}' |grep "^$user\.")
@@ -857,7 +852,6 @@ for backup_type in $(echo -e "${BACKUP_SYSTEM//,/\\n}"); do
857852
done
858853

859854
# Removing tmpdir
860-
cd /
861855
rm -rf $tmpdir
862856

863857
# Calculation run time
@@ -882,14 +876,11 @@ msg="$msg\n$(date "+%F %T") Runtime: $run_time $min"
882876
# Vesta #
883877
#----------------------------------------------------------#
884878

885-
# Deleting old backup records
886-
for backup_record in $deprecated; do
887-
if [ -e "$USER_DATA/backup.conf" ]; then
888-
sed -i "/DATE='$backup_record/d" $USER_DATA/backup.conf
889-
fi
890-
done
879+
# Removing duplicate
880+
touch $USER_DATA/backup.conf
881+
sed -i "/$user.$DATE.tar/d" $USER_DATA/backup.conf
891882

892-
# Concatenating string
883+
# Regestering new backup
893884
backup_str="BACKUP='$user.$DATE.tar'"
894885
backup_str="$backup_str TYPE='$BACKUP_SYSTEM' SIZE='$size'"
895886
backup_str="$backup_str WEB='${web_list// /,}'"
@@ -900,9 +891,13 @@ backup_str="$backup_str CRON='$cron_list'"
900891
backup_str="$backup_str UDIR='${udir_list// /,}'"
901892
backup_str="$backup_str RUNTIME='$run_time' TIME='$TIME' DATE='$DATE'"
902893
echo "$backup_str" >> $USER_DATA/backup.conf
894+
895+
# Removing old backups
896+
tail -n $BACKUPS $USER_DATA/backup.conf > $USER_DATA/backup.conf_
897+
mv -f $USER_DATA/backup.conf_ $USER_DATA/backup.conf
903898
chmod 660 $USER_DATA/backup.conf
904899

905-
# Clean backup queue
900+
# Deleting task from queue
906901
sed -i "/v-backup-user $user /d" $VESTA/data/queue/backup.pipe
907902

908903
# Send notification

bin/v-update-sys-ip-counters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for ip in $ip_list; do
4545

4646
# Calculate usage
4747
ip_usage=$(grep -H $ip $VESTA/data/users/*/web.conf)
48-
web_domains=$(echo "$ip_usage"| wc -l)
48+
web_domains=$(echo "$ip_usage" | sed '/^$/d' | wc -l)
4949
sys_users=$(echo "$ip_usage" | cut -f7 -d/ | sort -u |\
5050
tr '\n' ',' | sed "s/,$//g")
5151

install/debian/exim4.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ acl_check_rcpt:
108108
require message = relay not permitted
109109
domains = +local_domains : +relay_to_domains
110110

111-
deny message = smtp auth requried
111+
deny message = smtp auth required
112112
sender_domains = +local_domains
113113
!authenticated = *
114114

install/debian/firewall/rules.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RULE='1' ACTION='ACCEPT' PROTOCOL='ICMP' PORT='0' IP='0.0.0.0/0' COMMENT='PING' SUSPENDED='no' TIME='17:13:48' DATE='2014-09-16'
22
RULE='2' ACTION='ACCEPT' PROTOCOL='TCP' PORT='8083' IP='0.0.0.0/0' COMMENT='VESTA' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
3-
RULE='3' ACTION='ACCEPT' PROTOCOL='TCP' PORT='3306,5432' IP='0.0.0.0/0' COMMENT='DB' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
3+
RULE='3' ACTION='ACCEPT' PROTOCOL='TCP' PORT='3306,5432' IP='127.0.0.1/32' COMMENT='DB' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
44
RULE='4' ACTION='ACCEPT' PROTOCOL='TCP' PORT='143,993' IP='0.0.0.0/0' COMMENT='IMAP' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
55
RULE='5' ACTION='ACCEPT' PROTOCOL='TCP' PORT='110,995' IP='0.0.0.0/0' COMMENT='POP3' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
66
RULE='6' ACTION='ACCEPT' PROTOCOL='TCP' PORT='25,465,587,2525' IP='0.0.0.0/0' COMMENT='SMTP' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'

install/debian/nginx.conf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ http {
8282
set_real_ip_from 198.41.128.0/17;
8383
set_real_ip_from 162.158.0.0/15;
8484
set_real_ip_from 104.16.0.0/12;
85-
set_real_ip_from 2400:cb00::/32;
86-
set_real_ip_from 2606:4700::/32;
87-
set_real_ip_from 2803:f800::/32;
88-
set_real_ip_from 2405:b500::/32;
89-
set_real_ip_from 2405:8100::/32;
85+
set_real_ip_from 172.64.0.0/13;
86+
#set_real_ip_from 2400:cb00::/32;
87+
#set_real_ip_from 2606:4700::/32;
88+
#set_real_ip_from 2803:f800::/32;
89+
#set_real_ip_from 2405:b500::/32;
90+
#set_real_ip_from 2405:8100::/32;
9091
real_ip_header CF-Connecting-IP;
9192

9293

install/debian/whmcs-module.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function vesta_CreateAccount($params) {
4343
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
4444
$answer = curl_exec($curl);
4545

46+
logModuleCall('vesta','CreateAccount_UserAccount','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
47+
4648
// Enable ssh access
4749
if(($answer == 'OK') && ($params["configoption2"] == 'on')) {
4850
$postvars = array(
@@ -62,6 +64,8 @@ function vesta_CreateAccount($params) {
6264
curl_setopt($curl, CURLOPT_POST, true);
6365
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
6466
$answer = curl_exec($curl);
67+
68+
logModuleCall('vesta','CreateAccount_EnableSSH','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
6569
}
6670

6771
// Add domain
@@ -84,6 +88,8 @@ function vesta_CreateAccount($params) {
8488
curl_setopt($curl, CURLOPT_POST, true);
8589
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
8690
$answer = curl_exec($curl);
91+
92+
logModuleCall('vesta','CreateAccount_AddDomain','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
8793
}
8894
}
8995

@@ -92,8 +98,8 @@ function vesta_CreateAccount($params) {
9298
} else {
9399
$result = $answer;
94100
}
95-
return $result;
96101

102+
return $result;
97103
}
98104

99105
function vesta_TerminateAccount($params) {
@@ -122,14 +128,15 @@ function vesta_TerminateAccount($params) {
122128
$answer = curl_exec($curl);
123129
}
124130

131+
logModuleCall('vesta','TerminateAccount','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
132+
125133
if($answer == 'OK') {
126134
$result = "success";
127135
} else {
128136
$result = $answer;
129137
}
130138

131139
return $result;
132-
133140
}
134141

135142
function vesta_SuspendAccount($params) {
@@ -158,12 +165,15 @@ function vesta_SuspendAccount($params) {
158165
$answer = curl_exec($curl);
159166
}
160167

168+
logModuleCall('vesta','SuspendAccount','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
169+
161170
if($answer == 'OK') {
162171
$result = "success";
163172
} else {
164173
$result = $answer;
165174
}
166175

176+
return $result;
167177
}
168178

169179
function vesta_UnsuspendAccount($params) {
@@ -192,12 +202,15 @@ function vesta_UnsuspendAccount($params) {
192202
$answer = curl_exec($curl);
193203
}
194204

205+
logModuleCall('vesta','UnsuspendAccount','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
206+
195207
if($answer == 'OK') {
196208
$result = "success";
197209
} else {
198210
$result = $answer;
199211
}
200212

213+
return $result;
201214
}
202215

203216
function vesta_ChangePassword($params) {
@@ -227,13 +240,15 @@ function vesta_ChangePassword($params) {
227240
$answer = curl_exec($curl);
228241
}
229242

243+
logModuleCall('vesta','ChangePassword','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
244+
230245
if($answer == 'OK') {
231246
$result = "success";
232247
} else {
233248
$result = $answer;
234249
}
250+
235251
return $result;
236-
237252
}
238253

239254
function vesta_ChangePackage($params) {
@@ -263,13 +278,15 @@ function vesta_ChangePackage($params) {
263278
$answer = curl_exec($curl);
264279
}
265280

281+
logModuleCall('vesta','ChangePackage','https://'.$params["serverhostname"].':8083/api/'.$postdata,$answer);
282+
266283
if($answer == 'OK') {
267284
$result = "success";
268285
} else {
269286
$result = $answer;
270287
}
271-
return $result;
272288

289+
return $result;
273290
}
274291

275292
function vesta_ClientArea($params) {

install/rhel/exim.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ acl_check_rcpt:
108108
require message = relay not permitted
109109
domains = +local_domains : +relay_to_domains
110110

111-
deny message = smtp auth requried
111+
deny message = smtp auth required
112112
sender_domains = +local_domains
113113
!authenticated = *
114114

install/rhel/firewall/rules.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RULE='1' ACTION='ACCEPT' PROTOCOL='ICMP' PORT='0' IP='0.0.0.0/0' COMMENT='PING' SUSPENDED='no' TIME='17:13:48' DATE='2014-09-16'
22
RULE='2' ACTION='ACCEPT' PROTOCOL='TCP' PORT='8083' IP='0.0.0.0/0' COMMENT='VESTA' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
3-
RULE='3' ACTION='ACCEPT' PROTOCOL='TCP' PORT='3306,5432' IP='0.0.0.0/0' COMMENT='DB' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
3+
RULE='3' ACTION='ACCEPT' PROTOCOL='TCP' PORT='3306,5432' IP='127.0.0.1/32' COMMENT='DB' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
44
RULE='4' ACTION='ACCEPT' PROTOCOL='TCP' PORT='143,993' IP='0.0.0.0/0' COMMENT='IMAP' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
55
RULE='5' ACTION='ACCEPT' PROTOCOL='TCP' PORT='110,995' IP='0.0.0.0/0' COMMENT='POP3' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'
66
RULE='6' ACTION='ACCEPT' PROTOCOL='TCP' PORT='25,465,587,2525' IP='0.0.0.0/0' COMMENT='SMTP' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'

install/rhel/nginx.conf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ http {
8282
set_real_ip_from 198.41.128.0/17;
8383
set_real_ip_from 162.158.0.0/15;
8484
set_real_ip_from 104.16.0.0/12;
85-
set_real_ip_from 2400:cb00::/32;
86-
set_real_ip_from 2606:4700::/32;
87-
set_real_ip_from 2803:f800::/32;
88-
set_real_ip_from 2405:b500::/32;
89-
set_real_ip_from 2405:8100::/32;
85+
set_real_ip_from 172.64.0.0/13;
86+
#set_real_ip_from 2400:cb00::/32;
87+
#set_real_ip_from 2606:4700::/32;
88+
#set_real_ip_from 2803:f800::/32;
89+
#set_real_ip_from 2405:b500::/32;
90+
#set_real_ip_from 2405:8100::/32;
9091
real_ip_header CF-Connecting-IP;
9192

9293

0 commit comments

Comments
 (0)