Go to file
Joshua Kwan 71f367b1b4 Reindent, and add some error handling for kill
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@66 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
2004-01-04 02:19:12 +00:00
.cvsignore Added cscope.out and error.log 2004-01-04 01:54:45 +00:00
Bugs Update all of the administrivia to reflect current state 2004-01-02 11:59:50 +00:00
COPYING Update COPYING to show all licenses represented in source, amend ChangeLog 2004-01-03 00:26:48 +00:00
Changelog update Changelog, screw libiberty 2004-01-04 01:14:36 +00:00
Makefile use strlcpy 2004-01-04 01:05:22 +00:00
README fix some errors pointed out by jilles and paxed 2004-01-03 03:51:29 +00:00
TODO Update all of the administrivia to reflect current state 2004-01-02 11:59:50 +00:00
dgamelaunch.c Reindent, and add some error handling for kill 2004-01-04 02:19:12 +00:00
dgamelaunch.h Reindent, and add some error handling for kill 2004-01-04 02:19:12 +00:00
dgl-banner I can't stand it anymore, reindenting with 2 spaces, 2003-12-31 19:47:49 +00:00
dgl-create-chroot modifications by jilles@stack.nl (in #nethack.) Commiting by proxy. 2004-01-03 21:50:40 +00:00
dgl-default-rcfile initial commit of new dgamelaunch to CVS 2003-12-30 21:30:32 +00:00
io.c I can't stand it anymore, reindenting with 2 spaces, 2003-12-31 19:47:49 +00:00
io.h initial commit of new dgamelaunch to CVS 2003-12-30 21:30:32 +00:00
last_char_is.c I can't stand it anymore, reindenting with 2 spaces, 2003-12-31 19:47:49 +00:00
nh343-simple_mail.diff Revamp the simplemail support 2004-01-04 00:21:39 +00:00
stripgfx.c I can't stand it anymore, reindenting with 2 spaces, 2003-12-31 19:47:49 +00:00
stripgfx.h initial commit of new dgamelaunch to CVS 2003-12-30 21:30:32 +00:00
strlcpy.c Reindent, and add some error handling for kill 2004-01-04 02:19:12 +00:00
ttyplay.c graceful_exit, does nothing but please deprecate exit(). 2004-01-04 01:45:21 +00:00
ttyrec.c Reindent, and add some error handling for kill 2004-01-04 02:19:12 +00:00
ttyrec.h I can't stand it anymore, reindenting with 2 spaces, 2003-12-31 19:47:49 +00:00
virus.c graceful_exit, does nothing but please deprecate exit(). 2004-01-04 01:45:21 +00:00

README

In short, there isn't an easy 'make install' option for this, as it
runs in a chroot environment and is somewhat specific to a server.

It should compile on most modern Linux distros, although there are
a couple things which do hinder total portability.

That said, it shouldn't be too hard to figure out most of the defines
in dgamelaunch.(c|h), and I'm more than happy to help out with any
questions.

Me:            M. Drew Streib <dtype@dtype.org>
Mailing list:  http://alt.org/mailman/listinfo/nethack/

BASIC SETUP INSTRUCTIONS
===========================

1) Setup a chroot area, with a bin directory, a var directory, and a
'dgldir' directory. You'll also need 'etc' and 'etc/terminfo' for
curses.

2) If using the #define's as an example, setup 'rcfiles', 'ttyrec',
and 'inprogress' directories, in the dgldir. Also touch the files
'dgl-login' and 'dgl-lock' in the main chroot directory.

3) Copy the dgl-banner and dgl-default-rcfile files into the main 
chroot directory  and optionally modify them. If these files aren't
available in the package simply touch the files in the main chroot
directory. 

Your directories/files should now look like this:

/chrootdir/bin/
/chrootdir/var/
/chrootdir/etc/
/chrootdir/etc/terminfo/
/chrootdir/dgldir/
/chrootdir/dgldir/ttyrec/
/chrootdir/dgldir/inprogress/
/chrootdir/dgldir/rcfiles/
/chrootdir/dgl-login (empty)
/chrootdir/dgl-lock (empty)
/chrootdir/dgl-banner
/chrootdir/dgl-default-rcfile

They should all be owned by the user you intend to run this as.

2) In the #define's in dgamelaunch.c and dgamelaunch.h, change the
values for those directories, sort of using my own directory setup
as an example.

3) Compile nethack, and basically tell it that /var is its playground,
since it will be in the chroot environment. There should be no need
for special nethack compilation instructions, but it will need to be 
installed to the chroot environment. A static compile will ensure that
it can run without any libraries, or you can of course place libraries
in the environment.

For security reasons, I'd avoid putting any shells, etc, in this environment
though, of course. Just whatever needs to be exec'd, which is namely,
nethack.

4) Be sure to set the user id's in the #define's of dgamelaunch to
the owner of the chroot directory, so nethack and dgamelaunch have
access to their files. This user needs a lot of write access, but
you can leave the executables owned by someone else.

5) Either setup dgamelaunch as the shell for a single login, in which
case it must be suid root (don't worry. It sheds privs right after the
immediate chroot), or set it up as an inetd service. I use the following
lines for my xinetd.conf.

service telnet
{
  socket_type     = stream
  protocol  = tcp
  wait      = no
  user      = root
  server    = /usr/sbin/in.telnetd
  server_args     = -h -L /opt/nethack/nethack.dtype.org/dgamelaunch
  rlimit_cpu      = 3600
  bind      = 64.71.163.206
}

A classic inetd line would look like this:

telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /usr/sbin/dgamelaunch

In both cases, the -L specifies an alternate login program (telnetlogin is
invoked by default) and -h prevents revealing of a login banner (for example,
"Debian GNU/Linux testing/unstable influx") before starting the login shell.

6) Populate /chrootdir/etc/terminfo with terminfo files. I think that most
modern ncurses will default to terminfo when it is available. Mine seemed
to. This also makes it easy to add term types on the fly.

7) You can test your compilation of dgamelaunch by simply running
it as root, just as a shell (with suid) or inetd might do.