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

feat: Implement password protection #175

Merged
merged 3 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM debian:trixie-slim

ARG VERSION_ARG="0.0"
ARG VERSION_VNC="1.5.0"
ARG VERSION_VNC="1.6.0-beta"

ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN="true"

RUN set -eu && \

Check failure on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / Test / shellcheck

SC2035 info: Use ./*glob* or -- *glob* so names with dashes won't become options.
apt-get update && \
apt-get --no-install-recommends -y install \
tini \
Expand All @@ -34,7 +34,6 @@
tar -xf /tmp/novnc.tar.gz -C /tmp/ && \
cd "/tmp/noVNC-${VERSION_VNC}" && \
mv app core vendor package.json *.html /usr/share/novnc && \
sed -i "s|UI\.initSetting('path', 'websockify')|UI.initSetting('path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify')|" /usr/share/novnc/app/ui.js && \
unlink /etc/nginx/sites-enabled/default && \
sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \
echo "$VERSION_ARG" > /run/version && \
Expand All @@ -46,7 +45,9 @@
ADD --chmod=664 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/js/script.js /var/www/js/script.js
ADD --chmod=664 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/css/style.css /var/www/css/style.css
ADD --chmod=664 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/img/favicon.svg /var/www/img/favicon.svg
ADD --chmod=744 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/nginx.conf /etc/nginx/sites-enabled/web.conf
ADD --chmod=664 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/conf/defaults.json /usr/share/novnc
ADD --chmod=664 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/conf/mandatory.json /usr/share/novnc
ADD --chmod=744 https://raw.githubusercontent.com/qemus/qemu-docker/master/web/conf/nginx.conf /etc/nginx/sites-enabled/web.conf

VOLUME /storage
EXPOSE 22 5900 8006
Expand Down
10 changes: 10 additions & 0 deletions src/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if [ -z "${CPU// /}" ] && grep -qi "model:" <<< "$CPI"; then
fi

CPU="${CPU// CPU/}"
CPU="${CPU// 8 Core/}"
CPU="${CPU// 16 Core/}"
CPU="${CPU// 32 Core/}"
CPU="${CPU// 64 Core/}"
Expand Down Expand Up @@ -245,6 +246,15 @@ hasDisk() {
return 1
}

user="admin"
pass="$user"

[ -n "${USER:-}" ] && user="${USER:-}"
[ -n "${PASS:-}" ] && pass="${PASS:-}"

# Set password
echo "$user:{PLAIN}$pass" > /etc/nginx/.htpasswd

# Start webserver
cp -r /var/www/* /run/shm
html "Starting $APP for Docker..."
Expand Down