packer-plugin-proxmox icon indicating copy to clipboard operation
packer-plugin-proxmox copied to clipboard

Firewall / http_bind_address forwarding forwarding

Open egandro opened this issue 2 months ago • 3 comments

I have a question about the web server that is built in into Packer.

The http_bind_address (and friends) can be used for accessing files from proxmox to the build machine e.g. http://{{ .HTTPIP }}:{{ .HTTPPort }}.

In case you are using promox in a datacenter. the build machine might not be available.

My current workaround is:

# forward 127.0.0.1:8000 to the remote proxmox to 127.0.0.1:8000
ssh -N -R 127.0.0.1:8000:127.0.0.1:8000 root@proxmox

And set

http_bind_address = 127.0.0.1
http_port_min = 8000
http_port_max  = 8000

This works - however - this now requires ssh to be available. Which might be also not the case.

Question:

  • Is there any workaround for this?
  • Can we add some http_forward_from_build_host = true flag to this plugin?

egandro avatar Oct 25 '25 11:10 egandro

I think there is really no nice solution here, since the Proxmox API that the packer plugin is using, doesn't allow any code execution.

Maybe using a 3rd computer as a light house is a workaround.

  1. Proxmox connects (via SSH + port forwarding) to computer L and does 127.0.0.1:8000:127.0.0.1:8000
  2. Build computer connects (via SSH + port forwarding) to computer L and does 127.0.0.1:8000:127.0.0.1:8000

Now http://{{ .HTTPIP }}:{{ .HTTPPort }} works.

egandro avatar Oct 25 '25 11:10 egandro

Yes, I have a "bastion" host (a VM) in a seperate network with a firewall port rules for that HTTP port, on that VM is running the gitlab runner / packer and builts. You would need to open a firewall port, either that HTTP port or SSH in your case.

TuncTaylan avatar Oct 30 '25 22:10 TuncTaylan

I have a solution:

https://github.com/Pumba98/proxmox-packer-templates?tab=readme-ov-file#packer-webserver-forwarding

It works for both cases.

  • You can connect to your proxmox server via SSH.
  • You can't connect to your proxmox server via SSH - but the build host and the proxmox host can connect to a lighthouse.

It's sweet and simple.

Should we close this question? Do you think it would make sense to document the ideas in the packer-plugin-proxmox?

egandro avatar Oct 31 '25 21:10 egandro