From 471d81e501b474863f5bd63e301de8b496df90c6 Mon Sep 17 00:00:00 2001 From: Nunya Bidnezz Date: Sun, 28 Mar 2021 13:04:42 -0500 Subject: [PATCH] Enable PASV mode support for the FTP server. Some cheap Dahua imports require PASV mode when sending FTP event notifications. --- libs/dropInEvents.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/dropInEvents.js b/libs/dropInEvents.js index e134d181..d4435e56 100644 --- a/libs/dropInEvents.js +++ b/libs/dropInEvents.js @@ -193,6 +193,10 @@ module.exports = function(s,config,lang,app,io){ const FtpSrv = require('ftp-srv') const ftpServer = new FtpSrv({ url: config.ftpServerUrl, + // pasv_url must be set to enable PASV; ftp-srv uses its known IP if given 127.0.0.1, + // and smart clients will ignore the IP anyway. Some Dahua IP cams require PASV mode. + // ftp-srv just wants an IP only (no protocol or port) + pasv_url: config.ftpServerUrl.replace(/.*:\/\//, '').replace(/:.*/, ''), log: require('bunyan').createLogger({ name: 'ftp-srv', level: 100