mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
added fname,lname and multiple nameserver support
This commit is contained in:
parent
5e09a913fd
commit
f59d74928e
8 changed files with 61 additions and 30 deletions
|
@ -12,8 +12,8 @@ email="$3"
|
|||
role="$4"
|
||||
owner="${5-vesta}"
|
||||
package="${6-default}"
|
||||
ns1=$7
|
||||
ns2=$8
|
||||
fname=$7
|
||||
lname=$8
|
||||
|
||||
# Importing variables
|
||||
source $VESTA/conf/vars.conf
|
||||
|
@ -25,11 +25,11 @@ source $V_FUNC/shared_func.sh
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '5' "$#" 'user password email role owner [package] [ns1] [ns2]'
|
||||
check_args '5' "$#" 'user password email role owner [package] [fname] [lname]'
|
||||
|
||||
# Checking argument format
|
||||
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
|
||||
format_validation 'ns1' 'ns2'
|
||||
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
|
||||
format_validation 'fname' 'lname'
|
||||
|
||||
# Checking user
|
||||
is_user_free "$user"
|
||||
|
@ -147,17 +147,10 @@ if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then
|
|||
echo "v_backup_sys_user $user" >> $V_QUEUE/backup.pipe
|
||||
fi
|
||||
|
||||
# Rewriting nameservers
|
||||
if [ ! -z "$ns1" ]; then
|
||||
package_data=$(echo "$package_data" | sed -e "s/NS1=.*$/NS1='$ns1'/g")
|
||||
fi
|
||||
if [ ! -z "$ns2" ]; then
|
||||
package_data=$(echo "$package_data" | sed -e "s/NS2=.*$/NS2='$ns2'/g")
|
||||
fi
|
||||
|
||||
|
||||
# Filling user config
|
||||
echo "PACKAGE='$package'
|
||||
echo "FNAME='$fname'
|
||||
LNAME='$lname'
|
||||
PACKAGE='$package'
|
||||
$package_data
|
||||
SUSPENDED='no'
|
||||
OWNER='$owner'
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
user="$1"
|
||||
ns1="$2"
|
||||
ns2="$3"
|
||||
ns3="$4"
|
||||
ns4="$5"
|
||||
ns5="$6"
|
||||
ns6="$7"
|
||||
ns7="$8"
|
||||
ns8="$9"
|
||||
|
||||
# Importing variables
|
||||
source $VESTA/conf/vars.conf
|
||||
|
@ -20,10 +26,33 @@ source $V_FUNC/shared_func.sh
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '3' "$#" 'user ns1 ns2'
|
||||
check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]'
|
||||
|
||||
# Checking argument format
|
||||
format_validation 'user' 'ns1' 'ns2'
|
||||
format_validation 'user' 'ns1' 'ns2'
|
||||
if [ ! -z "$ns3" ]; then
|
||||
format_validation 'ns3'
|
||||
fi
|
||||
|
||||
if [ ! -z "$ns4" ]; then
|
||||
format_validation 'ns4'
|
||||
fi
|
||||
|
||||
if [ ! -z "$ns5" ]; then
|
||||
format_validation 'ns5'
|
||||
fi
|
||||
|
||||
if [ ! -z "$ns6" ]; then
|
||||
format_validation 'ns6'
|
||||
fi
|
||||
|
||||
if [ ! -z "$ns7" ]; then
|
||||
format_validation 'ns7'
|
||||
fi
|
||||
|
||||
if [ ! -z "$ns8" ]; then
|
||||
format_validation 'ns8'
|
||||
fi
|
||||
|
||||
# Checking user
|
||||
is_user_valid
|
||||
|
@ -37,12 +66,14 @@ is_user_suspended
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get old values
|
||||
old_ns1=$(get_user_value '$NS1')
|
||||
old_ns2=$(get_user_value '$NS2')
|
||||
old_ns=$(get_user_value '$NS')
|
||||
|
||||
# Merging values
|
||||
ns="$ns1,$ns2,$ns3,$ns4,$ns5,$ns6,$ns7,$ns8"
|
||||
ns=$(echo "$ns"|sed -e "s/,,//g" -e "s/,$//")
|
||||
|
||||
# Changing ns values
|
||||
update_user_value "$user" '$NS1' "$ns1"
|
||||
update_user_value "$user" '$NS2' "$ns2"
|
||||
update_user_value "$user" '$NS' "$ns"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -50,7 +81,7 @@ update_user_value "$user" '$NS2' "$ns2"
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_history "$V_EVENT" "$V_SCRIPT $user $old_ns1 $old_ns2"
|
||||
log_history "$V_EVENT" "$V_SCRIPT $user ${old_ns//,/ }"
|
||||
log_event 'system' "$V_EVENT"
|
||||
|
||||
exit $OK
|
||||
|
|
|
@ -38,7 +38,7 @@ conf="$V_USERS/$user/user.conf"
|
|||
# Defining fileds to select
|
||||
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
|
||||
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
|
||||
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
|
||||
$BANDWIDTH $NS $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
|
||||
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
|
||||
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ format_validation 'limit' 'offset'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Defining fileds to select
|
||||
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
|
||||
fields='$USER $NAME $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
|
||||
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
|
||||
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
|
||||
$BANDWIDTH $NS $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
|
||||
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
|
||||
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
|
||||
|
||||
|
|
0
data/dbservers/.gitignore
vendored
0
data/dbservers/.gitignore
vendored
|
@ -9,8 +9,7 @@ MAIL_FORWARDERS='30'
|
|||
DNS_DOMAINS='10'
|
||||
DISK_QUOTA='10000'
|
||||
BANDWIDTH='10000'
|
||||
NS1='ns1.localhost'
|
||||
NS2='ns2.localhost'
|
||||
NS='ns1.localhost,ns2.localhost'
|
||||
SHELL='nologin'
|
||||
BACKUPS='3'
|
||||
MAX_CHILDS='300'
|
||||
|
|
|
@ -9,8 +9,7 @@ MAIL_FORWARDERS='50'
|
|||
DNS_DOMAINS='30'
|
||||
DISK_QUOTA='50000'
|
||||
BANDWIDTH='50000'
|
||||
NS1='ns1.localhost'
|
||||
NS2='ns2.localhost'
|
||||
NS='ns1.localhost,ns2.localhost'
|
||||
SHELL='nologin'
|
||||
BACKUPS='5'
|
||||
MAX_CHILDS='300'
|
||||
|
|
|
@ -25,7 +25,7 @@ log_history() {
|
|||
|
||||
# Checking logging system
|
||||
log_history=$(grep 'LOG_HISTORY=' $V_CONF/vesta.conf | cut -f 2 -d \' )
|
||||
if [ "$log_history" = 'on' ]; then
|
||||
if [ "$log_history" = 'yes' ]; then
|
||||
echo "$event [$undo]" >> $V_USERS/$user/history.log
|
||||
fi
|
||||
}
|
||||
|
@ -302,8 +302,16 @@ format_validation() {
|
|||
domain) format_dom "$v" ;;
|
||||
database) format_db "$v" ;;
|
||||
db_user) format_dbu "$v" ;;
|
||||
fname) format_usr "$v" ;;
|
||||
ns) format_dom "$v" ;;
|
||||
ns1) format_dom "$v" ;;
|
||||
ns2) format_dom "$v" ;;
|
||||
ns3) format_dom "$v" ;;
|
||||
ns4) format_dom "$v" ;;
|
||||
ns5) format_dom "$v" ;;
|
||||
ns6) format_dom "$v" ;;
|
||||
ns7) format_dom "$v" ;;
|
||||
ns8) format_dom "$v" ;;
|
||||
email) format_eml "$v" ;;
|
||||
extentions) format_ext "$v" ;;
|
||||
host) format_usr "$v" ;;
|
||||
|
@ -316,6 +324,7 @@ format_validation() {
|
|||
max_usr) format_int "$v" ;;
|
||||
max_db) format_int "$v" ;;
|
||||
limit) format_int "$v" ;;
|
||||
lname) format_usr "$v" ;;
|
||||
offset) format_int "$v" ;;
|
||||
owner) format_usr "$v" ;;
|
||||
package) format_usr "$v" ;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue