Thread View: news.software.nntp
1 messages
1 total messages
Started by Ronald F. Guilmette
Thu, 28 Sep 1995 00:00
ANNOUNCING: A new way to get a do-it-yourself newsfeed.
Author: Ronald F. Guilmette
Date: Thu, 28 Sep 1995 00:00
Date: Thu, 28 Sep 1995 00:00
280 lines
14678 bytes
14678 bytes
A New Recipe for Getting a Fast, Efficient,
and Reliable Do-It-Yourself Newsfeed
====================================
(WARNING: This document assumes that you are at least somewhat familiar
with USENET news and with the concept of a ``newsfeed'', and that you are
maintaining one or more UNIX systems at a small site where all you have is
a SLIP or PPP connection to the Internet which has been provided to you
by either an ordinary contracted Internet Service Provider or, at any rate,
by someone you know. If one or more of these conditions do not apply to
you, then save yourself some time and don't even bother reading this
document. It isn't for you.)
I have enhanced the batcher program supplied with INN 1.4 (unoff2) so that
it incorporates much of the functionality of the `suck' program for getting
a ``do it yourself'' news feed (typically from your Internet Service Provider's
machine). Using this enhanced batcher is better than using suck however,
because the load on the remote system is even lower than with suck and,
more importantly, is it easier to recover from data communications failures
when using the new batcher.
The new batcher code is available via anonymous FTP as:
ftp.ccnet.com:~ftp/users/rfg/freeware/inn/src/batcher.c
The revised man page for batcher is available as:
ftp.ccnet.com:~ftp/users/rfg/freeware/inn/man/batcher.8.in
In order to use the new batcher, you should first configure, build, and
install some type of news system (e.g. either INN or Cnews) on your own
computer. Once you have done that, you should then fetch the source for
the INN 1.4 ``unoff2'' release and copy it to your shell account on your
ISP's system. It can be obtained via anonymous FTP as:
ftp.math.psu.edu:~ftp/pub/inn1.4unoff2.tar.gz
Once you have this, run gunzip on it and untar it into a directory in
your ISP shell account. Then replace the file backends/batcher.c
with the replacement you obtained from ftp.ccnet.com (see above)
and replace the file doc/batcher.8 with the file batcher.8.in that
you got from ftp.ccnet.com.
Once you have done these things, select a suitable config.data file
for your ->ISP's system<- from the `UNOFF-NOTES' subdirectory of the
inn1.4unoff2 distribution, copy it into the config directory, make
whatever adjustments are necessary to reflect the location of various
news-related files and directories on your ISP's system. (Hunt around
if you have to, but note that the only pathnames that are really important
as far as batcher is concerned are the ones for _PATH_ACTIVE, _PATH_SPOOL,
_PATH_BATCHDIR, and _PATH_ERRLOG. The rest will make no difference.)
Finally, type `make' in the config directory. This will cause the `subst'
program to be built and executed which in turn will cause all of the
relevant pathnames and such to be substituted in (automatically) to the
new doc/batcher.8 file.
Then go over to the doc directory and do:
nroff -man batcher.8 | more
and read the new (revised) man page for the new batcher program. Once
you have done that, you can just cd into the backends/ directory and type
`make batcher'. You really don't need to build the whole inn1.4unoff2
distribution on your ISP's system. All you need is a binary of the new
batcher program. Once you have a suitable binary of the enhanced batcher
program, put it someplace where it will be in your path. (If you have
your own private bin/ directory for your shell account on your ISP's
system, put it there.) Likewise for the subst'ed batcher.8 man page.
If you have a private place for man page files, copy the batcher.8 file
there.
If you just want to skip all this hassle, and if your ISP happens to
be running SunOS 4.1.x on Sparc machine (which is fairly typical),
you can just grab a pre-built binary of the enhanced batcher program
from:
ftp.ccnet.com:~ftp/users/rfg/freeware/inn/bin-sunos-4.1/batcher
Note however that in order to use this pre-built binary, you will have to
set some environment variables. Specifically:
_PATH_ACTIVE
_PATH_SPOOL
_PATH_BATCHDIR
_PATH_ERRLOG
(Actually, you might not have to set the last two, but setting the first
two is mandatory.) Set the _PATH_ACTIVE environment variable to the full
pathname of your ISP's active file. Set the _PATH_SPOOL environment variable
to the full pathname of your ISP's spool directory. Finally, set the last
two to anything you want, but I recommend using the pathname of your own
home directory (on the ISP's machine), i.e. $HOME for _PATH_BATCHDIR and
using $HOME/errlog for the value of _PATH_ERRLOG.
A man page file which has already been pre-subst'ed so that it mentions
all of the same pathnames which will be used (by default) by the pre-built
SunOS binary of the batcher may be obtained via:
ftp.ccnet.com:~ftp/users/rfg/freeware/inn/man/batcher.8
Once you have the batcher all setup, you also need to create an update
file on the ISP's machine. This has the same format as a ``sucknewsrc''
file, i.e. each line contains one entry, and each entry consists of
the name of a single newsgroup you want to get, followed by a single blank,
followed by a number. Make all of the numbers zero initially.
Finally, fetch the source file:
ftp.ccnet.com:~ftp/users/rfg/freeware/inn/src/writeport.c
and build it on your ISP's system and install it somewhere where it will
be on your path. On any fairly POSIX-compliant system, you should just
be able to build it via:
cc -O -o writeport writeport.c
or else:
gcc -O -o writeport writeport.c
but if that doesn't work try:
cc -BSunOS4 -O -o writeport writeport.c
Finally, put the resulting `writeport' binary somewhere where it will be
on your path. Last but not least, create your own `getnews' script. It
should look something like this:
#!/bin/sh
batcher -u $HOME/update -b 300000 -p 'gzip | writeport my.dom.ain 666'
Select any value for the -b option you want. (I use 300000.) Where it
says `my.dom.ain' in this example, put the fully-qualified domain name of
your own machine. Where is says `666', pick any number that doesn't
conflict with any previously reserved port numbers listed in your own
/etc/services file. (I use a number in the high five thousands.)
Once you have created your private `getnews' script, stash it somewhere
where it will be on your path, and set its mode so that it will be executable.
When you have that all done, go back to your own system and create a small
script named `gunzip-rnews' which will look like:
#!/bin/sh
/usr/local/gnu/bin/gunzip | /usr/local/news/bin/rnews
Note that the pathnames used here are for example purposes only. You will
have to find the full pathnames for the gunzip and rnews utilities on
your own system and use those instead. Don't use relative pathnames or
just the name of the `gunzip' and `rnews' programs here as that might
cause insecurities. Once you have created this script, stash it somewhere
obvious _and_ public (like /usr/local/bin) and set its mode so that it
is executable.
Once you have that script in place, edit your /etc/services file and add
an entry for the new gunzip-rnews service. It should look roughly as
follows:
gunzip-rnews 666/tcp # gunzip | rnews
except that you should use whatever port number you decided to use in your
``getnews'' script (above) in place of the ``666'' here.
Finally, you also need to make an entry for the gunzip-rnews service in your
/etc/inetd.conf file. It should like roughly as follows:
gunzip-rnews stream tcp nowait nobody /usr/local/bin/gunzip-rnews gunzip-rnews
Check your /etc/passwd file and see if you already have a ``nobody'' user-ID
established on your system. If not, either create one or else use ``news''
instead of ``nobody'' in the /etc/inetd.conf file entry.
Whichever user-ID you choose to use (either `nobody' or else `news') make
sure that the `gunzip-rnews' script that you created earlier is in fact
executable to that user-ID.
That's it. You are done. Assuming that you have a properly working news
system already installed on your own system, and assuming that your ISP
has a properly working news system installed on _his_ system, and assuming
that you didn't mess up anywhere, you should now be able to log into your
ISP shell account and just type `getnews' to have batches of news transferred
efficiently down to your system. If you ever get a data transmission
failure (e.g. because either your modem or your ISP's modem decided to
take an unexpected nap all of a sudden), no problem. Just log in again
and type `getnews' again. The new batcher will pick up almost where it
left off. But it _will_ have to backup back to the start of the most
recent batch, i.e. the batch that it was trying to send when the data comm
failure occurred. (So if your connection goes down a lot it would be a
good idea to use a small batch size... like for example batcher's default
size of only 61440 bytes per batch.) Note that whatever the batch size
is set to in your getnews script, the actual batch size transmitted over
the comm line will be much smaller because each batch will have been gzipped
after it was created (and news articles gzip real well, usually yielding
compression ratios in the range of 1:3 all the way to 1:9 or so).
If either you or your ISP don't have gzip and gunzip lying around already...
well.. you should get them and install them. But if you don't want to do
that, good old compress and uncompress can be used in place of gzip and
gunzip.
If you can't (or won't, for security reasons) use a TCP/IP port on your
system as a logical tube through which you will transmit the gzipped news
batches, you can just as easily use sendmail as your communications carrier
for the incoming gzipped news batches. To do this, you would use the
following in your getnews script in place of the -p option shown in the
example getnews script which was shown above:
-p 'gzip | uuencode | mail gunzip-rnews@my.dom.ain'
Then, over on your system, you would need to create an alias in your
/etc/aliases (or /etc/mail/aliases) file which would look like:
gunzip-rnews: /bin/uudecode -p |/usr/local/bin/gunzip |/usr/local/news/bin/rnews
(Remember to run `newaliases' after you do this.)
If you do this, be ABSOLUTELY sure that you use the -p option for uudecode.
Failure to do so will almost surely result in a big (and well known) security
hole in your system, and may void your warranty. :-)
As mentioned above, once you have installed all of the stuff described herein,
all you need to do to get your news system up-to-date relative to your ISP's
news system is to log into your ISP shell account and type `getnews' and
then just wait awhile while the gzipped batches come streaming in.
Be careful though. The first time you do this, if you have put the names
of a lot of newsgroups into your update file (or even just the names of
a few high-volume newsgroups) you are going to be getting a rather big
flood of news when you first turn on the spigot. After you get up-to-date
(relative to your ISP) the first time however, the news flow should settle
down to a more reasonable pace, and doing a `getnews' again a few times
each week should get your your news with a minimum of connect-time for
each session.
One final note. You probably want to have some way of insuring the your
new `getnews' script is executed consistently (and automatically, if possible)
over on your ISP's system on a fairly regular basis... like at least once
a day or so. There are many ways of accomplishing this, but the important
thing to remember is that it is pointless to have the getnews script started
up during periods where your own system doesn't have its SLIP or PPP link
up and running at the present time. (If you ever do this, the getnews
script will just die immediately because the writeport program won't be
able to connect to your machine.) so it would, for example, be kind-of
silly and pointless to ask your ISP to invoke your getnews script
regularly (for example as a cron job on his system) unless you could
make sure that your dial-up SLIP or PPP link was always up and running
each time the getnews script actually got executed. But that would be
a potentially tricky thing to do.
Actually, the easiest way to insure that the getnews script will get
executed (over on your ISP's system) on a regular basis is to get
yourself a dial-on-demand implementation of either SLIP or PPP, and
then to put a .rhosts file in your home directory over on your ISP shell
account specifying your local machine as a valid remote host which is
allowed to use that shell account, and finally to setup a cron job (to
run once each night, say in the middle of the night) on your _local_
machine which will do something like:
rsh isp.com -l my-user-id getnews
This ought to insure that you get fresh news updates automatically every
night.
Alternatively, some SLIP and PPP implementations allow you to set things
up so that certain pre-written commands can be automatically executed each
and every time the link is reestablished. If you are fortunate enough to
have one of these you can add the above command to the set of commands
that get executed each time your bring up your link (perhaps as a background
job).
P.S. My patches to the INN batcher program, as well as the entire source
for my simple `writeport' program are both covered under the same sort of
(very permissive) copyright as is INN itself... except that _I_ am the
copyright holder. Please remember that if you incorporate any of this
stuff into any products, and please remember to give me the proper credit.
--
-- Ron Guilmette, Roseville, CA -------- Infinite Monkeys & Co. ------------
---- E-mail: rfg@monkeys.com ----------- Purveyors of Compiler Test Suites -
----------------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads