Update v-make-separated-ip-for-email

This commit is contained in:
myvesta 2020-07-13 12:03:37 +02:00 committed by GitHub
commit 812d92b5f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,10 +5,9 @@
#
# The function add new ip, add new host for mail, try to generate letsencrypt for it, and makes email to be sent via that IP only for SMTP authenticated users
if [ $# -lt 2 ]; then
echo "USAGE: v-make-separate-ip-for-email MAIL_HOSTNAME MAIL_IP"
exit 1
fi
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
MAIL_HOSTNAME=$1
MAIL_IP=$2
@ -25,6 +24,14 @@ else
INTERFACE='eth0'
fi
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'MAIL_HOSTNAME MAIL_IP'
is_domain_format_valid "$MAIL_HOSTNAME"
is_ip_format_valid "$MAIL_IP"
HOST_USER=$($VESTA/bin/v-search-domain-owner "$HOSTNAME")
if [ -z "$HOST_USER" ]; then
echo "Error: hostname $HOSTNAME is not created as web domain"
@ -44,6 +51,10 @@ if [ $# -gt 3 ]; then
echo "INTERFACE : $INTERFACE"
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ ! -f "/usr/local/vesta/data/ips/$MAIL_IP" ]; then
$VESTA/bin/v-add-sys-ip "$MAIL_IP" "$NETMASK" "$INTERFACE" 'admin' 'dedicated' '' ''
fi