File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ if [ -z "$MAIL_SYSTEM" ]; then
2626 check_result " $E_NOTEXIST " " Mail system not installed"
2727fi
2828
29+ if [ ! -e " $HESTIA /data/ips/$ip " ]; then
30+ exit ;
31+ fi
32+
2933# ----------------------------------------------------------#
3034# Verifications #
3135# ----------------------------------------------------------#
Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
126126 fi
127127fi
128128
129+ if [ ! -z " $MAIL_SYSTEM " ]; then
130+ if [ -z " $NAT " ]; then
131+ delete_ip_helo_value $ip
132+ else
133+ delete_ip_helo_value $NAT
134+ fi
135+ fi
129136
130137# ----------------------------------------------------------#
131138# Hestia #
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ update_ip_helo_value() {
5050 natip=" $1 "
5151
5252 # In case the IP is an NAT use the real ip address
53- if [ ! -f $HESTIA /data/ips/$ip ]; then
53+ if [ ! -e " $HESTIA /data/ips/$ip " ]; then
5454 ip=$( get_real_ip $ip ) ;
5555 fi
5656
@@ -74,6 +74,11 @@ update_ip_helo_value() {
7474 fi
7575}
7676
77+ delete_ip_helo_value (){
78+ ip=$1
79+ sed -i " /^$ip :/d" /etc/${MAIL_SYSTEM} /mailhelo.conf
80+ }
81+
7782# Update ip address value
7883update_ip_value () {
7984 key=" $1 "
@@ -195,7 +200,7 @@ get_real_ip() {
195200 if [ -e " $HESTIA /data/ips/$1 " ]; then
196201 echo $1
197202 else
198- nat=$( grep -H " ^NAT='$1 '" $HESTIA /data/ips/* )
203+ nat=$( grep -H " ^NAT='$1 '" $HESTIA /data/ips/* | head -n1 )
199204 if [ ! -z " $nat " ]; then
200205 echo " $nat " | cut -f 1 -d : | cut -f 7 -d /
201206 fi
Original file line number Diff line number Diff line change @@ -482,6 +482,14 @@ function check_ip_not_banned(){
482482 fi
483483}
484484
485+ @test " Ip: Change Helo" {
486+ local ip=" 198.18.0.121"
487+ run v-change-sys-ip-helo 198.18.0.121 dev.hestiacp.com
488+ assert_success
489+ refute_output
490+ assert_file_contains /etc/exim4/mailhelo.conf " 198.18.0.121:dev.hestiacp.com"
491+ }
492+
485493@test " Ip: Delete ips" {
486494 local ip=" 198.18.0.12"
487495 run v-delete-sys-ip $ip
You can’t perform that action at this time.
0 commit comments