JAremko / docker-x11-bridge

Simple Xpra X11 bridge to enable GUI with any docker image
GNU General Public License v3.0
179 stars 39 forks source link

How to multiple apps/access and what about security issue - XPRA_PASSWORD seems to be not supported #9

Open ClaudioBsh opened 4 years ago

ClaudioBsh commented 4 years ago

First thanks for a great Image you have created.

Currently i try to find out how easy use with multiple apps and multiple users.

The way currently i found is to start your image n times each with different port and display like this:

Starting 2 times your jare/xqq--bridge

docker run -d \ --name x11-bridge-myapp14 \ -e XPRA_PASSWORD=myapp14 \ -e MODE="tcp" \ -e XPRA_HTML="yes" \ -e DISPLAY=:14 \ -p 10014:10000 \ jare/x11-bridge

docker run -d \ --name x11-bridge-myapp15 \ -e XPRA_PASSWORD=myapp15 \ -e MODE="tcp" \ -e XPRA_HTML="yes" \ -e DISPLAY=:15 \ -p 10015:10000 \ jare/x11-bridge

Then start and display connect each app to one of the previous started jare/x11-bridge containers:

docker run --rm \ --name myapp14 \ --volumes-from x11-bridge-myapp14 \ -d \ -e DISPLAY=:14 \ myapp14

docker run --rm \ --name myapp15 \ --volumes-from x11-bridge-myapp15 \ -d \ -e DISPLAY=:15 \ myapp15

Access to each of them is possible with URL's: http://localhost:10014/index.html?encoding=rgb32 http://localhost:10014/index.html?encoding=rgb32&password=myapp14 http://localhost:10014/index.html?encoding=rgb32&password=wrongpassword

http://localhost:10015/index.html?encoding=rgb32 http://localhost:10015/index.html?encoding=rgb32&password=myapp15 http://localhost:10015/index.html?encoding=rgb32&password=wrongpassword

My questions:

totaam commented 4 years ago

This script is using the wrong command line arguments, it should use tcp-auth= and not auth=. This used to work, as a fallback, but this has been disabled for years.

ClaudioBsh commented 4 years ago

Thank you for fast answer:-)

I added this line to the run command: -e XPRA_MODE="start --tcp-auth=TCP_AUTH"

docker run -d --name x11-bridge-myapp15 -e XPRA_PASSWORD=myapp15 -e MODE="tcp" -e XPRA_HTML="yes" -e DISPLAY=:15 -e XPRA_MODE="start --tcp-auth=TCP_AUTH" -p 10015:10000 jare/x11-bridge

But in the logs i see an error: "cannot load authentication module 'TCP_AUTH' for tcp socket: No module named TCP_AUTH_auth"

Is it wrong to change the start-methode using Enironment-Variable like i did it or is the error message just true that tcp-auth is missing (but is it not included by default)?

ClaudioBsh commented 4 years ago

I did have a look in the runnning Container and could read now the run, tcp_m and ssh_m startscripts and saw within tcp_m the hardcoded --auth=env so there is no chance to start with tcp-auth without changing this.

JAremko commented 4 years ago

This script is using the wrong command line arguments, it should use tcp-auth= and not auth=. This used to work, as a fallback, but this has been disabled for years.

https://github.com/JAremko/docker-x11-bridge/blob/master/bin/tcp_m#L3 haven't modified it for 3 years. Sounds about right :smile:

I think the latest Xpra version is 3.0.1 and this image based off 2.5 so it's kinda overdue for an upgrade :thinking:


Tried using Xpra from Alpine repo but got good old parse_vt_settings: Cannot open /dev/tty0 (No such file or directory) Looks like I still have to build it from source...

JAremko commented 4 years ago

Updated Xpra and fixed the auth arg.

Seems to work with:

docker run -d \
 --name x11-bridge \
 -e MODE="tcp" \
 -e XPRA_HTML="yes" \
 -e DISPLAY=:14 \
 -e XPRA_PASSWORD=111 \
 --net=host \
 jare/x11-bridge

docker run -d \
 --name emacs-1 \
 --volumes-from x11-bridge \
 -e DISPLAY=:14 \
 jare/emacs emacs

docker run -d \
 --name emacs-2 \
 --volumes-from x11-bridge \
 -e DISPLAY=:14 \
 jare/emacs emacs

and link: http://localhost:10000/index.html?encoding=rgb32&password=111 the log:

