Hecate was originally designed to support the SimpleSite project that allows professors and TAs to manage the web pages associated with their course accounts.
The name Hecate comes from Greek mythology. "She who works from afar"; Goddess of sorcery and witchcraft; abstractly symbolized by the crossroads--spacial or temporal meeting/travelling points; dwells in the Underworld (C&C, obviously!)
Also known as Trivia by the Romans (tri = 3, via = roads), after the crossroads symbol, and redefined as "inconsequential, ordinary, common-place."
The basic syntax of the Hecate utility is:
-a: | Acting UW NetID [none]. |
-i: | Input file descriptor [stdin]. |
-o: | Output file descriptor [stdout]. |
-u: | Alternate user [self]. |
-v: | Verbose mode. |
The -a option specifies the initial acting UW NetID. See the ActAs directive below.
The alternate user parameter, -u allows the SimpleSite web interface to act on behalf of its REMOTE_USER's identity. There is a list of accounts that hecate will trust in the file:
Normally a set of directives are read from stdin and responses are sent to stdout. Alternate file descriptors can be specified with the -i and -o parameters. You can only specify file descriptors that are already open with these options. In addition to increasing the raw power of the utility, this limitation, er... feature, simplifies the security requirements (running setuid as "root", I don't need to worry about whether the user is permitted to create/read a file -- it gets opened/created before I start).
It's expected that hecate will be invoked by another utility or web CGI script that will feed it commands and interpret the results. That utility will likely want to open a couple of pipes to be used for hecate's input and output, reserving stdin and stdout for the commands that hecate invokes with its run directive.
The -v option can be used to get a copy of the input directives echoed to the output. Useful if input is read from a file. For example:
Directives to hecate are supplied on the input file in the form:
The optional sequence number can be specified to associate responses with individual input directives. Most responses to commands will appear in the output stream in the form:
In addition to the numerical response code, the ACK will be replace with NAK for response codes greater than 299 or CON for response codes less than 200.
If the -v option is specified on the hecate command line, input directives will appear on the output stream as:
The invoked command's stdin, stdout and stderr (file descriptors 0, 1, and 2) are the same as those for the hecate command. In addition to those descriptors, file descriptor 3 is directed back to hecate's output stream. Each line of text written to this by the invoked command will be packaged up in the standard way. Thus, the directive:
Would produce the output:
When the command runs, it has at its disposal two environment variables, PUBLIC_HTML and PUBLIC_MEDIA that point to the active UW NetID's directories if they exist. If the active UW NetID is not subscribed to the staff (faculty, courses, or departmental) web publishing service, the student web publishing directory is used. The current working directory will be set to the PUBLIC_HTML directory.
If the executed command exits with a status of zero, the response code will be 202: GB_E_COKAY, for "Child okay". If the exit status is nonzero or the process was terminated by a signal the response code will be 404: CB_E_CEXIT, or 405: CB_E_CSIGNAL.
20: | Homer/Ovid |
103: | Web publishing |
115: | Screaming Media |
7: | Dante/Vergil |
104: | Student Web Publishing |
116: | Student Streaming Media |
The optional web parameter gets the response formatted with html tags suitable to be inserted into a web page. The response from the Mango server for the subscribe request is written to the output file descriptor between two normally formatted responses as in:
This is one of the places where the output file will contain lines that are not formatted in the normal ACK/NAK/CON style.
The following example session was performed on the cat02 system to demonstrate the root account acting as the krl account to access one of krl's sponsored UW NetIDs, ktest17.
#cat02> whoami root #cat02> id uid=0(root) gid=0(system) groups=0(system),5(tty),6(kmem),30(user),31(guest) #cat02> cat input_file 1001 status 20 1002 status 115 1003 subscribe 7 1004 run /bin/sh #cat02> hecate -vi3o6ua krl ktest17 3<input_file 6>output_file sh-2.04$ id uid=126311 gid=30(user) groups=30(user) sh-2.04$ printenv PWD=/nfs/aesop01/hw10/d28/ktest17 HOSTNAME=cat02 PUBLIC_HTML=/hw10/d28/ktest17 MACHTYPE=i686-pc-linux-gnu PUBLIC_MEDIA=NONE SHLVL=2 SHELL=/bin/sh HOSTTYPE=i686 OSTYPE=linux-gnu TERM=dumb PATH=/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:. _=/usr/bin/printenv sh-2.04$ ls -l total 4 -rw-r----- 1 126311 www 220 Aug 9 16:46 index.html sh-2.04$ cat index.html <HTML> <HEAD> <TITLE>K. Lowe's Home Page</TITLE> </HEAD> <IMG ALIGN=LEFT SRC="/icons/construct.gif"> <P>This is the home page for ktest17 <<A HREF="mailto:ktest17@u.washington.edu">K. Lowe</A>>. </P> <HR> </BODY> </HTML> sh-2.04$ echo "The quick brown fox jumps over the lazy dog" 1>&3 sh-2.04$ exit 13 exit #cat02> cat output_file 000 INP 1000 ActAs ktest17 200 ACK 1000 Acting as ktest17 000 INP 1001 status 20 211 ACK 1001 Active 000 INP 1002 status 115 212 ACK 1002 Denied 000 INP 1003 subscribe 7 504 ACK 1003 Failed: Not permitted for service 000 INP 1004 run /bin/sh 101 CON 1004 The quick brown fox jumps over the lazy dog 404 NAK 1004 Exit 13