tabernarious / f5-automated-backup-iapp

F5 iApp for automated backups to the local device and to network locations.
35 stars 26 forks source link

Can't specify ftp port #39

Open Itzikc78 opened 1 year ago

Itzikc78 commented 1 year ago

Is it possible to specify another ftp port other than the default 21? Looked for it in the code and didn't find the way to doit.

Itzikc78 commented 1 year ago

I found the correct line to to it. In my case I want to open ftp cnnection on port 2121 so I chnaged this line accordingly - (ftp -n \${server} 2121

exec echo -e "ftp_function()\n{\n\tf5masterkey=\$(f5mku -K)\n\tusername=\$(echo \"ENCRYPTEDUSERNAME\" | openssl aes-256-ecb -salt -a -A -d -k \${f5masterkey})\n\tpassword=\$(echo \"ENCRYPTEDPASSWORD\" | openssl aes-256-ecb -salt -a -A -d -k \${f5masterkey})\n\t# Escape every character for safe submission of special characters in the password\n\tpassword_escaped=\$(echo \${password} | sed \'s/./\\\\\\&/g\')\n\tserver=\$(echo \"ENCRYPTEDSERVER\" | openssl aes-256-ecb -salt -a -A -d -k \${f5masterkey})\n\tdirectory=\$(echo \"ENCRYPTEDDIRECTORY\" | openssl aes-256-ecb -salt -a -A -d -k \${f5masterkey})\n\n\tif \[ \"BACKUPFILENAMEEXTENSION_NODOT\" == \"scf\" \]\n\tthen\n\t\tftp_return=\$(ftp -n \${server} 2121 << END_FTP\nquote USER \${username}\nquote PASS \${password_escaped}\nbinary\nput BACKUPDIRECTORY/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT \${directory}/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT\nput BACKUPDIRECTORY/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT.tar \${directory}/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT.tar\nquit\nEND_FTP\n)\n\telse\n\t\tftp_return=\$(ftp -n \${server} 2121 << END_FTP\nquote USER \${username}\nquote PASS \${password_escaped}\nbinary\nput BACKUPDIRECTORY/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT \${directory}/${fname_noext}BACKUPFILENAMEEXTENSION_WITHDOT\nquit\nEND_FTP\n)\n\tfi\n\n\tif \[ \"\$ftp_return\" == \"\" \]\n\tthen\n\t\treturn 0\n\telse\n\t\techo \"\$ftp_return\" >> /var/tmp/scriptd.out\n\t\treturn 1\n\tfi\n}\n\nftp_function\n" > $scriptfile exec chmod +x $scriptfile

tabernarious commented 1 year ago

Yes, that should work to edit your iApp template manually.