Starting in the tcp mode.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
(EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/tmp/Xorg.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.
Warning: the 'start-child' option is used,
 but 'exit-with-children' is not enabled,
 use 'start' instead
2019-11-04 04:47:28,898 created tcp socket '0.0.0.0:10000'
2019-11-04 04:47:28,898 cannot access python uinput module:
2019-11-04 04:47:28,899  No module named uinput

X.Org X Server 1.20.5
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.14.89-0-vanilla x86_64 Alpine Linux
Current Operating System: Linux jare 5.3.8-arch1-1 #1 SMP PREEMPT @1572357769 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=f7158d44-955e-4890-93f4-25c44f5ef87e rw quiet
Build Date: 31 May 2019  06:21:39AM

Current version of pixman: 0.38.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/xdg/xpra/Xorg.:14.log", Time: Mon Nov  4 04:47:29 2019
(++) Using config file: "/etc/xpra/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
2019-11-04 04:47:32,666 created unix domain socket '/run/user/1000/xpra/jare-14'
2019-11-04 04:47:32,666 created unix domain socket '/run/xpra/jare-14'
2019-11-04 04:47:32,667 Warning: missing sound module
2019-11-04 04:47:32,700 pointer device emulation using XTest
2019-11-04 04:47:32,707 serving html content from '/usr/share/xpra/www'
2019-11-04 04:47:33,159 OpenGL is supported on display ':14'
2019-11-04 04:47:33,265 D-Bus notification forwarding is available
2019-11-04 04:47:33,437 xpra is ready.
2019-11-04 04:47:33,438 xpra GTK2 X11 version 3.0.1-r24241 64-bit
2019-11-04 04:47:33,467  uid=1000 (xpra), gid=1000 (xpra)
2019-11-04 04:47:33,467  running with pid 22 on Linux
2019-11-04 04:47:33,468  connected to X11 display :14 with 24 bit colors
2019-11-04 04:47:33,584 started command 'xhost +' with pid 42
2019-11-04 04:47:33,585 Warning: cannot watch for application menu changes without pyinotify:
2019-11-04 04:47:33,586  No module named pyinotify
access control disabled, clients can connect from any host
2019-11-04 04:47:33,587 Warning: cannot use application menu data:
2019-11-04 04:47:33,587  no python-xdg module
2019-11-04 04:47:33,587 child 'xhost +' with pid 42 has terminated
2019-11-04 04:47:33,689 19.4GB of system memory
2019-11-04 04:47:50,151 Authentication required by env authenticator module 1
2019-11-04 04:47:50,151  sending challenge for username 'xpra' using hmac+sha512 digest
2019-11-04 04:47:50,176 Handshake complete; enabling connection
2019-11-04 04:47:50,189  automatic picture encoding enabled, also available:
2019-11-04 04:47:50,190   jpeg, png, rgb32, h264, mpeg1
2019-11-04 04:47:50,191 HTML5 Linux Chrome client version 3.0.1
2019-11-04 04:47:50,333 setting keyboard layout to 'gb'
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported high keycode 372 for name <I372> ignored
>                   X11 cannot support keycodes above 255.
>                   This warning only shows for the first high keycode.
> Internal error:   Could not resolve keysym XF86MonBrightnessCycle
> Internal error:   Could not resolve keysym XF86RotationLockToggle
Errors from xkbcomp are not fatal to the X server
2019-11-04 04:47:50,401  client root window size is 1920x947 with 1 display:
2019-11-04 04:47:50,401   HTML (508x251 mm - DPI: 96x95)
2019-11-04 04:47:50,401     Canvas
2019-11-04 04:47:50,453 server virtual display now set to 1856x896 (best match for 1920x947)
2019-11-04 04:47:50,497 DPI set to 96 x 96
2019-11-04 04:47:50,509 client   1 received xdg start menu data
2019-11-04 04:47:50,550 client   1 startup complete
2019-11-04 04:47:50,551 client   1 connection-established
2019-11-04 04:47:54,428 xpra client 1 disconnected.
JAremko commented 4 years ago

@totaam for some reason the log contains 2019-11-04 04:47:33,586 No module named pyinotify while I installed it https://github.com/JAremko/docker-x11-bridge/blob/master/Dockerfile#L105

Also python-xdg throws "Non-ASCII character" error so I droped it

totaam commented 4 years ago

@JAremko what was the full xdg error? Can you please post it with xpra -d menu?

As for pyinotify, all xpra does is this: import pyinotify. You can try running that by hand: python2 -c "import pyinotify".

ClaudioBsh commented 4 years ago

@Jaremko thankz a lot for keeping up to date:-)

I did saw the changes and wondering: ..... FROM alpine:edge FROM alpine:3.10 .... ENV XPRA_VERSION=2.5 ENV XPRA_VERSION=3.0.1 .... RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" \

/etc/apk/repositories \ && echo "http://nl.alpinelinux.org/alpine/edge/community" \ && echo "http://nl.alpinelinux.org/alpine/v3.10/community" \ /etc/apk/repositories \ ......

You did change ENV XPRA_VERSION to 3.0.1, but should it not be 3.1.0?

ClaudioBsh commented 4 years ago

Not Ok - Blurred: X11BridgeTest_Blurred

Ok - Clear: X11BridgeTest_Clear

I did an update to your new image available on docker hub.

It works nice:-)

But there is one problem i did not have with previous version of your image.

The problem is, that some screen areas are shown first clear and after about a second blurred.

Also when i editing within a textfile....the screen area around the text blurred and after a time it is clear again...other ares keep blurred.

