home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / bsd / 10695 < prev    next >
Encoding:
Internet Message Format  |  1992-12-28  |  13.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!easix!knobel!andreas
  2. From: andreas@knobel.GUN.de (Andreas Klemm)
  3. Newsgroups: comp.unix.bsd
  4. Subject: [386BSD] sendmail.cf hack, establish "uucp only" connection
  5. Summary: uucp only connection to a relay host
  6. Keywords: sendmail.cf
  7. Message-ID: <110@knobel.GUN.de>
  8. Date: 27 Dec 92 23:48:58 GMT
  9. Organization: Andreas Klemm, 4040 Neuss, Germany
  10. Lines: 519
  11.  
  12. Hello !
  13.  
  14. After hours of trying out different sendmail configuration options
  15. I found a way to tell sendmail to send mail (!local) to a mail host
  16. or relay host specified with the define DR.
  17.  
  18. The sendmail.cf as being shipped with 386bsd 0.1 didn't work for me.
  19.  
  20. Internet adresses via the Muucp mailer were treated as local
  21. addresses which couldn't be resolved.
  22.  
  23. Building a new sendmail.cf from scratch using m4 
  24. (see /usr/src/usr.sbin/sendmail/cf/cf/uucpproto.mc) didn't work
  25. properly, too.
  26.  
  27. The reason is, that in the machine dependend part of rule zero
  28. (end of sendmail.cf) a line is missing to tell sendmail to send 
  29. internet mail to a formerly specified relay host 
  30. before finally trying to resolve the mail locally.
  31.  
  32. Below is my sendmail.cf file. Changed or important lines are marked
  33. with ^^^^^^^^^^^^^^^^^^^
  34.  
  35. Hope it's usefull.
  36. BTW: use it on your own risk ...
  37.  
  38. Bye
  39.     Andreas Klemm
  40.  
  41. --
  42. ////// Andreas Klemm \\\\\\     /////// andreas@knobel.GUN.de \\\\\\\
  43. private : +49 2137 12609        D-4040 Neuss 21 (Norf), Germany
  44. at work : +49 2173 3964 165     Wiechers & Partner   Datentechnik GmbH
  45. Telefax : +49 2173 3964 222     Abteilung Unix Support, D-4019 Monheim
  46.  
  47.  
  48. #
  49. #  Sendmail
  50. #  Copyright (c) 1983  Eric P. Allman
  51. #  Berkeley, California
  52. #
  53. #  Copyright (c) 1983 Regents of the University of California.
  54. #  All rights reserved.  The Berkeley software License Agreement
  55. #  specifies the terms and conditions for redistribution.
  56. #
  57. #    @(#)uucpproto.mc    1.2 (Berkeley) 1/24/89
  58. #    @(#)proto.mc    1.20 (Berkeley) 1/25/89
  59. #
  60. # built by root on Sun Dec 27 19:22:17 MET 1992
  61. # in /usr/src/usr.sbin/sendmail/cf/cf on knobel.GUN.de
  62. #
  63. ############################################################
  64. ############################################################
  65. #####
  66. #####        SENDMAIL CONFIGURATION FILE
  67. #####
  68. ############################################################
  69. ############################################################
  70.  
  71.  
  72. ##################
  73. #   local info   #
  74. ##################
  75.  
  76. # file containing our internet aliases
  77. # Fw/etc/sendmail.cw
  78. # ^^^^^^^^^^^^^^^^^^
  79.  
  80. # uucp hostnames
  81. DUknobel
  82. CUknobel.GUN.de
  83. DMuucp
  84. DReasix
  85. CReasix
  86. #^^^^^^^^^^^^^^^^
  87.  
  88. ######################
  89. #   General Macros   #
  90. ######################
  91.  
  92. # local domain name
  93. DDGUN.de
  94. #^^^^^^^^^^^^^^^^
  95.  
  96. # my official hostname
  97. Dj$w
  98.  
  99. ###############
  100. #   Classes   #
  101. ###############
  102.  
  103. # Internal ("fake") domains that we use in rewriting
  104. # CIUUCP BITNET CSNET
  105.  
  106. ######################
  107. #   Version Number   #
  108. ######################
  109.  
  110. DZ1.34
  111.  
  112.  
  113. ######################
  114. #   Special macros   #
  115. ######################
  116.  
  117. # my name
  118. DnMAILER-DAEMON
  119. # UNIX header format
  120. DlFrom $g  $d
  121. # delimiter (operator) characters
  122. Do.:%@!^=/[]
  123. # format of a total name
  124. # Dq$g$?x ($x)$.
  125. #
  126. # does somebody know a better solution ?
  127. # I want an internet address, no bang path in the From: line
  128. #
  129. Dq$f@knobel.GUN.de ($x)$.
  130. #^^^^^^^^^^^^^^^^^^^^^^^^^
  131. # SMTP login message
  132. De$j Sendmail $v/$Z ready at $b
  133.  
  134. ###############
  135. #   Options   #
  136. ###############
  137.  
  138. # location of alias file
  139. OA/etc/aliases
  140. #^^^^^^^^^^^^^^^^^^^^^^^^^
  141. # wait up to ten minutes for alias file rebuild
  142. Oa10
  143. # substitution for space (blank) characters
  144. OB.
  145. # (don't) connect to "expensive" mailers
  146. #Oc
  147. # default delivery mode (deliver in background)
  148. Odbackground
  149. # temporary file mode
  150. OF0600
  151. # default GID
  152. Og1
  153. # location of help file
  154. OH/usr/share/misc/sendmail.hf
  155. #^^^^^^^^^^^^^^^^^^^^^^^^^
  156. # log level
  157. OL9
  158. # default network name
  159. ONUUCP
  160. #^^^^^^^^^^^^^^^^^^^^^^^^^
  161. # default messages to old style
  162. Oo
  163. # queue directory
  164. OQ/var/spool/mqueue
  165. #^^^^^^^^^^^^^^^^^^^^^^^^^
  166. # read timeout -- violates protocols
  167. Or2h
  168. # status file
  169. OS/var/log/sendmail.st
  170. # queue up everything before starting transmission
  171. Os
  172. # default timeout interval
  173. OT3d
  174. # time zone names (V6 only)
  175. OtMET
  176. # default UID
  177. Ou1
  178. # wizard's password
  179. OW*
  180. # load average at which we just queue messages
  181. Ox8
  182. # load average at which we refuse connections
  183. OX12
  184.  
  185. ###########################
  186. #   Message precedences   #
  187. ###########################
  188.  
  189. Pfirst-class=0
  190. Pspecial-delivery=100
  191. Pbulk=-60
  192. Pjunk=-100
  193.  
  194. #####################
  195. #   Trusted users   #
  196. #####################
  197.  
  198. Troot
  199. Tdaemon
  200. Tuucp
  201.  
  202. #########################
  203. #   Format of headers   #
  204. #########################
  205.  
  206. H?P?Return-Path: <$g>
  207. HReceived: $?sfrom $s $.by $j ($v/$Z)
  208.     id $i; $b
  209. H?D?Resent-Date: $a
  210. H?D?Date: $a
  211. H?F?Resent-From: $q
  212. H?F?From: $q
  213. H?x?Full-Name: $x
  214. HSubject:
  215. # HPosted-Date: $a
  216. # H?l?Received-Date: $b
  217. H?M?Resent-Message-Id: <$t.$i@$j>
  218. H?M?Message-Id: <$t.$i@$j>
  219.  
  220.  
  221.  
  222. ###########################
  223. ###   Rewriting Rules   ###
  224. ###########################
  225.  
  226.  
  227. ################################
  228. #  Sender Field Pre-rewriting  #
  229. ################################
  230. S1
  231. #R$*<$*>$*        $1$2$3                defocus
  232.  
  233. ###################################
  234. #  Recipient Field Pre-rewriting  #
  235. ###################################
  236. S2
  237. #R$*<$*>$*        $1$2$3                defocus
  238.  
  239.  
  240.  
  241. #################################
  242. #  Final Output Post-rewriting  #
  243. #################################
  244. S4
  245.  
  246. R@            $@                handle <> error addr
  247.  
  248. # resolve numeric addresses to name if possible
  249. R$*<@[$+]>$*        $:$1<@$[[$2]$]>$3        lookup numeric internet addr
  250.  
  251. # externalize local domain info
  252. R$*<$+>$*        $1$2$3                defocus
  253. R@$+:@$+:$+        @$1,@$2:$3            <route-addr> canonical
  254.  
  255. # UUCP must always be presented in old form
  256. R$+@$-.UUCP        $2!$1                u@h.UUCP => h!u
  257.  
  258. # delete duplicate local names
  259. R$+%$=w@$=w        $1@$w                u%host@host => u@host
  260. R$+%$=w@$=w.$D        $1@$w                u%host@host => u@host
  261.  
  262.  
  263. ###########################
  264. #  Name Canonicalization  #
  265. ###########################
  266. S3
  267.  
  268. # handle "from:<>" special case
  269. R$*<>$*            $@@                turn into magic token
  270.  
  271. # basic textual canonicalization -- note RFC733 heuristic here
  272. R$*<$*<$*<$+>$*>$*>$*    $4                3-level <> nesting
  273. R$*<$*<$+>$*>$*        $3                2-level <> nesting
  274. R$*<$+>$*        $2                basic RFC821/822 parsing
  275.  
  276. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  277. R@$+,$+            @$1:$2                change all "," to ":"
  278.  
  279. # localize and dispose of route-based addresses
  280. R@$+:$+            $@$>6<@$1>:$2            handle <route-addr>
  281.  
  282. # more miscellaneous cleanup
  283. R$+            $:$>8$1                host dependent cleanup
  284. R$+:$*;@$+        $@$1:$2;@$3            list syntax
  285. R$+:$*;            $@$1:$2;            list syntax
  286. R$+@$+            $:$1<@$2>            focus on domain
  287. R$+<$+@$+>        $1$2<@$3>            move gaze right
  288. R$+<@$+>        $@$>6$1<@$2>            already canonical
  289.  
  290. # convert old-style addresses to a domain-based address
  291. R$+^$+            $1!$2                convert ^ to !
  292. R$-!$+            $@$>6$2<@$1.UUCP>        resolve uucp names
  293. R$+.$-!$+        $@$>6$3<@$1.$2>            domain uucps
  294. R$+!$+            $@$>6$2<@$1.UUCP>        uucp subdomains
  295. R$+%$+            $:$>9$1%$2            user%host
  296. R$+<@$+>        $@$>6$1<@$2>            already canonical
  297. R$-.$+            $@$>6$2<@$1>            host.user
  298.  
  299.  
  300. #################################
  301. #   special local conversions   #
  302. #################################
  303.  
  304. S6
  305. R$*<@$=w>$*        $:$1<@$w>$3            get into u@$w form
  306. R$*<@$=w.$D>$*        $:$1<@$w>$3
  307. R$*<@$=U.UUCP>$*    $:$1<@$w>$3
  308.  
  309. ################################
  310. #   Change rightmost % to @.   #
  311. ################################
  312.  
  313. S9
  314. R$*%$*            $1@$2                First make them all @'s.
  315. R$*@$*@$*        $1%$2@$3            Undo all but the last.
  316. R$*@$*            $@$1<@$2>            Put back the brackets.
  317.  
  318.  
  319.  
  320. ###################
  321. ###   Mailers   ###
  322. ###################
  323.  
  324.  
  325. ############################################################
  326. ############################################################
  327. #####
  328. #####        Local and Program Mailer specification
  329. #####
  330. ############################################################
  331. ############################################################
  332.  
  333. Mlocal,    P=/usr/libexec/mail.local, F=lsDFMmn, S=10, R=20, A=mail -r $g -d $u
  334. Mprog,    P=/bin/sh,   F=lsDFMe,   S=10, R=20, A=sh -c $u
  335.  
  336. S10
  337. R@            $n            errors to mailer-daemon
  338.  
  339.  
  340.  
  341. ############################################################
  342. ############################################################
  343. #####
  344. #####        Internet SMTP Mailer specification
  345. #####
  346. #####    Messages processed by this specification are assumed to leave
  347. #####    the local domain -- hence, they must be canonical according to
  348. #####    RFC822 etc.  This means that machines not registered with
  349. #####    the NIC must be hidden behind our Internet relay.
  350. #####
  351. ############################################################
  352. ############################################################
  353.  
  354. Mtcp,    P=[IPC], F=mDFMueXLC, S=14, R=24, A=IPC $h, E=\r\n
  355.  
  356. S14
  357.  
  358. # pass <route-addr>'s through
  359. R<@$+>$*        $@<@$[$1$]>$2            resolve <route-addr>
  360.  
  361. # map colons to dots everywhere
  362. R$*:$*            $1.$2                map colons to dots
  363.  
  364. # output local host in user@host.domain syntax
  365. R$-            $1<@$w>                user w/o host
  366. R$+<@$=w>        $:$1<@$w>            this host
  367. R$+<@$->        $:$1<@$[$2$]>            canonicalize into dom
  368. R$+<@$->        $:$1<@$2.$D>            if nameserver fails
  369. R$+<@$=N.$D>        $@$1<@$2.$D>            nic-reg hosts are ok
  370. R$+<@$*.$D>        $@$1%$2.$D<@$A>            else -> u%h@gateway
  371.  
  372. # if not local, and not a "fake" domain, ask the nameserver
  373. R$+<@$+.$~I>        $@$1<@$[$2.$3$]>        user@host.domain
  374. R$+<@[$+]>        $@$1<@[$2]>            already ok
  375.  
  376. # output internal ("fake") domains as "user%host@relay"
  377.  
  378.  
  379.  
  380. R$+<@$+.UUCP>        $@$2!$1<@$w>            user@host.UUCP
  381.  
  382.  
  383. S24
  384.  
  385. # put in <> kludge
  386. R$*<$*>$*        $1$2$3                defocus
  387. R$*            $:$>3$1                now canonical form
  388.  
  389. # pass <route-addr>'s through
  390. R<@$+>$*        $@<@$[$1$]>$2            resolve <route-addr>
  391.  
  392. # map colons to dots everywhere.....
  393. R$*:$*            $1.$2                map colons to dots
  394.  
  395. # output local host in user@host.domain syntax
  396. R$-            $1<@$w>                user w/o host
  397. R$+<@$=w>        $:$1<@$w>            this host
  398. R$+<@$->        $:$1<@$[$2$]>            canonicalize into dom
  399. R$+<@$->        $:$1<@$2.$D>            if nameserver fails
  400. R$+<@$=N.$D>        $@$1<@$2.$D>            nic-reg hosts are ok
  401. R$+<@$*.$D>        $@$1%$2.$D<@$A>            else -> u%h@gateway
  402.  
  403. # if not local, and not a "fake" domain, ask the nameserver
  404. R$+<@$+.$~I>        $@$1<@$[$2.$3$]>        user@host.domain
  405. R$+<@[$+]>        $@$1<@[$2]>            already ok
  406.  
  407. # Hide fake domains behind relays
  408.  
  409.  
  410.  
  411. R$+<@$+.UUCP>        $@$2!$1                user@host.UUCP
  412.  
  413.  
  414.  
  415.  
  416. ############################################################
  417. ############################################################
  418. #####
  419. #####        Provide Backward Compatibility
  420. #####
  421. ############################################################
  422. ############################################################
  423.  
  424. #####################################################
  425. #  General code to convert back to old style names  #
  426. #####################################################
  427. S5
  428.  
  429. R$+<@$w>        $1                strip host
  430. R$+<@$-.UUCP>        $2!$1                u@host.UUCP => host!u
  431.  
  432. ############################################################
  433. ############################################################
  434. #####
  435. #####        UUCP Mailer specification
  436. #####
  437. ############################################################
  438. ############################################################
  439.  
  440.  
  441. Muucp,    P=/usr/bin/uux, F=DFMhuU, S=13, R=23, M=100000,
  442.     A=uux - -r -z -a$f -gA $h!rmail ($u)
  443.  
  444. S13
  445. R$+            $:$>5$1                convert to old style
  446. R$*<@$=w>$*        $1<@$w>$2            resolve abbreviations
  447. R$*<@$->$*        $1<@$2.$D>$3            resolve abbreviations
  448. R$+<@$+>        $2!$1                uucpize (no @'s in addr)
  449. R$w!$+            $1                strip local name
  450. R$+            $:$U!$1                stick on our host name
  451. R$=U!$-%$-        $:$1!$2@$3.$D            ucbvax!user@host.domain
  452.  
  453. S23
  454. R$+            $:$>5$1                convert to old style
  455. R$*<@$=w>$*        $1<@$w>$2            resolve abbreviations
  456. R$*<@$->$*        $1<@$2.$D>$3            resolve abbreviations
  457. R$+<@$w>        $U!$1                a!b@here -> here!a!b
  458. R$=U!$+            $2                here!a!b -> a!b
  459. # sanity ... should not happen.
  460. R$=U.$D!$+        $2                strip local name.domain
  461.  
  462.  
  463.  
  464. #####################
  465. ###   Rule Zero   ###
  466. #####################
  467.  
  468.  
  469. ############################################################
  470. ############################################################
  471. #####
  472. #####        RULESET ZERO PREAMBLE
  473. #####
  474. #####    The beginning of ruleset zero is constant through all
  475. #####    configurations.
  476. #####
  477. ############################################################
  478. ############################################################
  479.  
  480. S0
  481.  
  482. # first make canonical
  483. R$*<$*>$*        $1$2$3                defocus
  484. R$+            $:$>3$1                make canonical
  485.  
  486. # handle special cases
  487. R$*<@[$+]>$*        $:$1<@$[[$2]$]>$3        numeric internet addr
  488. R$*<@[$+]>$*        $#tcp$@[$2]$:$1@[$2]$3        numeric internet spec
  489. R$+            $:$>6$1
  490. R$-<@$w>        $#local$:$1
  491. R@            $#error$:Invalid address    handle <> form
  492.  
  493. # canonicalize using the nameserver if not internal domain
  494. R$*<@$*.$~I>$*        $:$1<@$[$2.$3$]>$4
  495. R$*<@$->$*        $:$1<@$[$2$]>$3
  496. R$*<@$->$*        $:$1<@$2.$D>$3            if nameserver fails
  497.  
  498. # now delete the local info
  499. R<@$w>:$*        $@$>0$1                @here:... -> ...
  500. R$*<@$w>        $@$>0$1                ...@here -> ...
  501.  
  502. ##################################
  503. #  End of ruleset zero preamble  #
  504. ##################################
  505.  
  506.  
  507. ###############################################
  508. ###   Machine dependent part of Rule Zero   ###
  509. ###############################################
  510.  
  511.  
  512.  
  513. # resolve local UUCP connections
  514. R<@$=V.UUCP>:$+        $#uucp$@$1$:$2                @host.UUCP:...
  515. R$+<@$=V.UUCP>        $#uucp$@$2$:$1                user@host.UUCP
  516.  
  517. # all other stuff via $#uucp to relay host $@$R = easix
  518. # Andreas Klemm (andreas@knobel.GUN.de)
  519. # Mon Dec 28 00:42:39 MET 1992
  520. #
  521. R$*<@$*.$+>$*        $#uucp $@$R $:$1<@$2.$3>$4        user@any.domain
  522. #^^^^^^^^^^^^^^^^^^^^^^^^^
  523.  
  524. # remaining names must be local
  525. R$+            $#local$:$1            everything else
  526. -- 
  527. ////// Andreas Klemm \\\\\\     /////// andreas@knobel.GUN.de \\\\\\\
  528. private : +49 2137 12609        D-4040 Neuss 21 (Norf), Germany
  529. at work : +49 2173 3964 165     Wiechers & Partner   Datentechnik GmbH
  530. Telefax : +49 2173 3964 222     Abteilung Unix Support, D-4019 Monheim
  531.