The rewrite.txt file resides in the NOS directory. The rewrite.txt file contains specific instructions that the SNOS program uses to process packet messages (i.e. private messages, email, newsgroup articles, and bulletins) received from: the SNOS packet mail server (BBS) console; remote users or other BBS stations; and client computers that are attached directly to the packet node computer via their Ethernet / Local Area Network interfaces. SNOS evaluates the destination address of each received message against a set of parameters in the file, rewrites the destination address of the message if necessary and attaches a tag based on any applicable instructions found, and then posts the message in the /nos/msg directory. The applied tag value is posted to the /nos/sys/msg.db database.
Tags identified in the rewrite.txt file are used by two other files found in the NOS directory. They are FORWARD.TXT and PERMITS.TXT. The tag identifier established in the rewrite file must also appear in these two files where applicable.
The SNOS program reads the rewrite file from top to bottom. When building or modifying the rewrite.txt file, the SYSOP must take care not to have any duplicate parameter entries with conflicting instructions, if this condition exists then SNOS applies the designated instructions associated with the last matched parameter that is read.
The file contents are formated in the following manner: <message type [ p | b | t ] where p=private, b=bulletin, t=traffic> <evaluation parameter> <tag string> <rewrite string>. The asterisk ( * ) is used as a wildcard indicating that all characters leading or following the evaluation parameter will be accepted. The variable ( $1 ) contains the original character string (accepted by the leading wildcard * value in the evaluation parameter) that will be attached to the new rewritten destination address.
The following detailed example illustrates the above stated rules. Original addressed bulletin message b sysop@usa.noam is received by the SNOS BBS. SNOS evaluates the message address and finds the applicable evaluation parameter and instruction set b *@usa* usa $1@usa in the rewrite.txt file. SNOS then rewrites the destination address and assigns the tag. The result is displayed on the BBS as b sysop@usa with the tag usa.
Displayed below is a detailed working example rewrite.txt file. Note that lines beginning with a semi-colon are viewed as a remarks or comments and are ignored by the SNOS program.
; REWRITE.TXT FILE FOR NODE: orcy.ka7ijk ; Modification History ; 26aug05: Cleaned & updated file. ; 27aug05: Added rewrite instructions for NMAR:KD7NKN ; 16sep05: Added several BBS locations and tagged for smzpj ;MESSAGE REWRITE FORMAT: ;Msg-Type=(p|b|t) [User/Group@BBS/Region] [TAG] [Rewrite User/Group@BBS/Region] ; ;---------------------------------------------------- ; Clean up misrouted WP queries and updates. p wp@* smqdn wp@n7qdn.or.usa.noam ;---------------------------------------------------- ; Mail requiring special treatment ;---------------------------------------------------- ; Leave my own mail here. p ka7ijk@* ka7ijk p ka7ijk ka7ijk p sysop ka7ijk ;---------------------------------------------------- ; Local users get a mailbox of their callsign. p *@ka7ijk* $1 ;---------------------------------------------------- ; Incoming bulletins from AX.25 BBS systems. b *@wwa wwa b *@ww* ww $1@ww b *@usa* usa $1@usa b *@usbbs usa $1@usa b *@allus usa $1@usa b *@allusa usa $1@usa b *@pnw pnw b *@pdx pdx b *@or or b *@usw usw b *@amsat* amsat $1@amsat b *@arrl arrl b *@arl arrl $1@arrl b *@noam noam b *@ca usa $1@usa ;---------------------------------------------------- ; Private messages that get delivered via SMTP. ; May arrive via SMTP, or from an AX.25 BBS system. p smqdn@* smqdn smqdn@jenne.smqdn.ampr.org p kb7zpj@* smzpj kb7zpj@fshcrn.kb7zpj.ampr.org p k7iqi@* smiqi k7iqi@cedar.k7iqi.ampr.org p w0rli@* smrli w0rli@paret.w0rli.ampr.org p wa7ne@* smlt wa7ne@w7lt.ampr.org p w7lt@* smlt wa7ne@w7lt.ampr.org p n7ifj@* smifj n7ifj@n7ifj.ampr.org p kd7nkn@* smnkn kd7nkn@nmar.kd7nkn.ampr.org p n7yss@* smyss n7yss@hcknsn.n7yss.ampr.org p ka7agh@* smagh ka7agh@greshm.ka7agh.ampr.org p n7qqu@* smqqu n7qqu@areswc.n7qqu.ampr.org p kd7zdo@* smzdo kd7zdo@clkoem.kd7zdo.ampr.org p wb7awl@* smawl wb7awl@clmt.wb7awl.ampr.org p w7oem@* smoem w7oem@oem.w7oem.ampr.org ;---------------------------------------------------- ; These are delivered to the public Internet server ; mail.bctonline.com p *.com smbct p *.edu smbct p *.gov smbct p *.mil smbct p *.net smbct p *.org smbct ;---------------------------------------------------- ; Private messages that forward to local BBS systems (OR and WA). p *@kb7zpj* smzpj p *@w0rli* smrli p *@kc7zzx* smzzx p *@ka7agh* smagh p *@kd7nkn* smnkn p *@n7yss* smyss $1@n7yss.wa.usa.noam p *@n7qdn* smqdn $1@n7qdn.or.usa.noam p *@n7qqu* smiqi p *@w7fbm* smqdn p *@n7pdx* smqdn p *@wa7sjn* smqdn p *@w7lt* smlt p *@k7iqi* smiqi p *@w7ver* smiqi p *@kb7ogd* smiqi p *@kg7lx* smiqi p *@wc7eoc* smiqi p *@kd7zdo* smzdo p *@ka0dfn* smzpj p *@kk7xo* smzpj p *@wx7mfr* smzpj p *@n7zwu* smzpj p *@w7flo* smzpj p *@n7hl* smzpj ;---------------------------------------------------- ; Continents, countries in noam p *@*.as smqdn p *@*.af smqdn p *@*.eu smqdn p *@*.euro smqdn p *@*.oc smqdn p *@*.sa smqdn p *@*.soam smqdn p *@*.can.* smqdn ;---------------------------------------------------- ; States p *@*.al.usa.* smqdn p *@*.ak.usa.* smqdn p *@*.ar.usa.* smqdn p *@*.az.usa.* smqdn p *@*.ca.usa.* smqdn p *@*.co.usa.* smqdn p *@*.ct.usa.* smqdn p *@*.de.usa.* smqdn p *@*.fl.usa.* smqdn p *@*.ga.usa.* smqdn p *@*.hi.usa.* smqdn p *@*.ia.usa.* smqdn p *@*.id.usa.* smqdn p *@*.il.usa.* smqdn p *@*.in.usa.* smqdn p *@*.ks.usa.* smqdn p *@*.ky.usa.* smqdn p *@*.la.usa.* smqdn p *@*.ma.usa.* smqdn p *@*.md.usa.* smqdn p *@*.me.usa.* smqdn p *@*.mi.usa.* smqdn p *@*.mo.usa.* smqdn p *@*.mn.usa.* smqdn p *@*.ms.usa.* smqdn p *@*.mt.usa.* smqdn p *@*.nc.usa.* smqdn p *@*.nd.usa.* smqdn p *@*.ne.usa.* smqdn p *@*.nh.usa.* smqdn p *@*.nm.usa.* smqdn p *@*.nj.usa.* smqdn p *@*.nv.usa.* smqdn p *@*.ny.usa.* smqdn p *@*.oh.usa.* smqdn p *@*.ok.usa.* smqdn p *@*.pa.usa.* smqdn p *@*.sc.usa.* smqdn p *@*.sd.usa.* smqdn p *@*.tn.usa.* smqdn p *@*.tx.usa.* smqdn p *@*.ut.usa.* smqdn p *@*.va.usa.* smqdn p *@*.vt.usa.* smqdn p *@*.wa.usa.* smqdn p *@*.wi.usa.* smqdn p *@*.wv.usa.* smqdn p *@*.wy.usa.* smqdn ;---------------------------------------------------- ; NTS traffic t 97004@ntsor NTS t 97004@ntsor NTS t 97017@ntsor NTS t 97027@ntsor NTS t 97038@ntsor NTS t 97042@ntsor NTS t 97045@ntsor NTS t *@ntswa w0rli ;---------------------------------------------------- ; Toss the rest elsewhere. p * KA7IJK |
Written by KA7IJK, September 17, 2005