<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>39023</bug_id>
          
          <creation_ts>2004-01-22 04:36 0000</creation_ts>
          <short_desc>tightvnc init.d script</short_desc>
          <delta_ts>2007-04-12 21:01:14 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>lu_zero@gentoo.org</reporter>
          <assigned_to>lu_zero@gentoo.org</assigned_to>
          <cc>matt@mattcaron.net</cc>

      

      
          <long_desc isprivate="0">
            <who>lu_zero@gentoo.org</who>
            <bug_when>2004-01-22 04:36:44 0000</bug_when>
            <thetext>just a reminder, please take a look at the script I attach (the scripts aren&apos;t mine but from an user)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>lu_zero@gentoo.org</who>
            <bug_when>2004-01-22 04:37:32 0000</bug_when>
            <thetext>Created an attachment (id=24230)
conf.d
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>lu_zero@gentoo.org</who>
            <bug_when>2004-01-22 04:38:20 0000</bug_when>
            <thetext>Created an attachment (id=24231)
init.d
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aliz@gentoo.org</who>
            <bug_when>2004-01-22 04:44:55 0000</bug_when>
            <thetext>http://forums.gentoo.org/viewtopic.php?t=72893</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>nigelenki@comcast.net</who>
            <bug_when>2004-01-31 13:19:35 0000</bug_when>
            <thetext>vncd hacks are an annoying thing.  I just wrote my own actually, it takes a conf.d file that&apos;s just a bunch of lines of user,display,geometry and su&apos;s to the user, then runs vncserver $display -geometry $geometry.

What we REALLY need is an actual vncd coded for tightvnc.  It should require a username/password entry, and then track that, on connect.  Here&apos;s how this would be done securely:

 - vncd service running, listening on port 5999 (vnc uses 5900 + display, this would equivalate to :99)
 - User connects with vncviewer to vnchost:99
 - A new vncserver is spawned, on a new display, on a new port, and the connection is directed at it.  This is the same as what apache does; the client port will be 5999 and the server port will be something else.
 - There is *no* password, screen immediately comes up with no authorisation.
 - vncd starts up vncdauth, an X program that demands that the user enter a username and password (just like xdm/gdm does).
 - vncd checks to see that the username/password is valid AND the user is in group vncusers, if not, kills the Xvnc that was started.
 - If the user is still connected (authorization approved), then it starts up gdm/kdm/xdm/xsession/etc.  Optionally, the user may chose from a list of already running VNCs and connect to those without entering his password, but this will still cause the chosen VNC to request authorization for reconnect
 - VNC session operates as normal from then on
 - When other connections come directly in to a user&apos;s vnc, the vnc requests authorization as a normal vncserver would, from the vncpasswords in ~/.vnc
 - When the WM is exited, the Xvnc dies, connection is closed.

This is the only real way to make something like this actually majorly useful for generalized remote logins; running a hundred VNCs for each of your users is impractical.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matt@mattcaron.net</who>
            <bug_when>2004-06-26 14:21:27 0000</bug_when>
            <thetext>Hey, the scripts look better than mine (attached after this; basically ported from what FC1 uses to the gentoo init architecture). The one problem I have with these scripts is that I changed:

