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

Add support for http_interface #245

Closed
alandsidel opened this issue Jan 27, 2023 · 3 comments
Closed

Add support for http_interface #245

alandsidel opened this issue Jan 27, 2023 · 3 comments

Comments

@alandsidel
Copy link

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Some providers support http_interface in addition to the other http_ options. This is desirable functionality.

Use Case(s)

Packer is being run on disparate machines with multiple non-loopback interfaces that do not have static IPs, making use of http_bind_address cumbersome.

In particular this would be useful for users running packer on a machine that is sometimes on-prem and connected directly to the corporate network, and at other times is off-prem and connecting with a VPN tunnel.

Using http_bind_address as a workaround does work, but it's more cumbersome to look up your dynamic address each time than to simply enter the easy to remember name of the appropriate interface.

Potential configuration

As in existing plugins that support the feature

http_interface = "vmx0" // or tun0, eth0, ens160, etc.

Potential References

hashicorp/packer#10168

@tenthirtyam tenthirtyam changed the title Add support for http_interface Add support for http_interface Jan 27, 2023
@alandsidel
Copy link
Author

Upon further investigation, I believe that both options are present but simply being ignored. http_bind_address and http_interface can both be used in the configuration, and having both at the same time results in the same error as expected -- however regardless of what you set either one to, the plugin seems to ignore the setting and use the normal selection method.

In my test environment I have a Ubuntu 20 VM which has an address of 192.168.128.54/24 on eth0 and 192.168.122.16/24 on tun0. Setting http_interface = "tun0" or http_bind_address = "192.168.122.16" both result in the output during packer build of HTTP server is working at http://192.168.128.54:40251/

The http_port_min and http_port_max options are clearly working.

@alandsidel
Copy link
Author

A bit of further investigation.

http_bind_address does seem to be working, and netstat -anl shows it listening on the specified address, even though the HTTP server is working at... message shows the wrong address. Unfortunately the incorrect address is not just being printed on the console, but is the address the remote side is being instructed to connect to.

Meanwhile, http_interface causes the module to listen on all interfaces rather than the specified one, which would work as a workaround if nothing else is using the port on any interface, but it only listens on the ipv6 socket.

@alandsidel
Copy link
Author

Closed in favor of bug #247

@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

No branches or pull requests

1 participant