Skip to content

Commit

Permalink
squash: env; SSH_PASS; -BlacklistThreshold=3 -BlacklistTimeout=1
Browse files Browse the repository at this point in the history
---
ChangeMe3

-BlacklistThreshold=3 -BlacklistTimeout=1

# clearPass: if not default

bunsen-papirus-icon-theme_10.3-2_all.deb

env |grep -v PASS;

/etc/envir PASS; headless SSHPASS

/etc/environment: drop pass

sd

  echo abc; \

ver=box07

s

up

VNCPassReadOnly: `View123`

echo "$SSH_PASS:$SSH_PASS" |chpasswd

default: SSH_PASS=headless, VNC_PASS=headless, VNC_PASS_RO=View123
  • Loading branch information
sam authored and huapox committed Aug 7, 2021
1 parent d7e14e5 commit 6864402
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 28 deletions.
5 changes: 3 additions & 2 deletions DE/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ services:
container_name: xserver
restart: always
environment:
- VNC_RW=headless
- VNC_RO=View123
- SSH_PASS=headless
- VNC_PASS=headless
- VNC_PASS_RO=View123
# - VNC_OFFSET=0
# - VNC_LIMIT=3
- TZ=Asia/Shanghai
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ By `XRDP/NOVNC` with `XFCE4` based on `Debian`, Formatting a HeadlessBox/Cloud D
**QuickStart**

```bash
# example1: quickStart
# example1: quickStart, default: SSH_PASS=headless, VNC_PASS=headless, VNC_PASS_RO=View123
docker run -it --rm --shm-size 1g --net=host infrastlabs/docker-headless:full

# example2: VNC_RW=ChangeMe, VNC_RO=View123
# Caution: Please change the SSHPass when the Box started!!!
# example2: SSH_PASS=ChangeMe1, VNC_PASS=ChangeMe2, VNC_PASS_RO=ChangeMe3
vols="""
-v /_ext:/_ext
-v /opt:/opt
-v /var/run/docker.sock:/var/run/docker.sock
"""
docker run -d --name=devbox --privileged --shm-size 1g --net=host \
-e L=zh_CN -e VNC_RW=ChangeMe -e VNC_RO=View123 $vols infrastlabs/docker-headless:full
-e L=zh_CN -e SSH_PASS=ChangeMe1 -e VNC_PASS=ChangeMe2 -e VNC_PASS_RO=ChangeMe3 $vols infrastlabs/docker-headless:full

# 290.545 MB
docker container update --restart=always devbox
Expand All @@ -46,7 +45,7 @@ docker container update --restart=always devbox
**Detail**

- Size: latest: `168.347 MB`, slim: `88.929 MB`, full: `289.581 MB`
- User: `headless`, SSHPass: `headless`, VNCPass: `headless`
- User: `headless`, SSHPass: `headless`, VNCPass: `headless`, VNCPassReadOnly: `View123`
- Ports
- novnc 6080 > 10081
- xrdp 3389 > 10089
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ services:
container_name: headless
restart: always
environment:
- VNC_RW=headless
- VNC_RO=View123
- SSH_PASS=headless
- VNC_PASS=headless
- VNC_PASS_RO=View123
# - VNC_OFFSET=0
# - VNC_LIMIT=3
- TZ=Asia/Shanghai
Expand Down
9 changes: 5 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
**Env**

```bash
# ENV (default); VNC_RW=headless, VNC_RO=View123;
# ENV (default); SSH_PASS=headless, VNC_PASS=headless, VNC_PASS_RO=View123;
SSH_PORT=10022 \
RDP_PORT=10089 \
VNC_PORT=10081 \
SSH_PASS=headless \
VNC_PASS=headless \
VNC_PASS_RO=View123
# L=zh_CN \
TZ=Asia/Shanghai \
VNC_RW=headless \
VNC_RO=View123
TZ=Asia/Shanghai
```

**Apps**
Expand Down
8 changes: 4 additions & 4 deletions img_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo "${DOCKER_REGISTRY_PW_infrastSubUser2}" |docker login --username=${DOCKER_R
ns=infrastlabs
# cache="--no-cache"
# pull="--pull"
ver=box06 #02: +full; 04: bins;
ver=box07 #02: +full; 04: bins;

cmd="$1"
case "$cmd" in
Expand Down Expand Up @@ -45,7 +45,7 @@ case "$cmd" in
;;
*)
# SLIM
img="docker-headless:$ver-slim"
img="docker-headless:$ver-slim" && echo -e "\n\nimg: $img"
docker build $cache $pull -t $repo/$ns/$img -f src/Dockerfile .
docker push $repo/$ns/$img
docker tag $repo/$ns/$img $repo/$ns/docker-headless:slim
Expand All @@ -57,7 +57,7 @@ case "$cmd" in
# docker push $ns/docker-headless:slim

# AUDIO=true
img="docker-headless:$ver"
img="docker-headless:$ver" && echo -e "\n\nimg: $img"
docker build $cache $pull -t $repo/$ns/$img --build-arg AUDIO=true -f src/Dockerfile .
docker push $repo/$ns/$img
docker tag $repo/$ns/$img $repo/$ns/docker-headless:latest #latest
Expand All @@ -69,7 +69,7 @@ case "$cmd" in
# docker push $ns/docker-headless:latest

# FULL=/.. #for COPY
img="docker-headless:$ver-full"
img="docker-headless:$ver-full" && echo -e "\n\nimg: $img"
docker build $cache $pull -t $repo/$ns/$img --build-arg AUDIO=true --build-arg FULL=/.. -f src/Dockerfile .
docker push $repo/$ns/$img
docker tag $repo/$ns/$img $repo/$ns/docker-headless:full
Expand Down
10 changes: 6 additions & 4 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ ENV \
SSH_PORT=10022 \
RDP_PORT=10089 \
VNC_PORT=10081 \
# HEADLESS=headless \ #just static username.
SSH_PASS=headless \
VNC_PASS=headless \
VNC_PASS_RO=View123 \
VNC_OFFSET=0 \
VNC_LIMIT=1 \
# L=zh_CN
TZ=Asia/Shanghai \
VNC_RW=headless \
VNC_RO=View123
# L=zh_CN \
TZ=Asia/Shanghai


# +headless
Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile.box04
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ ENV \
VNC_PORT=10081 \
VNC_OFFSET=0 \
VNC_LIMIT=1 \
VNC_RW=passwd!@# \
VNC_RO=passwd
VNC_PASS=passwd!@# \
VNC_PASS_RO=passwd


# +headless
Expand Down
1 change: 1 addition & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
apt.sh tigervnc-common #66.6 kB
echo -e "123456a\n123456a\ny\n345678\n345678" |vncpasswd vnc_pass2

# Xvnc: -BlacklistThreshold=3 -BlacklistTimeout=1
```
13 changes: 10 additions & 3 deletions src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sed -i "s/EFRp 22/EFRp ${SSH_PORT}/g" /etc/supervisor/conf.d/xrdp.conf #sv.conf
# Dump environment variables
# https://hub.fastgit.org/hectorm/docker-xubuntu/blob/master/scripts/bin/container-init
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
env | grep -Ev '^(PWD|OLDPWD|HOME|USER|SHELL|TERM|([^=]*(PASSWORD|SECRET)[^=]*))=' \
env | grep -Ev '^(.*PASS.*|PWD|OLDPWD|HOME|USER|SHELL|TERM|([^=]*(PASSWORD|SECRET)[^=]*))=' \
|grep -v "LOC_\|DEBIAN_FRONTEND" | sort > /etc/environment
# # Make sesman read environment variables
# RUN printf '%s\n' 'session required pam_env.so readenv=1' >> /etc/pam.d/xrdp-sesman
Expand Down Expand Up @@ -143,6 +143,9 @@ chansrvport=DISPLAY($N)
rm -f /tmp/xrdp-sesOne*.conf
cat /etc/xrdp/xrdp.ini |grep "^\[Xvnc"

