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

Ability to change the ssh port forwarding interface #134

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ejdre-vestas
Copy link

@ejdre-vestas ejdre-vestas commented Jul 10, 2024

Motivation

While trying to run the virtual-box-iso builder on a WSL2 environment, I had issues getting the WSL2 to connect to the VirtualBox running on the Windows host through SSH.

This is because a connection coming from WSL is not considered a local connection (at least when using the default NAT networkingMode on WSL) and the virtual box is hard coded to port forward request coming on 127.0.0.1.

Changes

Added the property ssh_listen_address which makes it possible for clients to specify the address where the SSH port forwarding will be set to listen on.

Dependency

This pull-request depends on hashicorp/packer-plugin-sdk#257 since it was used to generate the documentation for the http_network_protocol property and to test the overall changes.

@ejdre-vestas
Copy link
Author

"Go validate" action will fail until the dependency is merged.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Hi @ejdre-vestas,

Thanks for this PR as well!

I have a comment that's quite similar to the one I left on your SDK PR, I would suggest making this a string, so users can specify whichever address is relevant to them, but aside from this nit, this looks good to me.

I'll let you address this when possible and I'll do another pass of review then.

Thanks!

@@ -26,6 +26,9 @@ type CommConfig struct {
// does not setup forwarded port mapping for communicator (SSH or WinRM) requests and uses ssh_port or winrm_port
// on the host to communicate to the virtual machine.
SkipNatMapping bool `mapstructure:"skip_nat_mapping" required:"false"`
// Defaults to false. When enabled, the ssh port forwarding will be set to listen on 0.0.0.0
// as opposed to 127.0.0.1
SSHListenOnAllInterfaces bool `mapstructure:"ssh_listen_on_all_interfaces" required:"false"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could specify the listening address to be whatever we choose here instead of this flag?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @lbajolet-hashicorp,

Thanks again for the comments. I have pushed a new commit.

@ejdre-vestas ejdre-vestas changed the title Ability to port forward ssh for all interfaces Ability to change the ssh port forwarding interface Aug 19, 2024
@ejdre-vestas
Copy link
Author

ejdre-vestas commented Dec 19, 2024

Hi, any chance to get this pull-request looked at again? I believe I have done all the requested changes.

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

Successfully merging this pull request may close these issues.

2 participants