quickemu-project / quickemu

Quickly create and run optimised Windows, macOS and Linux virtual machines
MIT License
10.97k stars 480 forks source link

unable to configure port forwarding for :443 #963

Closed orzechowskid closed 7 months ago

orzechowskid commented 8 months ago

Expected behaviour

Actual behaviour

VM fails to boot and exits with code 1

Steps to reproduce the behaviour

  1. install quickemu on host
  2. install OSX Monterey as guest
  3. edit macos-monterey.conf and add the following line to enable port forwarding of :443 : port_forwards=("443:443")

Quickemu output

Quickemu 4.9.1 using /usr/bin/qemu-system-x86_64 v7.0.0
 - Host:     Ubuntu 22.04.4 LTS running Linux 6.5 (XPS-13-9310)
 - CPU:       11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
 - CPU VM:   1 Socket(s), 1 Core(s), 2 Thread(s), 8G RAM
 - MSR:      WARNING! Ignoring unhandled Model-Specific Registers is disabled.

             echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

             If you are unable to run macOS or Windows VMs then run the above 👆
             This will enable ignoring of unhandled MSRs until you reboot the host.
             You can make this change permanent by running: 'quickemu --ignore-msrs-always'
 - BOOT:     EFI (macOS), OVMF (OVMF_CODE.fd), SecureBoot (off).
 - Disk:     macos-monterey/disk.qcow2 (96G)
 - Display:  SDL, qxl-vga, GL (on), VirGL (off)
 - Sound:    intel-hda
 - ssh:      On host:  ssh user@localhost -p 22220
 - PORTS:    Port forwards requested:
              - 443 => 443
 - 9P:       On guest: sudo mount_9p Public-myuser
 - 9P:       On host:  chmod 777 /home/myuser/Public
             Required for macOS integration 👆
 - Network:  User (virtio-net)
 - Monitor:  On host:  nc -U "macos-monterey/macos-monterey-monitor.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:macos-monterey/macos-monterey-monitor.socket
 - Serial:   On host:  nc -U "macos-monterey/macos-monterey-serial.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:macos-monterey/macos-monterey-serial.socket
qemu-system-x86_64: -netdev user,hostname=macos-monterey,hostfwd=tcp::22220-:22,hostfwd=tcp::443-:443,hostfwd=udp::443-:443,id=nic: Could not set up host forwarding rule 'udp::443-:443'
cat: macos-monterey/macos-monterey.pid: No such file or directory
 - Process:  Starting ./macos-monterey.conf as macos-monterey ()

Linux Distribution & Kernel

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy
Linux XPS-13-9310 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
orzechowskid commented 8 months ago

I should note that the guest OS boots just fine when using the example from the quickemu documentation: port_forwards=("8123:8123" "8888:80")

and another unprivileged port also seems to work fine: port_forwards=("3000:3000")

celsobenedetti commented 8 months ago

I'm getting the same. The error here seems to be that the quickemu command will fail if the host port is occupied (not exclusive to 443)

I've tried to do port_forwards=("8080:8080") so that I can access my localhost:8080 web server from the guest machine.

However, if localhost:8080 is occupied by the web server, quickemu --vm ./macos-ventura.conf will fail. If the port is free, quickemu will run normally.

I'm wondering if it is possible to access an occupied port from the host machine from guest.

flexiondotorg commented 7 months ago

Quickemu runs in the user context, therefore, an unprivileged user account. Unpriviledged accounts are not able to bind to ports <= 1024.

You should bind a port > 1024 on the host to 443 on the guest:

port_forwards=("8443:443")

itdsntwork commented 1 month ago

I'm getting the same. The error here seems to be that the quickemu command will fail if the host port is occupied (not exclusive to 443)

I've tried to do port_forwards=("8080:8080") so that I can access my localhost:8080 web server from the guest machine.

However, if localhost:8080 is occupied by the web server, quickemu --vm ./macos-ventura.conf will fail. If the port is free, quickemu will run normally.

I'm wondering if it is possible to access an occupied port from the host machine from guest.

I am having the same issue. Did you find a solution?