Each time i change the Tab-Register in my Browser first - as you can see on the pictures - it is clear, after a second it is blurred.

I did try all combinations of speed and endcoding and several browsers (chrome, firefox) (internet explorer 11 does not work at all with your image, so i cannot use for testing), calling the url from a Microsoft Windows 7 PC. I have blurred areas in all cases.

Andy ideas what could be the reason and what could be help?

JAremko commented 4 years ago

@ClaudioBsh

Not Ok - Blurred:

Could be that Xpra detects that you have slow connection and switched to lossy encoding. try looking into developer console of your browser for logs :thinking: Also there could be a flag to force certain encoding or something. For me adding encoding=rgb32 like in http://localhost:10000/index.html?encoding=rgb32&password=111 makes sure that the image is crisp and that the server doesn't waste resources on compression. But it for sure requires the biggest bandwidth.

You did change ENV XPRA_VERSION to 3.0.1, but should it not be 3.1.0?

3.10 is Alpine Linux version that I base the image of and 3.0.1 is latest Xpra. Just unfortunate numbers :smile:

JAremko commented 4 years ago

@totaam

Starting in the tcp mode.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
(EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/tmp/Xorg.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.
Warning: the 'start-child' option is used,
 but 'exit-with-children' is not enabled,
 use 'start' instead
2019-11-06 06:31:32,605 created tcp socket '0.0.0.0:10000'
2019-11-06 06:31:32,606 cannot access python uinput module:
2019-11-06 06:31:32,606  No module named uinput

X.Org X Server 1.20.5
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.14.89-0-vanilla x86_64 Alpine Linux
Current Operating System: Linux jare 5.3.8-arch1-1 #1 SMP PREEMPT @1572357769 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=f7158d44-955e-4890-93f4-25c44f5ef87e rw quiet
Build Date: 31 May 2019  06:21:39AM

Current version of pixman: 0.38.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/xdg/xpra/Xorg.:14.log", Time: Wed Nov  6 06:31:32 2019
(++) Using config file: "/etc/xpra/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
2019-11-06 06:31:36,165 created unix domain socket '/run/user/1000/xpra/jare-14'
2019-11-06 06:31:36,165 created unix domain socket '/run/xpra/jare-14'
2019-11-06 06:31:36,166 Warning: missing sound module
2019-11-06 06:31:36,198 pointer device emulation using XTest
2019-11-06 06:31:36,205 serving html content from '/usr/share/xpra/www'
2019-11-06 06:31:36,601 OpenGL is supported on display ':14'
2019-11-06 06:31:36,695 D-Bus notification forwarding is available
2019-11-06 06:31:36,700 Warning: cannot watch for application menu changes without pyinotify:
2019-11-06 06:31:36,701  No module named pyinotify
2019-11-06 06:31:36,702 Error during threaded setup of <class 'xpra.server.mixins.child_command_server.ChildCommandServer'>
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/xpra/server/server_base.py", line 171, in threaded_init
    c.threaded_setup(self)
  File "/usr/lib/python2.7/site-packages/xpra/server/mixins/child_command_server.py", line 92, in threaded_setup
    load_xdg_menu_data()
  File "/usr/lib/python2.7/site-packages/xpra/platform/xposix/xdg_helper.py", line 237, in load_xdg_menu_data
    xdg_menu_data = do_load_xdg_menu_data()
  File "/usr/lib/python2.7/site-packages/xpra/platform/xposix/xdg_helper.py", line 242, in do_load_xdg_menu_data
    from xdg.Menu import parse, Menu, ParsingError
  File "/usr/lib/python2.7/site-packages/xdg.py", line 18
SyntaxError: Non-ASCII character '\xc2' in file /usr/lib/python2.7/site-packages/xdg.py on line 18, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
2019-11-06 06:31:36,837 19.4GB of system memory
2019-11-06 06:31:36,963 xpra is ready.
2019-11-06 06:31:36,965 xpra GTK2 X11 version 3.0.1-r24241 64-bit
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/xpra/server/server_base.py", line 176, in threaded_init
    get_platform_info()
  File "/usr/lib/python2.7/site-packages/xpra/version_util.py", line 172, in get_platform_info
    platform_info_cache = do_get_platform_info()
  File "/usr/lib/python2.7/site-packages/xpra/version_util.py", line 155, in do_get_platform_info
    release = platform_release(pp.release())
  File "/usr/lib/python2.7/platform.py", line 1317, in release
    return uname()[2]
  File "/usr/lib/python2.7/platform.py", line 1265, in uname
    processor = _syscmd_uname('-p','')
  File "/usr/lib/python2.7/platform.py", line 1000, in _syscmd_uname
    rc = f.close()
IOError: [Errno 10] No child process

2019-11-06 06:31:36,992  uid=1000 (xpra), gid=1000 (xpra)
2019-11-06 06:31:36,993  running with pid 25 on Linux
2019-11-06 06:31:36,993  connected to X11 display :14 with 24 bit colors