Azeez98 commited on
Commit
77c52d8
·
verified ·
1 Parent(s): b123d16

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -11
Dockerfile CHANGED
@@ -1,27 +1,38 @@
1
  # Use the official Kali Linux image
2
  FROM kalilinux/kali-rolling
3
 
 
 
 
4
  # Update and install necessary packages
5
  RUN apt update && apt install -y \
6
  xfce4 xfce4-terminal tightvncserver novnc \
7
  websockify curl wget net-tools \
8
  && apt clean
9
 
10
- # Set up VNC server with default password and desktop environment
11
- RUN mkdir -p ~/.vnc && \
12
- echo "password" | vncpasswd -f > ~/.vnc/passwd && \
13
- chmod 600 ~/.vnc/passwd && \
14
- echo "exec startxfce4" > ~/.vnc/xstartup && \
15
- chmod +x ~/.vnc/xstartup
 
 
 
16
 
17
- # Set USER environment variable
18
- ENV USER=root
 
 
19
 
20
- # Fix permissions for noVNC launch script
21
  RUN chmod +x /usr/share/novnc/utils/launch.sh
22
 
23
- # Expose the VNC and noVNC ports
 
 
 
24
  EXPOSE 8080
25
 
26
- # Start noVNC server on container start
27
  CMD ["bash", "-c", "/usr/share/novnc/utils/launch.sh --vnc localhost:5901 --listen 8080 & tightvncserver :1 && tail -f /dev/null"]
 
1
  # Use the official Kali Linux image
2
  FROM kalilinux/kali-rolling
3
 
4
+ # Switch to root temporarily to install necessary packages
5
+ USER root
6
+
7
  # Update and install necessary packages
8
  RUN apt update && apt install -y \
9
  xfce4 xfce4-terminal tightvncserver novnc \
10
  websockify curl wget net-tools \
11
  && apt clean
12
 
13
+ # Create a non-root user
14
+ RUN useradd -m -s /bin/bash kaliuser && \
15
+ echo "kaliuser:kaliuser" | chpasswd && \
16
+ mkdir -p /home/kaliuser/.vnc && \
17
+ echo "password" | vncpasswd -f > /home/kaliuser/.vnc/passwd && \
18
+ chmod 600 /home/kaliuser/.vnc/passwd && \
19
+ echo "exec startxfce4" > /home/kaliuser/.vnc/xstartup && \
20
+ chmod +x /home/kaliuser/.vnc/xstartup && \
21
+ chown -R kaliuser:kaliuser /home/kaliuser
22
 
23
+ # Set the environment for the new user
24
+ ENV USER=kaliuser
25
+ ENV HOME=/home/kaliuser
26
+ WORKDIR /home/kaliuser
27
 
28
+ # Fix permissions for noVNC
29
  RUN chmod +x /usr/share/novnc/utils/launch.sh
30
 
31
+ # Switch to the non-root user
32
+ USER kaliuser
33
+
34
+ # Expose the noVNC port
35
  EXPOSE 8080
36
 
37
+ # Start noVNC and VNC server on container start
38
  CMD ["bash", "-c", "/usr/share/novnc/utils/launch.sh --vnc localhost:5901 --listen 8080 & tightvncserver :1 && tail -f /dev/null"]