SFTP Backup Timeout

Status
Not open for further replies.

treynolen

Gold Partner
Advanced Certified
Joined
Feb 14, 2019
Messages
42
Reaction score
2
I'm using 16.4 and trying the new SFTP Backup method. I've got two instances doing the same thing. I'm familiar with SSH and keys and I have that working, but it only works when I do a backup manually. The system can log in and view my backups just fine and it can do a manual backup just fine, but when I schedule a backup, I get this error when the backup runs:
--BEGIN
3CX Phone System tried to backup but failed due to the following reason(s):
Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()
at _3cxFilesystemImplementations.SFTP.SftpFileSystem.CreateSftpClient(LocationSettings settings)
at _3cxFilesystemImplementations.SFTP.SftpFileSystem.Move(String filename1, String filename2)
at BackupRestoreSchedule.BackupJob.Execute(IJobExecutionContext context)
--END

I'm not sure why I would get timeouts when the backup runs automatically and not get them when I run it manually. Has anyone else seen this?
 
Is the destination available when the scheduled backup runs? Perhaps its a computer that is off or goes to sleep during the scheduled time window?
 
The receiving server is a production machine that is available 24x7.
 
Hi @treynolen

Schedule a new backup now, don't tick any of the options, just a minimal backup and see if it fails still.
 
I've found the issue. The server is protected by fail2ban which prevents brute force attacks. Although the 3CX has the correct credentials (user and key), it connects and disconnects very rapidly...Even when just going to the backups page to view the settings. This results in fail2ban blocking the IP.
Of course, I could modify fail2ban in such a way that would prevent this, but it does seem that 3CX is connecting too much instead of just using one SFTP session to handle the work. For now, I'm going to change back to our older way of backing up and I hope that the SFTP feature can be tweaked in the future to make it a bit less aggressive to the receiving servers.

Thank you for the assistance.
 
Due to the fact that the system uses SFTP on demand and does not keep the connection alive after it does what it needs to do, you can trigger such a scenario whereby you would make multiple reconnections.

I would recommend to simply whitelist your machine
https://www.fail2ban.org/wiki/index.php/Whitelist
 
Status
Not open for further replies.

Forum statistics

Threads
111,935
Messages
589,823
Members
164,816
Latest member
natedog