RCT Details
From Sun Ray User Group Wiki
Contents |
Under The Hood
This page is intended to give some of the details of how the Remote Control Toolkit was put together.
This is not intended to be an explanation of all facets of the package.
Agent Mode
When an agent is started through the remote control agent script, it captures information about the Sun Ray Session and x11vnc process attached to it. This information is stored in files which are placed in /tmp/SUNWut/$USER.agent.settings.vnc
The following is a listing of the settings directory:
# ls -l /tmp/SUNWutRC total 80 drwxrwxrwx 2 root root 431 Mar 3 20:35 recordings -rw------- 1 brad staff 151 Mar 4 09:11 brad.agent.settings.vnc -rw------- 1 craig staff 151 Mar 4 09:11 craig.agent.settings.vnc -rw------- 1 utcu0 nobody 151 Mar 4 09:11 utcu0.agent.settings.vnc -rw------- 1 utcu1 nobody 151 Mar 4 09:11 utcu1.agent.settings.vnc
You can see that we have agents running for user sessions (brad, craig) and Kiosk sessions (utcu0, utcu1).
The contents of the agent settings file are used by the Control, WebControl, RecordUser, and RecordMe scripts to locate and login to the x11vnc process.
# more utcu0.agent.settings.vnc REALDISPLAY=tequila:3 FCPASS=37Sm0NoK9 VOPASS=gMtHushB9 GEOM=1280x1024+0+0 VNCDISPLAY=tequila:11 RFBPORT=5911 HTTPPORT=5811 URL=http://tequila:5811/
The information contained in this file can be manually used by anybody to connect to this session.
Agent Mode for Normal Sessions
Agent mode for all normal sessions (i.e non-CAM) is enabled by adding a script to the session startup scripts directory which is run when a users session is initiated. The location of the session startup scripts vary between Solaris and Linux.
For Solaris (SPARC/x86)
/usr/dt/config/Xsession.d
For Linux
/etc/X11/xinit/xinitrc.d
For Sun Ray session use, these scripts must have the SUNWut extension. They are parsed in their numerical order.
These scripts must also have the execute flag enabled.
# chmod +x 0101.SUNWut
The startup script is very simple. It ensures that the session is not a CAM session and then runs the remote control agent script.
# more /usr/dt/config/Xsession.d/0101.SUNWut #!/bin/sh if [ ! "$BB_TOKEN" ];then /opt/SUNWutRC/agent/remoteagent & else echo CAM Session. Aborting fi
Agent Mode for Kiosk Sessions
Agent Mode for Kiosk sessions is enabled by adding another application to the Kiosk environment. This application is set to be critical, which means that it starts automatically on on Kiosk session start. It also means that if the RC application dies, the CAM session will terminate and restart.
We must use a CAM application instead of the normal Agent method because the hand off to the CAM user happens after parsing Xsession or Xinit. The result is a settings file that would not be associated with any user and which keeps getting overwritten by the next CAM session. For these reasons, the 0101.SUNWut startup script exits if it detects variables associated with a CAM session.
CAM is configured to run /opt/SUNWutRC/StartRC at startup.
# more /opt/SUNWutRC/StartRC #!/bin/sh /opt/SUNWutRC/agent/remoteagent &
Forced Mode
In order to use Forced mode you need to have root privileges. This is because in order to attach to an existing Xserver process you need to know the magic cookie. The magic cookie for a logged in session is stored in the users home directory and only that user or a user with root privileges can get to the file that contains the magic cookie.
Once the magic cookie is discovered the force script launches the x11vnc server attached to the users Xserver and creates the passwords necessary to connect.
Libraries
Occasionally there may be an issue with libraries required for a particular component of the RC Toolkit to function.
You may use ldd against vncviewer, x11vnc, and vnc2swf to check for proper library paths. If any libraries show up as not found, and you have them on your system you can go through the scripts in /opt/SUNWutRC and /opt/SUNWutRC/bin and append the correct LD_LIBRARY_PATH statements.
# cd /opt/SUNWutRC/bin
# ldd x11vnc
libssl.so.0.9.7 => /usr/sfw/lib/libssl.so.0.9.7
libcrypto.so.0.9.7 => /usr/sfw/lib/libcrypto.so.0.9.7
libXtst.so.1 => /usr/openwin/lib/libXtst.so.1
libXext.so.0 => /usr/openwin/lib/libXext.so.0
libXrandr.so.2 => /usr/X11/lib/libXrandr.so.2
libXfixes.so.1 => /usr/sfw/lib/libXfixes.so.1
libXdamage.so.1 => /usr/sfw/lib/libXdamage.so.1
libX11.so.4 => /usr/openwin/lib/libX11.so.4
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libpthread.so.1 => /lib/libpthread.so.1
libz.so.1 => /usr/lib/libz.so.1
libjpeg.so.62 => /usr/lib/libjpeg.so.62
libc.so.1 => /lib/libc.so.1
libXrender.so.1 => /usr/openwin/sfw/lib/libXrender.so.1
libXau.so.6 => /usr/openwin/lib/libXau.so.6
libdl.so.1 => /lib/libdl.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libcrypto_extra.so.0.9.8 => (file not found)
libm.so.2 => /lib/libm.so.2

