-
Notifications
You must be signed in to change notification settings - Fork 779
v9.1.0.0p1-Beta scp behaviour change breaks packer #2018
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
Comments
There is no way to disable the mark of the web, but it is intended to be a best effort attempt, so
Since Packer seems to be using verbose mode - is this set automatically by Packer, or is there a way to override?
Are there any messages in the SFTP logs regarding |
I'm not sure what is setting the ssh/scp verbose mode, so I've created a simple go program at https://github.com/rgl/use-packer-scp that uses the internal packer scp client to reproduce the problem, and it also behaves like in packer, so we can now easily reproduce the problem. This is what it returns, which is the same as my initial message:
Please note that the file is successfully uploaded to the remote machine, but there is something checked by the packer ssh/scp communicator that breaks its expectation. |
Hi, Packer dev here. We've had a report from another user hitting this same problem, they opened an issue in the Amazon plugin for Packer: hashicorp/packer-plugin-amazon#305 From what I gather here, the logs aren't the problem, we don't rely on this to determine if the transfer was successful or not, but on the return code of the command, if non-zero, we assume there's been an error, and fail the step. Packer invokes scp with the The file upload code itself being here: https://github.com/hashicorp/packer-plugin-sdk/blob/main/sdk-internals/communicator/ssh/communicator.go#L880 Now looking at the code, this does not seem to be a case of failure, is it? Is there a reason why this implementation of scp returns a non-zero code if the transfer succeeds? |
TLDR; the open PR will address these concerns, as MOTW will no longer affect the SCP exit code status in verbose mode (-v).
Initially, it was a matter of being able to print the debug message, which was only to be done in verbose mode. Since it is currently being printed using
If I understand the question correctly - no, Windows should not prevent a script from being executed if MOTW is not present. MOTW is intended to be a defense-in-depth security feature, which is why we make a best effort attempt to include it, but if we cannot, then the file transfer still proceeds. Windows will look for the MOTW, but it will not make any assumptions about the file, if it is not there. Also, in the case that the MOTW is there, and Windows blocks the file, simply run the Unblock-File cmdlet in PowerShell. |
Perfect, thanks for the speedy response, much appreciated! Regarding the PR, do you think this will get backported and released in an upcoming release? In the meantime it seems the |
We don't typically backport bug fixes for beta releases, but yes this will be fixed in the next release - and thanks! |
This is now working with https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v9.2.0.0p1-Beta Thank you! I'm closing this issue since its now fixed. |
Prerequisites
Steps to reproduce
scp
, e.g.:FWIW, we can workaround this in our packer template with
ssh_file_transfer_method = "sftp"
, but that does not seem to be the correct way of handling this.Expected behavior
Expected scp to work in
packer
.Actual behavior
The packer output shows:
The packer logs show:
I think this is due to extraneous output now being returned by sshd:
This seems related to:
Is there a way to disable the
add_mark_of_web
feature?Error details
No response
Environment data
Version
v9.1.0.0p1-Beta
Visuals
No response
The text was updated successfully, but these errors were encountered: