Skip to content

Commit 1bcdef6

Browse files
committed
password transmission via tmp files
1 parent fcea9ab commit 1bcdef6

15 files changed

+152
-32
lines changed

bin/v-add-database

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
user=$1
2020
database="$user"_"$2"
2121
dbuser="$user"_"$3"
22-
dbpass=$4
22+
password=$4
2323
type=${5-mysql}
2424
host=$6
2525
charset=${7-UTF8}
@@ -40,7 +40,7 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
4040
#----------------------------------------------------------#
4141

4242
check_args '4' "$#" 'USER DATABASE DBUSER DBPASS [TYPE] [HOST] [CHARSET]'
43-
validate_format 'user' 'database' 'dbuser' 'dbpass' 'charset'
43+
validate_format 'user' 'database' 'dbuser' 'charset'
4444
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
4545
is_type_valid "$DB_SYSTEM" "$type"
4646
is_object_valid 'user' 'USER' "$user"
@@ -51,6 +51,8 @@ is_object_valid "../../../conf/$type" 'DBHOST' "$host"
5151
is_object_unsuspended "../../../conf/$type" 'DBHOST' "$host"
5252
#is_charset_valid
5353
is_package_full 'DATABASES'
54+
is_password_valid
55+
dbpass="$password"
5456

5557

5658
#----------------------------------------------------------#

bin/v-add-database-host

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
type=$1
1818
host=$2
1919
dbuser=$3
20-
dbpass=$4
20+
password=$4
2121
max_db=${6-500}
2222
charsets=${7-UTF8,LATIN1,WIN1250,WIN1251,WIN1252,WIN1256,WIN1258,KOI8}
2323
template=${8-template1}
@@ -29,6 +29,7 @@ source $VESTA/conf/vesta.conf
2929

3030
# Hiding password
3131
A4='******'
32+
EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3233

3334

3435
#----------------------------------------------------------#
@@ -37,10 +38,12 @@ A4='******'
3738

3839
args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL]'
3940
check_args '4' "$#" "$args_usage"
40-
validate_format 'host' 'dbuser' 'dbpass' 'max_db' 'charsets' 'template'
41+
validate_format 'host' 'dbuser' 'max_db' 'charsets' 'template'
4142
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
4243
is_type_valid "$DB_SYSTEM" "$type"
4344
is_dbhost_new
45+
is_password_valid
46+
dbpass="$password"
4447
case $type in
4548
mysql) is_mysql_host_alive ;;
4649
pgsql) is_pgsql_host_alive ;;

bin/v-add-mail-account

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3333
#----------------------------------------------------------#
3434

3535
check_args '4' "$#" 'USER DOMAIN ACCOUNT PASSWORD [QUOTA]'
36-
validate_format 'user' 'domain' 'account' 'password' 'quota'
36+
validate_format 'user' 'domain' 'account' 'quota'
3737
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
3838
is_object_valid 'user' 'USER' "$user"
3939
is_object_unsuspended 'user' 'USER' "$user"
4040
is_object_valid 'mail' 'DOMAIN' "$domain"
4141
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
4242
is_package_full 'MAIL_ACCOUNTS'
4343
is_mail_new "$account"
44+
is_password_valid
4445

4546

4647
#----------------------------------------------------------#

bin/v-add-remote-dns-host

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ source $VESTA/conf/vesta.conf
2525

2626
# Hiding passwords
2727
A4='******'
28+
EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
2829

2930

3031
#----------------------------------------------------------#
@@ -33,8 +34,9 @@ A4='******'
3334

3435
args_usage='HOST PORT USER PASSWORD [TYPE] [DNS_USER]'
3536
check_args '4' "$#" "$args_usage"
36-
validate_format 'host' 'port' 'user' 'password' 'type' 'dns_user'
37+
validate_format 'host' 'port' 'user' 'type' 'dns_user'
3738
is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
39+
is_password_valid
3840
is_dnshost_new
3941
is_dnshost_alive
4042

