From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f72b0,8b6d74fa49f7b9e0 X-Google-Attributes: gidf72b0,public X-Google-Thread: 1164f8,b96cc09c15c35fb X-Google-Attributes: gid1164f8,public X-Google-Thread: 10f5df,8b6d74fa49f7b9e0 X-Google-Attributes: gid10f5df,public X-Google-Thread: 10b612,b96cc09c15c35fb X-Google-Attributes: gid10b612,public X-Google-ArrivalTime: 1993-03-18 21:13:17 PST Xref: sparky comp.sys.dec:7941 comp.unix.ultrix:10395 comp.unix.misc:5524 comp.sys.dec:7942 vmsnet.admin:532 Newsgroups: comp.sys.dec,comp.unix.ultrix,comp.unix.misc,comp.sys.dec,vmsnet.admin Path: sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!augean.eleceng.adelaide.edu.AU!hfrd.dsto.oz.au!dall From: dall@hfrd.dsto.gov.au (Ian Dall) Subject: Re: Urgent: a hole in X security - xwatchwin2 Message-ID: <1993Mar19.034226.6576@hfrd.dsto.gov.au> Sender: dall@hfrd.dsto.gov.au (Ian Dall) Organization: Defence Science and Technology Organisation References: <1993Mar15.071215.5122@tigger.jvnc.net> Date: Fri, 19 Mar 1993 03:42:26 GMT In article , rjg@umnstat.stat.umn.edu (Robert J. Granvin) writes: > Would someone be willing to post a quick summary on the proper usage of > xauth, MIT-MAGIC-COOKIE and what all those little nuances a person needs > to know to enable this most basic of display security? > > (i.e., talking about the problems are great, but a quick summary of > procedures would help the more novice users get up and running quicker...) OK. Here goes. No doubt someone will correct me if I get it wrong! A MIT-MAGIC-COOKIE is a long (random) number. Essentially, the server allows any client which knows that random number to connect. All the rest is just the mechanism by which the cookies are generated and made known to the clients and servers. The cookie can be specified on the commandline when a server is started. It can also be set by the XDM protocol. Magic cookies are normally stored in a users ~/.Xauthority file. There is only one cookie for each server the user is authorised to connect to. XDM normally generates a magic cookie, communciates it with the server via the XDM protocol and makes the entry for a given display just before starting a users xsession. Clients look in the .Xauthority file to get the cookie for the display they are trying to connect to. XDM is strongly recommended (by me) over dxprompter or whatever it is called. XDM can both start local servers and manage remote (X terminal) servers. Also, I strongly recommend R5 xdm over R4 xdm. The configuration is cleaner and I had some problems with R4 xdm on ultrix (only for local servers). The X distribution comes with quite good examples for all the config files needed for XDM. I've no idea whether the DEC unsupported subsets MIT X has these sample config files. Certainly it is still back at release 5. If you don't use XDM, you need to a) generate a magic cookie, it is just a random number of the right number of digits, b) start the server with that magic cookie as an argument and c) enter the cookie into .Xauthority using xauth. Xauth can also be used to extract entries. With xauth plus a little fiddling with rsh, you can, extract an entry from you local .Xauthority, enter it into a remote .Xauthority (anywhere where you have permission to write to .Xauthority) and then start clients on a remote machine. For example, here is my xrsh script. It will normally allow you to just do "xrsh host xterm" for example. Beware that if you use a shell which doesn't have a built in echo, this script might momentarilly allow your cookie to be seen with ps. #!/usr/bin/bash FROM=$HOME/.Xauthority XEXTRACT="xauth -f $FROM nextract - $DISPLAY" XMERGE="xauth nmerge -" XBIN=/usr/local/bin/X11:/usr/bin/X11 AUTHKEY=`$XEXTRACT` SETENV="\ DISPLAY=$DISPLAY; export DISPLAY; if [ -r .Xclientenv ]; then . .Xclientenv else PATH=$XBIN:"'$PATH'"; export PATH fi" cmd=xterm if [ $# -lt 1 ]; then echo $USAGE exit 1 fi host=$1 shift rsh $host exec sh <<-!END_REMOTE! $SETENV exec > .Xlog 2>&1 (echo $AUTHKEY) | $XMERGE ${@:-$cmd}& !END_REMOTE! I don't actually recall why I have brackets around "echo $AUTHKEY". Possibly I used to close the file descriptors (instead of re-directing them) and bash complained about trying to redirect a closed file descriptor. -- Ian Dall I'm not into isms, but hedonism is the most harmless I can think of. -- Phillip Adams internet: dall@hfrd.dsto.gov.au