# clearPass: if not default
sed -i "s/password=askheadless/password=ask/g" /etc/xrdp/xrdp.ini
sed -i "s/value=\"headless\"/value=\"\"/g" /usr/local/novnc/index.html
}
setVnc

Expand Down Expand Up @@ -188,7 +191,11 @@ if [ ! -z "$(dpkg -l |grep locales)" ]; then #if locale installed. ##which local
test -z "$L" && setLocale_en_US || setLocale
fi

# VNC_PASS: ro??
# SSH_PASS, SSH_PASS, SSH_PASS_RO
echo "headless:$SSH_PASS" |chpasswd
# echo "passwd" | vncpasswd -f >> /etc/xrdp/vnc_pass; chmod 600 /etc/xrdp/vnc_pass
echo -e "$VNC_RW\n$VNC_RW\ny\n$VNC_RO\n$VNC_RO" |vncpasswd /etc/xrdp/vnc_pass; chmod 644 /etc/xrdp/vnc_pass
echo -e "$VNC_PASS\n$VNC_PASS\ny\n$VNC_PASS_RO\n$VNC_PASS_RO" |vncpasswd /etc/xrdp/vnc_pass; chmod 644 /etc/xrdp/vnc_pass

# sv
echo -e "\n\n\nStarting..." && sleep 2
exec supervisord -n
2 changes: 1 addition & 1 deletion src/xrdp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ redirect_stderr=true
environment=DISPLAY=:0,HOME=/home/headless,USER=headless,SHELL=/bin/bash,TERM=xterm
priority=45
user=headless
command=bash -c "env; test -f /usr/bin/xfce4-session && exec startxfce4 || exec startfluxbox"
command=bash -c "env |grep -v PASS; test -f /usr/bin/xfce4-session && exec startxfce4 || exec startfluxbox"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
3 changes: 2 additions & 1 deletion src/xvnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pulseaudio --exit-idle-time=-1 &
export DISPLAY=$1 #:2
/usr/local/xrdp/sbin/xrdp-chansrv &

exec Xvnc -ac $1 -listen tcp -rfbauth=/etc/xrdp/vnc_pass -depth 16
# default: Xvnc :99 -BlacklistThreshold=5 -BlacklistTimeout=10
exec Xvnc -ac $1 -listen tcp -rfbauth=/etc/xrdp/vnc_pass -depth 16 -BlacklistThreshold=3 -BlacklistTimeout=1
# sleep 2
# sudo xrdp -n & #rootRun

0 comments on commit 6864402

Please sign in to comment.