Unverified Commit abe80c7b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Implement password protection (#645)

parent 1e9195d5
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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/}"
@@ -251,6 +252,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..."
+60 −0
Original line number Diff line number Diff line
@@ -56,3 +56,63 @@ server {
    }

}

server {

    listen 8007;
    auth_basic "NoVNC";
    auth_basic_user_file /etc/nginx/.htpasswd;
        
    autoindex on;
    tcp_nodelay on;
    server_tokens off;
    absolute_redirect off;

    error_log /dev/null;
    access_log /dev/null;

    include /etc/nginx/mime.types;

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 5;
    gzip_min_length 500;
    gzip_disable "msie6";
    gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

    add_header Cache-Control "no-cache";

    location / {

      root /run/shm;

      if ( -f /run/shm/index.html) {
        break;
      }

      try_files /index.html @vnc;
    }

    location @vnc {

      root /usr/share/novnc;
      index vnc.html;

    }

    location /websockify {

      proxy_http_version 1.1;

      proxy_set_header Connection 'upgrade';
      proxy_set_header Upgrade $http_upgrade;

      proxy_buffering off;
      proxy_read_timeout 3600s;
      proxy_send_timeout 3600s;

      proxy_pass http://127.0.0.1:5700/;
    }

}