bin/v-add-user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ is_user_free() {
4040
#----------------------------------------------------------#
4141

4242
check_args '3' "$#" 'USER PASSWORD EMAIL [PACKAGE] [FNAME] [LNAME]'
43-
validate_format 'user' 'password' 'email' 'package'
43+
validate_format 'user' 'email' 'package'
4444
if [ ! -z "$fname" ]; then
4545
validate_format 'fname' 'lname'
4646
fi
47-
4847
is_user_free "$user"
48+
is_password_valid
4949
is_package_valid
5050

5151

bin/v-add-web-domain-ftp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ user=$1
1414
domain=$(idn -t --quiet -u "$2" )
1515
domain_idn=$(idn -t --quiet -a "$domain")
1616
ftp_user=${1}_${3}
17-
ftp_password=$4
17+
password=$4
1818
ftp_path=$5
1919

2020
# Includes
@@ -32,7 +32,7 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3232
#----------------------------------------------------------#
3333

3434
check_args '4' "$#" 'USER DOMAIN FTP_USER FTP_PASSWORD [FTP_PATH]'
35-
validate_format 'user' 'domain' 'ftp_user' 'ftp_password'
35+
validate_format 'user' 'domain' 'ftp_user'
3636
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
3737
is_object_valid 'user' 'USER' "$user"
3838
is_object_unsuspended 'user' 'USER' "$user"
@@ -44,6 +44,7 @@ if [ ! -z "$check_ftp_user" ] && [ "$FTP_USER" != "$ftp_user" ]; then
4444
log_event "$E_EXISTS" "$EVENT"
4545
exit $E_EXISTS
4646
fi
47+
is_password_valid
4748

4849

4950
#----------------------------------------------------------#
@@ -90,7 +91,7 @@ fi
9091
-M -d "$ftp_path_a" > /dev/null 2>&1
9192

9293
# Set ftp user password
93-
echo "$ftp_user:$ftp_password" | /usr/sbin/chpasswd
94+
echo "$ftp_user:$password" | /usr/sbin/chpasswd
9495
ftp_md5=$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)
9596

9697

bin/v-add-web-domain-stats-user

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
user=$1
1414
domain=$(idn -t --quiet -u "$2" )
1515
stats_user=$3
16-
stats_pass=$4
16+
password=$4
1717

1818
# Includes
1919
source $VESTA/func/main.sh
@@ -30,12 +30,13 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3030
#----------------------------------------------------------#
3131

3232
check_args '4' "$#" 'USER DOMAIN STATS_USER STATS_PASS'
33-
validate_format 'user' 'domain' 'stats_user' 'stats_pass'
33+
validate_format 'user' 'domain' 'stats_user'
3434
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
3535
is_object_valid 'user' 'USER' "$user"
3636
is_object_unsuspended 'user' 'USER' "$user"
3737
is_object_valid 'web' 'DOMAIN' "$domain"
3838
is_object_unsuspended 'web' 'DOMAIN' "$domain"
39+
is_password_valid
3940

4041

4142
#----------------------------------------------------------#
@@ -53,7 +54,7 @@ Require valid-user" > $stats_dir/.htaccess
5354

5455
# Generating htaccess user and password
5556
rm -f $stats_dir/.htpasswd
56-
htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$stats_pass" &>/dev/null
57+
htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$password" &>/dev/null
5758
stats_crypt=$(grep $stats_user: $stats_dir/.htpasswd |cut -f 2 -d :)
5859

5960
#----------------------------------------------------------#

bin/v-change-database-owner

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# info: change database password
2+
# info: change database owner
33
# options: DATABASE USER
44
#
55
# The function for changing database owner.

bin/v-change-database-password

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Argument defenition
1414
user=$1
1515
database=$2
16-
dbpass=$3
16+
password=$3
1717

1818
# Includes
1919
source $VESTA/func/main.sh
@@ -30,13 +30,14 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3030
#----------------------------------------------------------#
3131

3232
check_args '3' "$#" 'USER DATABASE DBPASS'
33-
validate_format 'user' 'database' 'dbpass'
33+
validate_format 'user' 'database'
3434
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
3535
is_object_valid 'user' 'USER' "$user"
3636
is_object_unsuspended 'user' 'USER' "$user"
3737
is_object_valid 'db' 'DB' "$database"
3838
is_object_unsuspended 'db' 'DB' "$database"
39-
39+
is_password_valid
40+
dbpass="$password"
4041

4142
#----------------------------------------------------------#
4243
# Action #

bin/v-change-database-user

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
user=$1
1414
database=$2
1515
dbuser="$user"_"$3"
16-
dbpass=$4
16+
password=$4
1717

1818
# Includes
1919
source $VESTA/func/main.sh
@@ -32,26 +32,25 @@ EVENT="$DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9"
3232

3333
check_args '3' "$#" 'USER DATABASE DBUSER [DBPASS]'
3434
validate_format 'user' 'database' 'dbuser'
35-
if [ ! -z "$dbpass" ]; then
36-
validate_format 'dbpass'
37-
fi
3835
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
3936
is_object_valid 'user' 'USER' "$user"
4037
is_object_unsuspended 'user' 'USER' "$user"
4138
is_object_valid 'db' 'DB' "$database"
4239
is_object_unsuspended 'db' 'DB' "$database"
40+
is_password_valid
41+
dbpass="$password"
42+
43+
44+
#----------------------------------------------------------#
45+
# Action #
46+
#----------------------------------------------------------#
4347

4448
# Compare old and new user
4549
old_dbuser=$(get_object_value 'db' 'DB' "$database" '$DBUSER')
4650
if [ "$old_dbuser" = "$dbuser" ]; then
4751
exit
4852
fi
4953

50-
51-
#----------------------------------------------------------#
52-
# Action #
53-
#----------------------------------------------------------#
54-
5554
# Set new dbuser
5655
update_object_value 'db' 'DB' "$database" '$DBUSER' "$dbuser"
5756

0 commit comments

Comments
 (0)