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

Makes builder to respect ssh_proxy_* configuration #62

Merged
merged 1 commit into from
Dec 22, 2021

Conversation

sparshev
Copy link
Contributor

In general those changes allows us to use proxy in order to check the address given it by vmware dhcpd. The changes are rip-off of the original plugin SDK: https://github.com/hashicorp/packer-plugin-sdk/blob/main/communicator/step_connect_ssh.go#L109

The catch here: in general under perfect conditions this change are not needed, because VMware Fusion/workstation connects locally, but if we're using corporate VPN which redirects all the traffic (but localhost) to the corporate network - we can't reach the VM anymore. I found just one way to do so relatively simple: by using SO_DONTROUTE which skips the routing table and allows to communicate directly to the interfaces. So any simple (python/go) proxy with remote.setsockopt(socket.SOL_SOCKET, socket.SO_DONTROUTE, 1) will allow to communicate to VM. In order to not break any compatibility proxy interface looks good - after the packer verified the IP address we can move on to ansible provisioner and through the packer provided proxy (or http_proxy env variable) control the transport to the VM.

@sparshev sparshev requested a review from a team as a code owner December 20, 2021 20:49
Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, this LGTM, I wish we could be re-using that code instead of copying it !

@azr azr merged commit 50602c0 into hashicorp:main Dec 22, 2021
@hashicorp hashicorp locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants