Просмотр исходного кода

Fix #3266 HestiaCP with PROFTPD Passive Mode External IP (#3301)

* Issue #3266 - Update nat address

Update nat address for proftpd

* Issue hestiacp#3266 - Update nat address

This will check for the line `Include /etc/proftpd/conf.d/*.conf` and if does not exist, creates it

* Fix format

---------

Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
TLCD96 3 лет назад
Родитель
Сommit
6605f7bc6e
2 измененных файлов с 28 добавлено и 0 удалено
  1. 5 0
      bin/v-change-sys-ip-nat
  2. 23 0
      install/upgrade/versions/1.7.0.sh

+ 5 - 0
bin/v-change-sys-ip-nat

@@ -94,6 +94,11 @@ if [ -n "$old" ] && [ -n "$FTP_SYSTEM" ]; then
 			fi
 		fi
 	fi
+	if [ "$FTP_SYSTEM" = 'proftpd' ]; then
+        	conf="/etc/$FTP_SYSTEM/conf.d/external_ip.conf"
+        	content="MasqueradeAddress ${nat_ip}"
+        	echo "$content" > $conf
+    	fi
 	$BIN/v-restart-ftp "$restart"
 fi
 

+ 23 - 0
install/upgrade/versions/1.7.0.sh

@@ -17,6 +17,18 @@
 ####### You can use \n within the string to create new lines.                   #######
 #######################################################################################
 
+# load config because we need to know if proftpd is installed
+
+# Includes
+# shellcheck source=/etc/hestiacp/hestia.conf
+source /etc/hestiacp/hestia.conf
+# shellcheck source=/usr/local/hestia/func/main.sh
+source $HESTIA/func/main.sh
+# shellcheck source=/usr/local/hestia/func/ip.sh
+source $HESTIA/func/ip.sh
+# load config file
+source_conf "$HESTIA/conf/hestia.conf"
+
 upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'true'
 upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'true'
 upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'true'
@@ -72,6 +84,17 @@ for file in /etc/php/*/fpm/pool.d/www.conf; do
 	sed -i 's|/var/run/|/run/|g' $file
 done
 
+#update proftpd
+if [ "$FTP_SYSTEM" = 'proftpd' ]; then
+	contains_conf_d=$(grep -c "Include /etc/proftpd/conf.d/\*.conf" "/etc/proftpd/proftpd.conf")
+	# the line below is for testing only:
+	#        echo "contains proftpd? $contains_conf_d"
+	if [ $contains_conf_d = 0 ]; then
+		sed -i 's/Include \/etc\/proftpd\/tls.conf/&\nInclude \/etc\/proftpd\/conf.d\/*.conf/' /etc/proftpd/proftpd.conf
+	fi
+	$BIN/v-restart-ftp
+fi
+
 if echo "$BACKUP_SYSTEM" | grep "google" > /dev/null; then
 	echo "[ ! ] Deprecation notice: Backup via Google Cloud has been removed setup backup again via Rclone to reinstate the backup and restore capebilities!"
 	add_upgrade_message "Deprecation notice: Backup via Google Cloud has been removed setup backup again via Rclone to reinstate the backup and restore capebilities!"