diff --git a/conf/main_ipv4.conf.sample b/conf/main_ipv4.conf.sample index 0012dc7..667026b 100644 --- a/conf/main_ipv4.conf.sample +++ b/conf/main_ipv4.conf.sample @@ -837,6 +837,13 @@ mail_user_ports="$standard_mailuser_ports" mail_smtp_port="$standard_smtp_port" +# Additional Ports for outgoing smtp traffic +# +# comma separated list of ports +# +smtpd_additional_outgoung_ports="" + + # ====== # - FTP Service # ====== diff --git a/conf/main_ipv6.conf.sample b/conf/main_ipv6.conf.sample index 1af9a12..be24a3d 100644 --- a/conf/main_ipv6.conf.sample +++ b/conf/main_ipv6.conf.sample @@ -809,6 +809,13 @@ mail_user_ports="$standard_mailuser_ports" mail_smtp_port="$standard_smtp_port" +# Additional Ports for outgoing smtp traffic +# +# comma separated list of ports +# +smtpd_additional_outgoung_ports="" + + # ====== # - FTP Service # ====== diff --git a/conf/post_decalrations.conf b/conf/post_decalrations.conf index 81c0f27..52b62ec 100644 --- a/conf/post_decalrations.conf +++ b/conf/post_decalrations.conf @@ -727,6 +727,27 @@ done IFS="$CUR_IFS" +# --- +# Additional SMTP Outgoing Ports +# --- +declare -a smtpd_additional_outgoung_port_arr=() +CUR_IFS="$IFS" +IFS=',' ; for _port in $smtpd_additional_outgoung_ports ; do + + if containsElement "${_port}" "${out_tcp_port_arr[@]}" ; then + continue + fi + + smtpd_additional_outgoung_port_arr+=("${_port}") + + if $allow_mail_request_out ; then + out_tcp_port_arr+=("$_port") + fi + +done +IFS="$CUR_IFS" + + # --- # - FTP out only diff --git a/ip6t-firewall-gateway b/ip6t-firewall-gateway index 2c6f335..fda33de 100755 --- a/ip6t-firewall-gateway +++ b/ip6t-firewall-gateway @@ -2630,6 +2630,29 @@ else fi +# --- +# - Mail (additional smtp ports OUT) +# --- + +echononl "\t\tMail (additional smtp ports OUT)" + +if [[ ${#smtpd_additional_outgoung_port_arr[@]} -gt 0 ]] ; then + + for _port in ${smtpd_additional_outgoung_port_arr[@]} ; do + for _dev in ${ext_if_arr[@]} ; do + $ip6t -A OUTPUT -o $_dev -p tcp --dport $_port -m state --state NEW -j ACCEPT + if $kernel_forward_between_interfaces ; then + $ip6t -A FORWARD -o $_dev -p tcp --dport $_port -m state --state NEW -j ACCEPT + fi + done + done + + echo_done +else + echo_skipped +fi + + # --- # - SMTP (Relay) Service Gateway # --- diff --git a/ipt-firewall-gateway b/ipt-firewall-gateway index 0cea726..35075ff 100755 --- a/ipt-firewall-gateway +++ b/ipt-firewall-gateway @@ -3402,6 +3402,29 @@ else fi +# --- +# - Mail (additional smtp ports OUT) +# --- + +echononl "\t\tMail (additional smtp ports OUT)" + +if [[ ${#smtpd_additional_outgoung_port_arr[@]} -gt 0 ]] ; then + + for _port in ${smtpd_additional_outgoung_port_arr[@]} ; do + for _dev in ${ext_if_arr[@]} ; do + $ipt -A OUTPUT -o $_dev -p tcp --dport $_port -m state --state NEW -j ACCEPT + if $kernel_activate_forwarding ; then + $ipt -A FORWARD -o $_dev -p tcp --dport $_port -m state --state NEW -j ACCEPT + fi + done + done + + echo_done +else + echo_skipped +fi + + # --- # - SMTP (Relay) Service Gateway # ---