su ${user%%:*} -c &quot;PATH=$PATH:/usr/X11R6/bin vncserver :${user##*:} $VNC_OPTS&quot; &amp;&gt;/dev/null

and the ilk to 

su ${user%%:*} -c &quot;vncserver :${user##*:} $VNC_OPTS&quot; &amp;&gt;/dev/null

See, when root&apos;s shell has been changed to TCSH, changing the path doesn&apos;t work correctly. So, either check and see what root&apos;s shell is, or don&apos;t set it at all.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matt@mattcaron.net</who>
            <bug_when>2004-06-26 14:23:28 0000</bug_when>
            <thetext>Created an attachment (id=34227)
redhat vncservers init script ported to gentoo init architecture
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matt@mattcaron.net</who>
            <bug_when>2004-06-26 14:23:57 0000</bug_when>
            <thetext>Created an attachment (id=34228)
redhat vncservers config script ported to gentoo init architecture
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matt@mattcaron.net</who>
            <bug_when>2004-07-05 13:53:46 0000</bug_when>
            <thetext>Add - the init script needs modified depend section as follows:

depend() {
        need net
        after netmount nfsmount
}

Because if you&apos;re NFS mounting home, it can only start after those are done...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matt@mattcaron.net</who>
            <bug_when>2004-07-06 21:00:10 0000</bug_when>
            <thetext>Add - the init script needs to cd into the user&apos;s homedir when starting the server (the redhat one does this already). Otherwise, the default path that xterm gets when it starts is wrong (among other things).

Something like:

su ${user%%:*} -c &quot;cd ~${USER} &amp;&amp; vncserver :${user##*:} $VNC_OPTS&quot; &amp;&gt;/dev/null

works.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo-bugzilla@mcooper.demon.co.uk</who>
            <bug_when>2005-06-10 02:29:19 0000</bug_when>
            <thetext>Are these scripts in any of the tightvnc ebuilds yet?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>morfic@gentoo.org</who>
            <bug_when>2006-05-06 21:14:02 0000</bug_when>
            <thetext>go for it</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>armin76@gentoo.org</who>
            <bug_when>2007-04-12 21:01:14 0000</bug_when>
            <thetext>Added the scripts to both tightvnc and vnc, thanks to the one who made them, and thanks Matthew for the info :)</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>24230</attachid>
            <date>2004-01-22 04:37 0000</date>
            <desc>conf.d</desc>
            <filename>vnc</filename>
            <type>text/plain</type>
            <data encoding="base64">IyBDb25maWcgZmlsZSBmb3IgL2V0Yy9pbml0LmQvdm5jCgojIFNwZWNpZnkgdGhlIHVzZXIocykg
WHZuYygxKSBzaG91bGQgYmUgcnVuIGZvci4gVGhlIHN5bnRheCBpczogInVzZXJuYW1lOmRpc3Bs
YXkiLgojIGV4YW1wbGU6ICJESVNQTEFZPSJmb286MSBiYXI6MiIgWW91IGNhbiBzcGVjaWZ5IG1v
cmUgdXNlcnMgc2VwYXJhdGVkIGJ5IHNwYWNlLgpESVNQTEFZUz0ibHVfemVybzoxICIKCiMgU3Bl
Y2lmeSBhbnkgb2Ygdm5jc2VydmVyKDEpIGFuZCBYdm5jKDEpIG9wdGlvbnMuIFNlZSB0aGUgcmVz
cGVjdGl2ZSBtYW4gcGFnZXMgZm9yIG1vcmUgaW5mb3JtYXRpb24uCiMgVk5DX09QVFM9IiIK
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>24231</attachid>
            <date>2004-01-22 04:38 0000</date>
            <desc>init.d</desc>
            <filename>vnc</filename>
            <type>text/plain</type>
            <data encoding="base64">IyEvc2Jpbi9ydW5zY3JpcHQKIyBDb3B5cmlnaHQgMTk5OS0yMDAyIEdlbnRvbyBUZWNobm9sb2dp
ZXMsIEluYy4KIyBEaXN0cmlidXRlZCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFs
IFB1YmxpYyBMaWNlbnNlLCB2MiBvciBsYXRlcgojICRIZWFkZXI6ICQKCmRlcGVuZCgpIHsKCW5l
ZWQgbmV0Cn0KCmNoZWNrY29uZmlnKCkgewoJaWYgWyAtbiAiJHtESVNQTEFZU30iIF07IHRoZW4K
CQlpZiBbICQxID0gInN0YXJ0IiBdOyB0aGVuCgkJCWxvY2FsIHVzZXIKCQkJZm9yIHVzZXIgaW4g
JERJU1BMQVlTOyBkbwoJCQkJaWYgZXZhbCBbICEgLWYgIn4ke3VzZXIlJToq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W4gJERJU1BMQVlTOyBkbwoJCXN1ICR7dXNl
ciUlOip9IC1jICJQQVRIPSRQQVRIOi91c3IvWDExUjYvYmluIHZuY3NlcnZlciA6JHt1c2VyIyMq
On0gJFZOQ19PUFRTIiAmPi9kZXYvbnVsbAoJZG9uZQoJZWVuZCAkPwp9CgpzdG9wICgpIHsKCWNo
ZWNrY29uZmlnIHN0b3AgfHwgcmV0dXJuIDIKCWViZWdpbiAiU3RvcHBpbmcgVGlnaHRWTkMgc2Vy
dmVyIgoJZm9yIHVzZXIgaW4gJERJU1BMQVlTOyBkbwoJCXN1ICR7dXNlciUlOip9IC1jICJQQVRI
PSRQQVRIOi91c3IvWDExUjYvYmluIHZuY3NlcnZlciAta2lsbCA6JHt1c2VyIyMqOn0iICY+L2Rl
di9udWxsCglkb25lCgllZW5kICQ/Cn0KCnJlc3RhcnQoKSB7CiAgICAgICAgc3ZjX3N0b3AKICAg
ICAgICBzdmNfc3RhcnQKfQo=
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34227</attachid>
            <date>2004-06-26 14:23 0000</date>
            <desc>redhat vncservers init script ported to gentoo init architecture</desc>
            <filename>vncservers.init.d</filename>
            <type>text/plain</type>
            <data encoding="base64">IyEvc2Jpbi9ydW5zY3JpcHQKCmRlcGVuZCgpIHsKIyBNQyAtIHVzZWQgdGhlIHNhbWUgZGVwZW5k
KCkgYXMgc3NoCgl1c2UgbG9nZ2VyIGRucwoJbmVlZCBuZXQKfQoKc3RhcnQoKSB7CgllaW5mbyAi
U3RhcnRpbmcgVk5DIHNlcnZlcnMuIgogICAgCVJFVFZBTD0wCiAgICAJZm9yIGRpc3BsYXkgaW4g
JHtWTkNTRVJWRVJTfQogICAgCWRvCiAgICAgICAgCWVjaG8gLW4gIiR7ZGlzcGxheX0gIgoJCXVu
c2V0IEJBU0hfRU5WIEVOVgoJCWV4cG9ydCBVU0VSPSIke2Rpc3BsYXkjIyo6fSIKICAgICAgICAJ
c3UgJHtVU0VSfSAtYyAiY2QgfiR7VVNFUn0gJiYgWyAtZiAudm5jL3Bhc3N3ZCBdICYmIHZuY3Nl
cnZlciA6JHtkaXNwbGF5JSU6Kn0iID4mIC9kZXYvbnVsbAogICAgICAgIAlSRVRWQUw9JD8KICAg
ICAgICAJWyAiJFJFVFZBTCIgLW5lIDAgXSAmJiBicmVhawogICAgCWRvbmUKCWVjaG8gCgllZW5k
ICQ/CQp9CgpzdG9wKCkgewoJZWJlZ2luICJTaHV0dGluZyBkb3duIFZOQyBzZXJ2ZXJzIgoJZm9y
IGRpc3BsYXkgaW4gJHtWTkNTRVJWRVJTfQogICAJZG8KICAgICAgICAJZWNobyAtbiAiJHtkaXNw
bGF5fSAiCgkJdW5zZXQgQkFTSF9FTlYgRU5WCgkJZXhwb3J0IFVTRVI9IiR7ZGlzcGxheSMjKjp9
IgoJICAgIAlzdSAke1VTRVJ9IC1jICJ2bmNzZXJ2ZXIgLWtpbGwgOiR7ZGlzcGxheSUlOip9IiA+
JiAvZGV2L251bGwKICAgIAlkb25lCiAgICAgICAgZWVuZCAkPwp9Cgo=
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34228</attachid>
            <date>2004-06-26 14:23 0000</date>
            <desc>redhat vncservers config script ported to gentoo init architecture</desc>
            <filename>vncservers.conf.d</filename>
            <type>text/plain</type>
            <data encoding="base64">IyBDb25maWcgZmlsZSBmb3IgL2V0Yy9pbml0LmQvdm5jc2VydmVycwoKVk5DU0VSVkVSUz0iMTpt
YXR0Igo=
</data>        

          </attachment>
    </bug>

</bugzilla>