From 0a0e111167f544b5ac660bc7629be9bb9b34b91f Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Fri, 29 May 2020 22:29:15 +0200 Subject: Serve mirror at unprivileged port 8080 --- install.conf | 4 ++-- run | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/install.conf b/install.conf index bde6b40..a417f93 100644 --- a/install.conf +++ b/install.conf @@ -7,9 +7,9 @@ Setup a user = puffy Password for user = ************* What timezone are you in = UTC Location of sets = http -HTTP Server = 10.0.2.2 +HTTP Server = 10.0.2.1 Unable to connect using https. Use http instead = yes -URL to autopartitioning template for disklabel = http://10.0.2.2/disklabel +URL to autopartitioning template for disklabel = http://10.0.2.1/disklabel Set name(s) = site66.tgz Checksum test for site66.tgz failed. Continue anyway = yes Unverified sets: site66.tgz. Continue without verification = yes diff --git a/run b/run index 7e1d8c0..55ea44f 100755 --- a/run +++ b/run @@ -2,12 +2,12 @@ # Auto-install OpenBSD/amd64 6.6 to a QEMU guest machine. # -# Run the following command to serve the OpenBSD mirror at http://127.0.0.1 -# (port 80): +# Run the following command to serve the OpenBSD mirror at +# http://127.0.0.1:8080: # -# sudo python3 -m http.server \ +# python3 -m http.server \ # --directory ./openbsd-vm/mirror \ -# --bind 127.0.0.1 80 +# --bind 127.0.0.1 8080 # # Pass the following options to ssh or scp to connect to the guest machine: # @@ -39,7 +39,8 @@ # # Port forwardings: # -# host:2222 -> guest:22 +# 10.0.2.1:80 -> host:8080 +# host:2222 -> guest:22 # # Copyright (c) 2020 Stefan Kreutz @@ -113,12 +114,9 @@ then # Wait until the HTTP server is online. # - # TODO: Serve HTTP and TFTP from another virtual machine to remove the - # necessity to bind to a privileged port. Maybe use Linux' tftpd from Arch - # Linux package tftp-hpa. Redirect ports using qemu. - while [ ! "$( curl --silent --location --write-out '%{http_code}\n' --output /dev/null http://127.0.0.1/install.conf )" = 200 ] ; + while [ ! "$( curl --silent --location --write-out '%{http_code}\n' --output /dev/null http://127.0.0.1:8080/install.conf )" = 200 ] ; do - ( >&2 printf "Please serve the directory ./openbsd-vm/mirror at http://127.0.0.1 (port 80).\n" ) + ( >&2 printf "Please serve the directory ./openbsd-vm/mirror at http://127.0.0.1:8080.\n" ) sleep 5 done @@ -141,6 +139,6 @@ qemu-system-x86_64 \ -m "${MEMORY_SIZE}" \ -smp "cpus=${CPU_COUNT}" \ -device e1000,netdev=n1 \ - -netdev user,id=n1,hostname=openbsd-vm,tftp=.openbsd-vm/tftp,bootfile=auto_install,hostfwd=tcp::2222-:22 \ + -netdev "user,id=n1,hostname=openbsd-vm,tftp-server-name=10.0.2.1,tftp=.openbsd-vm/tftp,bootfile=auto_install,hostfwd=tcp::2222-:22,guestfwd=tcp:10.0.2.1:80-cmd:socat - tcp:127.0.0.1:8080" \ -drive "file=${VM_FILE},media=disk,if=virtio" \ -nographic -- cgit v1.2.3