Happyculture / combawa

Helper to set up Drupal projects and build them all along their life.
GNU General Public License v3.0
14 stars 2 forks source link

SCP retrieval with username and password is not working #104

Closed Artusamak closed 10 months ago

Artusamak commented 2 years ago

If you configure the dump retrieval to SCP with a username and password, the scp copy doesn't work.

It looks like the command is not correctly written, we need to double check if it's possible to send the user password as we do it with http calls in a browser. As it stands, we run scp user:pass@host:/path /local which leads to an error saying that "user" is not a valid domain.

Env file settings to reproduce :

COMBAWA_DB_FETCH_METHOD=scp
COMBAWA_DB_FETCH_SCP_USER=username
COMBAWA_DB_FETCH_SCP_PASSWORD='password'
COMBAWA_DB_FETCH_SCP_SERVER="host"
COMBAWA_DB_FETCH_SCP_PORT=22
COMBAWA_DB_FETCH_PATH_SOURCE="/source/path"

Combawa call: combawa -b 0 -f 1 -r 1 -y

DuaelFr commented 1 year ago

It seem to be impossible to pass the password to the scp command like this.

Digging the great Internet I found two options:

  1. using the sshpass command (but that needs to be installed on the computer first)
  2. using curl on the sftp protocol (but I'm not sure that sftp is available everywhere)
Artusamak commented 1 year ago

I had to try to make sftp work in a non interactive way for a project and it ended up not being doable to have the password auth as non interactive. I ended up using sshpass. We could offer scp retrieval with a password only if sshpass is available on the system.

Artusamak commented 1 year ago

Splitting in two issues. This one remains for the removal of the password argument when logging in through SSH. Creating #109 for the sshpass optional support.