Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up network transfert #274

Closed
Nabil-renault opened this issue Jul 17, 2023 · 9 comments
Closed

Setting up network transfert #274

Nabil-renault opened this issue Jul 17, 2023 · 9 comments

Comments

@Nabil-renault
Copy link

Nabil-renault commented Jul 17, 2023

Hello, what is the config file to set up the network transfer of files, I saw in usbsas-net/src/uploader.rs some reference to http but I would like to know if it is possible to use sftp for the transfer (if yes, I can try to do the modification myself if you tell me where to do them, my first suggestion can be to set up a directory on the machine that is syncronized with the sftp server and use the local transfer to this directory)

@losynix
Copy link
Contributor

losynix commented Jul 17, 2023

Hello,

Indeed, the built-in uploader only supports HTTP. However you can use the command destination to upload files with SFTP.
In the example configuration file, the command destination calls the cp program to save the files in the local disk:

[command]
description = "Save files on disk"
longdescr = "Save out tar in /usbsas_data/"
command_bin = "/bin/cp"
command_args = [
    "%SOURCE_FILE%",
    "/usbsas_data/"
]

You can change the configuration file to call your own program or script to do whatever you want with the files from the transfer.

N.B.: Files transferred using the command or network destination are not analyzed by the antivirus for now (but this will be fixed soon)

@Nabil-renault
Copy link
Author

Hello, thanks for the answer. I did try to do that with the execution of a script of mine but it doesn't work. I do not know why, and to know why I guess that will have to check with systemctl but I can't as my ssh connection do not work anymore after the installation of usbsas (worked right before the reboot at the end). Any clue about that ? (I can use a live boot to get more information)

@losynix
Copy link
Contributor

losynix commented Jul 27, 2023

I have no idea sorry, usbsas packages don't alter network or firewall configuration

@Nabil-renault
Copy link
Author

Hello, sounds like the network issue is fixed on my side, but when I try to use my custom command that upload the file on a sftp server instead of saving it on the machine I get a run error: io error: execution error: Failed to start child cmd but my command that call works with ssh and and I gave to all the user the execution rights on my srcipt. Here's what I changed in the config file : command_bin = "/home/debian/testsftp.sh" command_args = [ "%SOURCE_FILE%" ]

@losynix
Copy link
Contributor

losynix commented Aug 2, 2023

Does it work if you run the command manually as the usbsas user ?
I added a more verbose error if the command fail, can you try with the last version ?

@Nabil-renault
Copy link
Author

I cannot do a su usbsas while connected with ssh, it says "This account is currently not available", I even tried before the final step of the install and it was the same.

Is it possible to update the machine instead of installing it again from scratch ? I mean to get a newer version and/or to apply the modifications of the config file ?

@Nabil-renault
Copy link
Author

Nabil-renault commented Aug 3, 2023

I think that I found the problem, because when i tell usbsas to use sudo -u debian before the name of the script it works (not forgetting to make the right changes in the sudoers file). In fact i tried another method with a script that sends every file that is dropped in the /usbsas_data/ directory to the sftp server, thanks to inotify, and the script is runned by the usbsas user at every boot thanks to a systemd service. And it works ! (I can show you the script if you want).

@losynix
Copy link
Contributor

losynix commented Aug 8, 2023

I cannot do a su usbsas

usbsas is a system account, you can't login with it. You could try running your script as the usbsas user like this: sudo -u usbsas /home/debian/testsftp.sh. Make sure this script is readable and executable by usbsas.

Is it possible to update the machine instead of installing it again from scratch ?

Yes, you only need to update / re-intsall the usbsas packages.

@Nabil-renault
Copy link
Author

Ok thanks, it was a permission issue.

@losynix losynix closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants