IMG-20260516155637122.xfce 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. FROM kalilinux/kali-rolling@sha256:99a8a101fb7c3747f5f55886d0b698e67424c1815d0b70d057643fce620da324
  2. # 更换为USTC源
  3. RUN sed -i 's|http://http.kali.org/kali|http://mirrors.ustc.edu.cn/kali|g' /etc/apt/sources.list && \
  4. apt-get update && \
  5. DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg && \
  6. apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 7D8D0BF6 && \
  7. echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
  8. RUN apt update && \
  9. DEBIAN_FRONTEND=noninteractive apt install -y kali-desktop-xfce kali-linux-default locales sudo
  10. RUN apt update && \
  11. DEBIAN_FRONTEND=noninteractive apt install -y xrdp tigervnc-standalone-server && \
  12. adduser xrdp ssl-cert && \
  13. echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
  14. dpkg-reconfigure --frontend=noninteractive locales && \
  15. update-locale LANG=en_US.UTF-8
  16. ARG USER=testuser
  17. ARG PASS=1234
  18. RUN useradd -m $USER -p $(openssl passwd $PASS) && \
  19. usermod -aG sudo $USER && \
  20. chsh -s /bin/bash $USER
  21. RUN echo "#!/bin/sh\n\
  22. export XDG_SESSION_DESKTOP=xfce\n\
  23. export XDG_SESSION_TYPE=x11\n\
  24. export XDG_CURRENT_DESKTOP=XFCE\n\
  25. export XDG_CONFIG_DIRS=/etc/xdg/xdg-xfce:/etc/xdg\n\
  26. exec dbus-run-session -- xfce4-session" > /xstartup && chmod +x /xstartup
  27. RUN mkdir /home/$USER/.vnc && \
  28. echo $PASS | vncpasswd -f > /home/$USER/.vnc/passwd && \
  29. chmod 0600 /home/$USER/.vnc/passwd && \
  30. chown -R $USER:$USER /home/$USER/.vnc
  31. RUN cp -f /xstartup /etc/xrdp/startwm.sh && \
  32. cp -f /xstartup /home/$USER/.vnc/xstartup
  33. RUN echo "#!/bin/sh\n\
  34. sudo -u $USER -g $USER -- vncserver -rfbport 5902 -geometry 1920x1080 -depth 24 -verbose -localhost no -autokill no" > /startvnc && chmod +x /startvnc
  35. EXPOSE 3389
  36. EXPOSE 5902
  37. ENV PULSE_SERVER=/tmp/PulseServer
  38. ENV WAYLAND_DISPLAY=wayland-0
  39. ENV XDG_RUNTIME_DIR=/tmp/runtime-dir/
  40. ENV DISPLAY=:0
  41. CMD service dbus start; /usr/lib/systemd/systemd-logind & service xrdp start; /startvnc; bash