diff --git a/Dockerfile b/Dockerfile index c92e431..b73208a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apk add --no-cache \ py3-pip \ py3-virtualenv \ uuidgen \ + caddy \ && mkdir -p /usr/share/novnc \ && wget https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.tar.gz -O /tmp/novnc.tar.gz -q \ && tar -xf /tmp/novnc.tar.gz -C /tmp/ \ diff --git a/docker-compose.yml b/docker-compose.yml index ec7590c..e8879d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,8 @@ services: # Define which physical or virtual interfaces shall be attach direct to OpenWrt #WAN_IF: "enx00e04c0407a6" #LAN_IF: "enx00e04d68033f" - LAN_IF: "veth" # veth pair between OpenWrt and host system + #LAN_IF: "veth" # veth pair between OpenWrt and host system + #FORWARD_LUCI: "true" # Make LuCI OpenWrt web interface accessible via host LAN # USB passthrough # Format : like 'lsusb' is given diff --git a/src/helpers.sh b/src/helpers.sh index 41ce606..9cc5082 100644 --- a/src/helpers.sh +++ b/src/helpers.sh @@ -13,5 +13,6 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR : "${LAN_IF:=""}" # Physical LAN interface name : "${USB_VID_1:=""}" # USB vendor ID : "${USB_PID_1:=""}" # USB product ID +: "${FORWARD_LUCI:=""}" # Make LuCI OpenWrt web interface accessible via host LAN : "${IS_U_OS_APP:=""}" # By default this container is not a u-OS app : "${DEBUG:="N"}" # Disable debugging diff --git a/src/init_container.sh b/src/init_container.sh index 50ed071..4677bb9 100644 --- a/src/init_container.sh +++ b/src/init_container.sh @@ -57,3 +57,13 @@ supervisorctl start nginx # Start webserver # ******* OpenWrt handling ******* supervisorctl start openwrt # Start openwrt + +# ******* LuCi forwarding handling ******* +if [[ $FORWARD_LUCI = "true" ]]; then + if [[ $LAN_IF = "veth" ]]; then + info "Enable LuCI forwading to host LAN at port 9000" + supervisorctl start caddy # Start reverse proxy + else + error "LuCI forwading is only available if enviroment variable is set to LAN_IF: 'veth'" + fi +fi diff --git a/supervisord.conf b/supervisord.conf index 186a71b..ebf63d5 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -41,4 +41,9 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -stopasgroup=true \ No newline at end of file +stopasgroup=true + +[program:caddy] +command=nsenter --target 1 --uts --net --ipc caddy reverse-proxy --from :9000 --to 192.168.1.1:80 +process_name=%(program_name)s +autostart=false