home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2371 / GATE.README next >
Encoding:
Text File  |  1990-12-28  |  6.5 KB  |  202 lines

  1. GATE
  2. ----
  3. Verion 1.0
  4.  
  5. Clay Luther, 1990
  6.  
  7. Synopsis:  Transfer mail to a news group, and news from that news group back
  8.            to mail.  In effect, become a news/mail gateway.
  9.  
  10. [ It's a hack, yes, but it's a nice hack. ]
  11.  
  12. Gate is made up of 2 scripts, and a very slightly hacked version of the C News
  13. inews.
  14.  
  15. gatemail:  Transfer a mail article (taken from stdin) to a news group via inews.
  16.  
  17. gatenews:  Transfer an article from news to a mailing list.
  18.  
  19. inews.new: An inews hack that allows the specification of no signature
  20.            inclusion (-z).
  21.  
  22.  
  23. Assumptions
  24. -----------
  25.  
  26. These programs were written with the assumption you are running C News and
  27. a mailing program that allows mail to be piped to a program via an alias (aka
  28. sendmail or smail via the aliases file).  The C News dependency is only
  29. reflected in the use of inews.new, which is simply the C News inews script
  30. with about 4 lines of code added to suppress the inclusion of the executor's
  31. .signature file.
  32.  
  33.  
  34. SETUP
  35. -----
  36.  
  37. [ The directories and file names given are what gatenews and gatemail expect.
  38.   You may easily edit both scripts to change these values. ]
  39.  
  40. [ Below, I will assume that mail is coming from some mailing list called 
  41.   goof-l@foo.com. ]
  42.  
  43. Copy gatemail, gatenews, and inews.new to /usr/lib/news.  Make sure they are
  44. +rw to everyone.
  45.  
  46. Next, create some mailing aliases.  You should have an incoming mail alias and
  47. an outgoing mail alias.  They should be set up as:
  48.  
  49. #incoming alias
  50. goof:"|/usr/lib/news/gatemail goof-l alt.goof"
  51. #outgoing alias
  52. goof-l:goof-l@foo.com
  53.  
  54. Create a sys entry for the gateway in /usr/lib/news/sys:
  55.  
  56. goof-l:alt.goof/all:F:/usr/spool/news/gatenews/goof-l
  57.  
  58. [ gatenews looks in /usr/spool/news/gatenews by default ]
  59. Next, create a cron entry for gatenews (run by news, preferably):
  60.  
  61. #run gatenews after sendbatches
  62. 50 * * * * /usr/lib/news/gatenews goof-l goof-l goof
  63.  
  64. Subscribe to goof-l@foo.com as goof@your.site.
  65.  
  66. Finally:
  67.  
  68. addgroup alt.goof y
  69.  
  70. Your set.
  71.  
  72. What's Going On Here?
  73. ---------------------
  74.  
  75. Mail from the mailing list arrives at your site and is handed to the gatemail
  76. program via stdin.
  77.  
  78. gatemail goof-l alt.goof < mail
  79.  
  80. The goof-l parameter states the real name of the mailing list.  The second
  81. parameter states what group to post this article to.
  82.  
  83. Gatemail strips the mail headers off the mail after first grepping out the
  84. subject, from, and reply-to lines.  It then adds a range of news headers:
  85.  
  86. Newsgroups: [set to alt.goof (aka parameter $2)]
  87. From: [set to the From: line of the message]
  88. Subject: [set to the Subject: of the message]
  89. Reply-To: [set to the From: line of the message]
  90. Organization: [set to the string "Gated to News by your.site"]
  91. Path: [set to goof-l (aka the group name aka your alias for the mailing list)]
  92. Sender: [set to the Reply-To: line of the message]
  93. Lines: [set to the number of lines in the message]
  94.  
  95. The Path and Organization headers are especially important.  Gatenews (the
  96. other script) checks the Organization header to determine if the news article
  97. was gated to news from mail (and therefore should not be sent the other way).
  98. The Path gives a valid path back through your machine to the mailing list by
  99. way of your alias for the mailing list.
  100.  
  101. One last thing, gatenews installs a faux header "X-Gateway:" in articles
  102. gated to mail.  If gatemail detects this X-Gateway: header (and it is from
  103. this host), then the mail is appropriately ignored.
  104.  
  105. Here is a sample of how gatemail would work:
  106.  
  107. A Message comes in from goof-l:
  108.  
  109. From utacfd.utarl.edu!mdaeng!goof-l@supernet.haus.com Wed Dec 19 13:52:06 1990
  110. Return-Path: <utacfd.utarl.edu!mdaeng!goof-l@supernet.haus.com>
  111. Received: from supernet.haus.com by enigma.haus.com (4.1/SMI-4.1)
  112.         id AA00646; Wed, 19 Dec 90 13:52:05 CST
  113. Received: by supernet.haus.com (/\=-/\ Smail3.1.18.1 #18.16)
  114.         id <m0im9kD-0009NeC@supernet.haus.com>; Wed, 19 Dec 90 13:46 CST
  115. Received: from mdaeng.UUCP by utacfd.utarl.edu with UUCP (4.0/25-eef)
  116.         id AA14147; Wed, 19 Dec 90 13:26:02 CST
  117. Received:  by mdaeng.mdaeng.com (4.0/25-eef)
  118.         id AA10913; Wed, 19 Dec 90 12:48:50 CST
  119. Date: Wed, 19 Dec 90 12:48:50 CST
  120. From: mdaeng!rwn@utacfd.utarl.edu (Ralph Noack)
  121. Reply-To: mdaeng!goof-l@utacfd.utarl.edu (Goofball Mailing List)
  122. Message-Id: <9012191848.AA10913@mdaeng.mdaeng.com>
  123. To: goof@enigma.haus.com
  124. Subject: Just Testing
  125.  
  126. This is just a friendly sample thingy.
  127.  
  128. This gets intercepted by the goof alias and piped to:
  129.  
  130. gatemail goof-l alt.goof
  131.  
  132. which produces the article:
  133.  
  134. Newsgroup: alt.goof
  135. From: mdaeng!rwn@utacfd.utarl.edu (Ralph Noack)
  136. Subject: Just Testing
  137. Reply-To: mdaeng!rwn@utacfd.utarl.edu (Ralph Noack)
  138. Organization: Gated to News by enigma.haus.com
  139. Path: goof-l
  140. Sender: mdaeng!goof-l@utacfd.utarl.edu (Goofball Mailing List)
  141. Lines: 2
  142.  
  143. This is just a friendly sample thingy.
  144.  
  145. This gets piped to inews -z -h.  The -z option supresses the .signature
  146. inclusion.  Inews will post the article to alt.goof.
  147.  
  148.  
  149. On the other side, gatenews is pulling stuff off news and sending it to the
  150. mailing list.
  151.  
  152. Every hour (or whenever), sendbatches executes and creates the file
  153.  
  154. /usr/spool/news/gatenews/goof-l
  155.  
  156. which contains a list of file names of articles in alt.goof that need to be
  157. mailed (or might need to be mailed).
  158.  
  159. After sendbatches is run, gatenews is run
  160.  
  161. gatenews goof-l goof-l goof
  162.  
  163. where the first parameter is the address/alias to mail the articles to, the
  164. second parameter is the name of the spool file in /usr/spool/news/gatenews,
  165. and goof is the local alias of the mailing list (need to set the From: line of
  166. the article viz mail).
  167.  
  168. Gatenews processes the articles in the spool file one by one.  First, it checks
  169. the message id's of the article against a log file; if the message id is in the
  170. log file, then the article is not mailed.  Next, the Organization: line is 
  171. checked.  If it is equal to "Gated to News by <this.site>", then the article
  172. is not mailed.
  173.  
  174. If the article gets past those tests, then it is assumed to be OK for mailing.
  175. The From: and Subject: lines are grepped out of the article and the rest of the
  176. headers are trashed.  The mailer program is then called, setting the appropriate
  177. fields and piping the rest of the article to it.
  178.  
  179. In the original gatenews, fastmail is used.  Fastmail is part of the Elm
  180. package.  Sendmail could be used instead, but you will have to hack the line
  181. that performs the mailing in gatenews.
  182.  
  183. Gatenews logs the message in its log file and cleans up.
  184.  
  185.  
  186. Other Files
  187. -----------
  188.  
  189. /usr/lib/news/gatemail.log
  190. /usr/lib/news/gatenews.log 
  191.  
  192.  
  193. If you have any questions or ESPECIALLY enhancements or suggestions, please
  194. mail me at
  195.  
  196.  
  197. cluther@supernet.haus.com
  198. uunet!supernet!cluther
  199.  
  200. Clay Luther
  201.  
  202.