source: src-qt4/PCDM/PCDMd @ b6cbe03

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since b6cbe03 was b6cbe03, checked in by Ken Moore <ken@…>, 8 months ago

Get the initial xauth key randomized (64 character hex key) for PCDM. It looks like all the Xsecurity stuff is now done, but we should probably still test the xvnc stuff to make sure that still works.

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/sh
2# Login daemon for PCDM
3# This starts the main PCDM UI appropriately
4#------------------------------------
5
6PCDMCONF="/usr/local/etc/pcdm.conf"
7PCDMAUTHFILE="/tmp/.PCDMAuth"
8
9XOPTS=""
10grep -q "^ENABLE_TCP_LISTEN=TRUE" ${PCDMCONF}
11if [ $? -ne 0 ]; then
12  XOPTS="-nolisten tcp" 
13fi
14
15#See if VNC support is enabled for logging in to this system
16grep -q "^ALLOW_REMOTE_LOGIN=TRUE" ${PCDMCONF}
17if [ $? -eq 0 ]; then
18   # Setup default vnc server opts
19   vncopts="-forever "
20   grep -q "^REMOTE_SHARED_SCREEN=TRUE" ${PCDMCONF}
21   if [ $? -eq 0 ] ; then
22     vncopts="-shared "
23   else
24     vncopts="-nevershared "
25   fi
26   if [ -e "/usr/local/etc/vncpass" ] ; then
27     vnccmd="x11vnc -display :0 $vncopts -passwdfile /usr/local/etc/vncpass -loop"
28   else
29     echo "WARNING: VNC enabled but no password in /usr/local/etc/vncpass!"
30     sleep 5
31   fi
32
33fi
34
35
36# Allow Auto-Login the first time PCDM starts
37touch /tmp/.PCDMAutoLogin
38# Now start the X Server
39while [ ! -e /var/run/nologin ]; do
40  /usr/local/bin/pc-checkxdisplay
41  # Make sure the authorization file does not exist
42  if [ -f ${PCDMAUTHFILE} ]; then
43    rm ${PCDMAUTHFILE}
44  fi
45  setenv XAUTHORITY ${PCDMAUTHFILE} #Set the auth file location
46  touch ${PCDMAUTHFILE} #Create the (empty) authorization file
47  xauth add :0 MIT-MAGIC-COOKIE-1 `openssl rand -hex 64` #Add a default entry to the file (randomized)
48  if [ -n "$vnccmd" ] ; then
49    # Start VNC
50    (sleep 10 ; $vnccmd >/var/log/vncserver 2>/var/log/vncserver) &
51  fi
52  xinit /usr/local/bin/PCDM-session -once -- :0 -auth ${PCDMAUTHFILE} $XOPTS
53done
Note: See TracBrowser for help on using the repository browser.