NextCloudPi - auto-reset of port settings after deliberate change

Hi,

in my current system configuration I use a couple of RaspberryPi devices within the same LAN, all installed using the recent NCP image. At the top of my LAN there is a FritzBox router. In order to reach more than one of the RaspberryPi devices from the internet, I use non-standard port settings (together with the No-Ip service to define appropriate domain names).

Here is the sequence I did in order to successfully configure e.g. port 65432 to reach my NextCloud server:

  • reset the server’s configurations within my router
  • ensure UPnP is set for the server within my router
  • activate the desired ports via NCP’s side menu “port forwarding”

NCP’s port forwarding shows a “green” sign and the log shows:

[ nc-forward-ports ] (Tue Dec 22 09:50:25 CET 2020)
upnpc : miniupnpc library test client, version 2.1.
(c) 2005-2018 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.41:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

desc: http://192.168.1.1:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:49000/igdupnp/control/WANIPConn1
Local LAN ip address : 192.168.1.147
UPNP_DeletePortMapping() failed with code : 714
upnpc : miniupnpc library test client, version 2.1.
(c) 2005-2018 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.41:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

desc: http://192.168.1.1:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:49000/igdupnp/control/WANIPConn1
Local LAN ip address : 192.168.1.147
UPNP_DeletePortMapping() failed with code : 714
upnpc : miniupnpc library test client, version 2.1.
(c) 2005-2018 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.41:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

desc: http://192.168.1.1:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:49000/igdupnp/control/WANIPConn1
Local LAN ip address : 192.168.1.147
ExternalIPAddress = 77.8.248.71
InternalIP:Port = 192.168.1.147:443
external 77.8.248.71:65432 TCP is redirected to internal 192.168.1.147:443 (duration=0)
upnpc : miniupnpc library test client, version 2.1.
(c) 2005-2018 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.41:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

desc: http://192.168.1.1:49000/igddesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:49000/igdupnp/control/WANIPConn1
Local LAN ip address : 192.168.1.147
ExternalIPAddress = 77.8.248.71
InternalIP:Port = 192.168.1.147:80
external 77.8.248.71:65431 TCP is redirected to internal 192.168.1.147:80 (duration=0)

There are two “IGD” devices (routers):

  • 192.168.1.41 (a slave) and
  • 192.168.1.1 (the correct master)

the NCP server to be configured is 192.168.1.147 .

There are some warnings “delete port mapping failed”, but they shouldn’t be a problem, I think. The last two paragraphs clearly state that the port mapping has been successful.

Now, a couple of days ago, after a page refresh, I could see the following contents on the NCP’s system info page:

port check 80	closed
port check 443	closed

Which seeed reasonable, as I was able to connect from the internet using the modified ports.

But now, the settings seem to have been changed overnight. Even after doing the configuration procedure (see above), I am not able to successfully activate the non-standard port settings. Sometimes I see:

port check 80	open
port check 443	open

and sometimes

port check 80	closed
port check 443	open

So, I guess something did and does a reset of my port settings back to the standard values.

Is there a feature within the NextCloud service which automatically does this? And is there a possibility to disable this feature in order for me to have the non-standard ports open permanently?

Is there maybe another possible reason why the system tries to keep me from successfully and permanently change the ports?

This is my config.php (I don’t see anything wrong, here):

passwordsalt	xxx
secret	xxx
trusted_domains	
0	localhost
5	nextcloudpi.local
7	nextcloudpi
8	nextcloudpi.lan
11	95.116.141.16
1	192.168.1.147
4	xxx
datadirectory	/media/SSD120GB/ncdata
dbtype	mysql
version	20.0.2.2
overwrite.cli.url	http://localhost
dbname	nextcloud
dbhost	localhost
dbport	
dbtableprefix	oc_
mysql.utf8mb4	1
dbuser	ncadmin
dbpassword	xxx
installed	1
instanceid	ocwn0g3teaag
memcache.local	\OC\Memcache\Redis
memcache.locking	\OC\Memcache\Redis
redis	
host	/var/run/redis/redis.sock
port	0
timeout	0
password	xxx
tempdirectory	/media/SSD120GB/ncdata/tmp
mail_smtpmode	sendmail
mail_smtpauthtype	LOGIN
mail_from_address	admin
mail_domain	ownyourbits.com
preview_max_x	2048
preview_max_y	2048
jpeg_quality	60
overwriteprotocol	https
maintenance	
trusted_proxies	
0	192.168.1.1

Where do I find in-depth information about the whole process and implementation of NextCloud’s port handling with regard to the associated NCP tools like “nc-port-forwarding”? Where would I start looking for the implementation?

Any hint on this issue?