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

Failed SFTP write doesn't cause task failure (using ssh-agent) #51

Closed
junglebarry opened this issue Feb 5, 2014 · 2 comments
Closed
Labels

Comments

@junglebarry
Copy link

Hi,

I'm trying to SFTP some files up to a server through an SSH tunnel. The tunnel connects correctly, but my user doesn't have permissions to write the file to the server. (Yes, I should use a privileged user, but that's not the issue here.)

I would expect the sftp task to fail, but instead it succeeds, after printing an error message. This is in --verbose mode:

Connection :: connect
copying foo.zip to /path/foo.zip
>> Error: Permission denied
Connection :: end
Connection :: close

Done, without errors.

I may have misunderstood what you can and cannot do through an ssh-agent connection, but is there any way to force the task to fail under these circumstances?

It's not a problem for manual runs, but I was hoping to use this in an automated deployment system, where discovering failure is imperative.

Here's my config (credentials withheld, obviously):

"sftp": {
  "staging": {
    "options": {
      "ignoreErrors": false, // this didn't seem to work
      "showProgress": true,
      "agent": process.env.SSH_AUTH_SOCK,
      "username": "<%= deployment.username %>",
      "host": "<%= deployment.host %>",
      "path": "<%= deployment.paths.staging %>"
    },
    "files": {
      "<%= pkg.name %>.zip": "<%= pkg.name %>.zip"
    }
  }
}
@davidjbradshaw
Copy link
Contributor

Is the issue that your trying to write to /path/foo.zip, when you want to write to path/foo.zip?

I just submitted a patch that might fix that issue.

@junglebarry
Copy link
Author

Hi @davidjbradshaw I don't believe so. I have a deployment path specified (which is essentially a subdirectory of /tmp on my server) and the files are written relative to that.

My deployments have been working seamlessly until today (I haven't changed anything on my side), but the issue is being raised with different circumstances:

Running "sftp:staging" (sftp) task
Verifying property sftp.staging exists in config...OK
Files: whisk_app_v2.tar.bz2 -> whisk_app_v2.tar.bz2
Options: path="", host=false, username=false, password=false, agent="", port=22, minimatch={}, srcBasePath="", createDirectories=false, directoryPermissions=493, showProgress=false, config="whisk", readyTimeout=30000
Raw Options: path="", host=false, username=false, password=false, agent="", port=22, minimatch={}, srcBasePath="", createDirectories=false, directoryPermissions=493, showProgress=false, config="whisk", readyTimeout=30000
Verifying property sshconfig.whisk exists in config...OK
Options: path="/tmp/", host="MYHOSTGOESHERE", username="MYUSERNAMEGOESHERE", password=false, agent="/tmp/launch-UfG6cf/Listeners", port=22, minimatch={}, srcBasePath="", createDirectories=false, directoryPermissions=493, showProgress, config="whisk", readyTimeout=30000, ignoreErrors=false
Connection :: connect
>> Connection :: error :: Error: Timed out while waiting for handshake
Connection :: close

Done, without errors.

Again, the error is probably something on my side; my concern here is the "Done, without errors" part at the end.

Incidentally, it doesn't seem to be waiting 30000 milliseconds before the timeout occurs - it's more like 10 seconds. I've tried altering that in both my generic config and in sftp-specific setup (as you can see above) to no avail. Should I raise a separate ticket for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants