由 Neozhu 在 02-20-2004 11:23 发表:
在redhat9下面配置sendmail的问题!
虽然我看了不少相关的文章,但还没有什么头绪,希望在这里能得到大家的帮助,我系统环境是,我的主机名是linux ip:192.168.141.16 是公司局域网中的一台pc;没有正式ip,,我只想实现在内部的一个简单的收发mail的功能;我现在有很多不明白的地方比如这台机器的域名或是主机名我该怎么定义,是否还要现配置有dns服务等等,希望大虾指点一二,谢谢
由 Snoopy 在 02-20-2004 14:47 发表:
配置 dns,,加mx记录,rh9.0下默认的sendmail只需要修改少少就可以使用
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 moneytea 在 02-20-2004 14:56 发表:
我顺便问一个问题,希望斑竹帮忙
一直用mutt,发送邮件的时候由于使用的是本机的sendmail
,在给一些网站发送邮件的时候经常以下面的理由被退回:
(reason: 554
1<[email protected]>: Sender address rejected: Access
2
3+denied)
4
5我想这大概是sendmail没有被重新设置发送域名的原因,但是我的机器也没有域名阿,
6
7如果设置了一个莫须有的域名,对方的服务器会不会还拒绝我的信件呢?
8
9
10
11还有就是要如何设置呢?
12
13谢谢!
14
15
16
17”rh9.0下默认的sendmail只需要修改少少就可以使用“
18
19这里应该如何设置呢?
20
21
22
23
24* * *
25
26
27_由 Snoopy 在 02-20-2004 15:02 发表:_
28
29
30
31****
32
33
34
35
36
37local-host-names
38
39
40
41# local-host-names - include all aliases for your machine here.
42
43snoopy.gov
44
45
46
47sendmail.cf
48
49
50
51#
52
53# Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
54
55# All rights reserved.
56
57# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
58
59# Copyright (c) 1988, 1993
60
61# The Regents of the University of California. All rights reserved.
62
63#
64
65# By using this file, you agree to the terms and conditions set
66
67# forth in the LICENSE file which can be found at the top level of
68
69# the sendmail distribution.
70
71#
72
73#
74
75
76
77######################################################################
78
79######################################################################
80
81#####
82
83##### SENDMAIL CONFIGURATION FILE
84
85#####
86
87##### built by [email protected] on Tue Oct 28 16:06:03 EST 2003
88
89##### in /usr/src/build/320829-i386/BUILD/sendmail-8.12.10/cf/cf
90
91##### using ../ as configuration include directory
92
93#####
94
95######################################################################
96
97#####
98
99##### DO NOT EDIT THIS FILE! Only edit the source .mc file.
100
101#####
102
103######################################################################
104
105######################################################################
106
107
108
109##### $Id: cfhead.m4,v 8.108.2.3 2003/04/03 17:51:51 ca Exp $ #####
110
111##### $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $ #####
112
113##### setup for Red Hat Linux #####
114
115##### $Id: linux.m4,v 8.13 2000/09/17 17:30:00 gshapiro Exp $ #####
116
117
118
119
120
121
122
123##### $Id: local_procmail.m4,v 8.21.42.1 2002/11/17 04:25:07 ca Exp $ #####
124
125
126
127
128
129##### $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $ #####
130
131
132
133##### $Id: smrsh.m4,v 8.14 1999/11/18 05:06:23 ca Exp $ #####
134
135
136
137##### $Id: mailertable.m4,v 8.23 2001/03/16 00:51:26 gshapiro Exp $ #####
138
139
140
141##### $Id: virtusertable.m4,v 8.21 2001/03/16 00:51:26 gshapiro Exp $ #####
142
143
144
145##### $Id: redirect.m4,v 8.15 1999/08/06 01:47:36 gshapiro Exp $ #####
146
147
148
149##### $Id: always_add_domain.m4,v 8.11 2000/09/12 22:00:53 ca Exp $ #####
150
151
152
153##### $Id: use_cw_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $ #####
154
155
156
157
158
159##### $Id: use_ct_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $ #####
160
161
162
163
164
165##### $Id: local_procmail.m4,v 8.21.42.1 2002/11/17 04:25:07 ca Exp $ #####
166
167
168
169##### $Id: access_db.m4,v 8.24 2002/03/06 21:50:25 ca Exp $ #####
170
171
172
173##### $Id: blacklist_recipients.m4,v 8.13 1999/04/02 02:25:13 gshapiro Exp $ #####
174
175
176
177##### $Id: accept_unresolvable_domains.m4,v 8.10 1999/02/07 07:26:07 gshapiro Exp $ #####
178
179
180
181
182
183##### $Id: proto.m4,v 8.649.2.24 2003/08/04 21:14:26 ca Exp $ #####
184
185
186
187# level 10 config file format
188
189V10/Berkeley
190
191
192
193# override file safeties - setting this option compromises system security,
194
195# addressing the actual file configuration problem is preferred
196
197# need to set this before any file actions are encountered in the cf file
198
199#O DontBlameSendmail=safe
200
201
202
203# default LDAP map specification
204
205# need to set this now before any LDAP maps are defined
206
207#O LDAPDefaultSpec=-h localhost
208
209
210
211##################
212
213# local info #
214
215##################
216
217
218
219# my LDAP cluster
220
221# need to set this before any LDAP lookups are done (including classes)
222
223#D{sendmailMTACluster}$m
224
225
226
227Cwlocalhost
228
229# file containing names of hosts for which we receive email
230
231Fw/etc/mail/local-host-names
232
233
234
235# my official domain name
236
237# ... define this only if sendmail cannot automatically determine your domain
238
239#Dj$w.Foo.COM
240
241
242
243CP.
244
245
246
247# "Smart" relay host (may be null)
248
249DS
250
251
252
253
254
255# operators that cannot be in local usernames (i.e., network indicators)
256
257CO @ % !
258
259
260
261# a class with just dot (for identifying canonical names)
262
263C..
264
265
266
267# a class with just a left bracket (for identifying domain literals)
268
269C[[
270
271
272
273# access_db acceptance class
274
275C{Accept}OK RELAY
276
277
278
279
280
281C{ResOk}OKR
282
283
284
285
286
287# Hosts for which relaying is permitted ($=R)
288
289FR-o /etc/mail/relay-domains
290
291
292
293# arithmetic map
294
295Karith arith
296
297# macro storage map
298
299Kmacro macro
300
301# possible values for TLS_connection in access map
302
303C{tls}VERIFY ENCR
304
305
306
307
308
309
310
311
312
313
314
315# dequoting map
316
317Kdequote dequote
318
319
320
321# class E: names that should be exposed as from this host, even if we masquerade
322
323# class L: names that should be delivered locally, even if we have a relay
324
325# class M: domains that should be converted to $M
326
327# class N: domains that should not be converted to $M
328
329#CL root
330
331C{E}root
332
333C{w}localhost.localdomain
334
335
336
337
338
339
340
341# my name for error messages
342
343DnMAILER-DAEMON
344
345
346
347
348
349# Mailer table (overriding domains)
350
351Kmailertable hash -o /etc/mail/mailertable.db
352
353
354
355# Virtual user table (maps incoming users)
356
357Kvirtuser hash -o /etc/mail/virtusertable.db
358
359
360
361CPREDIRECT
362
363
364
365# Access list database (for spam stomping)
366
367Kaccess hash -T<tmpf> -o /etc/mail/access.db
368
369
370
371# Configuration version number
372
373DZ8.12.10
374
375
376
377
378
379###############
380
381# Options #
382
383###############
384
385
386
387# strip message body to 7 bits on input?
388
389O SevenBitInput=False
390
391
392
393# 8-bit data handling
394
395#O EightBitMode=pass8
396
397
398
399# wait for alias file rebuild (default units: minutes)
400
401O AliasWait=10
402
403
404
405# location of alias file
406
407O AliasFile=/etc/aliases
408
409
410
411# minimum number of free blocks on filesystem
412
413O MinFreeBlocks=100
414
415
416
417# maximum message size
418
419#O MaxMessageSize=1000000
420
421
422
423# substitution for space (blank) characters
424
425O BlankSub=.
426
427
428
429# avoid connecting to "expensive" mailers on initial submission?
430
431O HoldExpensive=False
432
433
434
435# checkpoint queue runs after every N successful deliveries
436
437#O CheckpointInterval=10
438
439
440
441# default delivery mode
442
443O DeliveryMode=background
444
445
446
447# error message header/file
448
449#O ErrorHeader=/etc/mail/error-header
450
451
452
453# error mode
454
455#O ErrorMode=print
456
457
458
459# save Unix-style "From_" lines at top of header?
460
461#O SaveFromLine=False
462
463
464
465# queue file mode (qf files)
466
467#O QueueFileMode=0600
468
469
470
471# temporary file mode
472
473O TempFileMode=0600
474
475
476
477# match recipients against GECOS field?
478
479#O MatchGECOS=False
480
481
482
483# maximum hop count
484
485#O MaxHopCount=25
486
487
488
489# location of help file
490
491O HelpFile=/etc/mail/helpfile
492
493
494
495# ignore dots as terminators in incoming messages?
496
497#O IgnoreDots=False
498
499
500
501# name resolver options
502
503#O ResolverOptions=+AAONLY
504
505
506
507# deliver MIME-encapsulated error messages?
508
509O SendMimeErrors=True
510
511
512
513# Forward file search path
514
515O ForwardPath=$z/.forward.$w:$z/.forward
516
517
518
519# open connection cache size
520
521O ConnectionCacheSize=2
522
523
524
525# open connection cache timeout
526
527O ConnectionCacheTimeout=5m
528
529
530
531# persistent host status directory
532
533#O HostStatusDirectory=.hoststat
534
535
536
537# single thread deliveries (requires HostStatusDirectory)?
538
539#O SingleThreadDelivery=False
540
541
542
543# use Errors-To: header?
544
545O UseErrorsTo=False
546
547
548
549# log level
550
551O LogLevel=9
552
553
554
555# send to me too, even in an alias expansion?
556
557#O MeToo=True
558
559
560
561# verify RHS in newaliases?
562
563O CheckAliases=False
564
565
566
567# default messages to old style headers if no special punctuation?
568
569O OldStyleHeaders=True
570
571
572
573# SMTP daemon options
574
575
576
577O DaemonPortOptions=Port=smtp,Addr=192.168.206.8, Name=MTA
578
579
580
581# SMTP client options
582
583O ClientPortOptions=Family=inet, Address=192.168.206.8
584
585
586
587# Modifiers to define {daemon_flags} for direct submissions
588
589#O DirectSubmissionModifiers
590
591
592
593# Use as mail submission program? See sendmail/SECURITY
594
595#O UseMSP
596
597
598
599# privacy flags
600
601O PrivacyOptions=authwarnings,novrfy,noexpn,restrictqrun
602
603
604
605# who (if anyone) should get extra copies of error messages
606
607#O PostmasterCopy=Postmaster
608
609
610
611# slope of queue-only function
612
613#O QueueFactor=600000
614
615
616
617# limit on number of concurrent queue runners
618
619#O MaxQueueChildren
620
621
622
623# maximum number of queue-runners per queue-grouping with multiple queues
624
625#O MaxRunnersPerQueue=1
626
627
628
629# priority of queue runners (nice(3))
630
631#O NiceQueueRun
632
633
634
635# shall we sort the queue by hostname first?
636
637#O QueueSortOrder=priority
638
639
640
641# minimum time in queue before retry
642
643#O MinQueueAge=30m
644
645
646
647# how many jobs can you process in the queue?
648
649#O MaxQueueRunSize=10000
650
651
652
653# perform initial split of envelope without checking MX records
654
655#O FastSplit=1
656
657
658
659# queue directory
660
661O QueueDirectory=/var/spool/mqueue
662
663
664
665# key for shared memory; 0 to turn off
666
667#O SharedMemoryKey=0
668
669
670
671
672
673
674
675# timeouts (many of these)
676
677#O Timeout.initial=5m
678
679O Timeout.connect=1m
680
681#O Timeout.aconnect=0s
682
683#O Timeout.iconnect=5m
684
685#O Timeout.helo=5m
686
687#O Timeout.mail=10m
688
689#O Timeout.rcpt=1h
690
691#O Timeout.datainit=5m
692
693#O Timeout.datablock=1h
694
695#O Timeout.datafinal=1h
696
697#O Timeout.rset=5m
698
699#O Timeout.quit=2m
700
701#O Timeout.misc=2m
702
703#O Timeout.command=1h
704
705O Timeout.ident=0
706
707#O Timeout.fileopen=60s
708
709#O Timeout.control=2m
710
711O Timeout.queuereturn=5d
712
713#O Timeout.queuereturn.normal=5d
714
715#O Timeout.queuereturn.urgent=2d
716
717#O Timeout.queuereturn.non-urgent=7d
718
719
720
721O Timeout.queuewarn=4h
722
723#O Timeout.queuewarn.normal=4h
724
725#O Timeout.queuewarn.urgent=1h
726
727#O Timeout.queuewarn.non-urgent=12h
728
729
730
731#O Timeout.hoststatus=30m
732
733#O Timeout.resolver.retrans=5s
734
735#O Timeout.resolver.retrans.first=5s
736
737#O Timeout.resolver.retrans.normal=5s
738
739#O Timeout.resolver.retry=4
740
741#O Timeout.resolver.retry.first=4
742
743#O Timeout.resolver.retry.normal=4
744
745#O Timeout.lhlo=2m
746
747#O Timeout.auth=10m
748
749#O Timeout.starttls=1h
750
751
752
753# time for DeliverBy; extension disabled if less than 0
754
755#O DeliverByMin=0
756
757
758
759# should we not prune routes in route-addr syntax addresses?
760
761#O DontPruneRoutes=False
762
763
764
765# queue up everything before forking?
766
767O SuperSafe=True
768
769
770
771# status file
772
773O StatusFile=/etc/mail/statistics
774
775
776
777# time zone handling:
778
779# if undefined, use system default
780
781# if defined but null, use TZ envariable passed in
782
783# if defined and non-null, use that info
784
785#O TimeZoneSpec=
786
787
788
789# default UID (can be username or userid:groupid)
790
791O DefaultUser=8:12
792
793
794
795# list of locations of user database file (null means no lookup)
796
797O UserDatabaseSpec=/etc/mail/userdb.db
798
799
800
801# fallback MX host
802
803#O FallbackMXhost=fall.back.host.net
804
805
806
807# if we are the best MX host for a site, try it directly instead of config err
808
809O TryNullMXList=true
810
811
812
813# load average at which we just queue messages
814
815#O QueueLA=8
816
817
818
819# load average at which we refuse connections
820
821#O RefuseLA=12
822
823
824
825# load average at which we delay connections; 0 means no limit
826
827#O DelayLA=0
828
829
830
831# maximum number of children we allow at one time
832
833#O MaxDaemonChildren=0
834
835
836
837# maximum number of new connections per second
838
839#O ConnectionRateThrottle=0
840
841
842
843# work recipient factor
844
845#O RecipientFactor=30000
846
847
848
849# deliver each queued job in a separate process?
850
851#O ForkEachJob=False
852
853
854
855# work class factor
856
857#O ClassFactor=1800
858
859
860
861# work time factor
862
863#O RetryFactor=90000
864
865
866
867# default character set
868
869#O DefaultCharSet=iso-8859-1
870
871
872
873# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
874
875#O ServiceSwitchFile=/etc/mail/service.switch
876
877
878
879# hosts file (normally /etc/hosts)
880
881#O HostsFile=/etc/hosts
882
883
884
885# dialup line delay on connection failure
886
887#O DialDelay=10s
888
889
890
891# action to take if there are no recipients in the message
892
893#O NoRecipientAction=add-to-undisclosed
894
895
896
897# chrooted environment for writing to files
898
899#O SafeFileEnvironment=/arch
900
901
902
903# are colons OK in addresses?
904
905#O ColonOkInAddr=True
906
907
908
909# shall I avoid expanding CNAMEs (violates protocols)?
910
911#O DontExpandCnames=False
912
913
914
915# SMTP initial login message (old $e macro)
916
917O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
918
919
920
921# UNIX initial From header format (old $l macro)
922
923O UnixFromLine=From $g $d
924
925
926
927# From: lines that have embedded newlines are unwrapped onto one line
928
929#O SingleLineFromHeader=False
930
931
932
933# Allow HELO SMTP command that does not include a host name
934
935#O AllowBogusHELO=False
936
937
938
939# Characters to be quoted in a full name phrase (@,;:\\()[] are automatic)
940
941#O MustQuoteChars=.
942
943
944
945# delimiter (operator) characters (old $o macro)
946
947O OperatorChars=.  @!^/[]+
948
949
950
951# shall I avoid calling initgroups(3) because of high NIS costs?
952
953#O DontInitGroups=False
954
955
956
957# are group-writable :include: and .forward files (un)trustworthy?
958
959# True (the default) means they are not trustworthy.
960
961#O UnsafeGroupWrites=True
962
963
964
965
966
967# where do errors that occur when sending errors get sent?
968
969#O DoubleBounceAddress=postmaster
970
971
972
973# where to save bounces if all else fails
974
975#O DeadLetterDrop=/var/tmp/dead.letter
976
977
978
979# what user id do we assume for the majority of the processing?
980
981#O RunAsUser=sendmail
982
983
984
985# maximum number of recipients per SMTP envelope
986
987#O MaxRecipientsPerMessage=100
988
989
990
991# limit the rate recipients per SMTP envelope are accepted
992
993# once the threshold number of recipients have been rejected
994
995#O BadRcptThrottle=20
996
997
998
999# shall we get local names from our installed interfaces?
1000
1001O DontProbeInterfaces=true
1002
1003
1004
1005# Return-Receipt-To: header implies DSN request
1006
1007#O RrtImpliesDsn=False
1008
1009
1010
1011# override connection address (for testing)
1012
1013#O ConnectOnlyTo=0.0.0.0
1014
1015
1016
1017# Trusted user for file ownership and starting the daemon
1018
1019#O TrustedUser=root
1020
1021
1022
1023# Control socket for daemon management
1024
1025#O ControlSocketName=/var/spool/mqueue/.control
1026
1027
1028
1029# Maximum MIME header length to protect MUAs
1030
1031#O MaxMimeHeaderLength=2048/1024
1032
1033
1034
1035# Maximum length of the sum of all headers
1036
1037#O MaxHeadersLength=32768
1038
1039
1040
1041# Maximum depth of alias recursion
1042
1043#O MaxAliasRecursion=10
1044
1045
1046
1047# location of pid file
1048
1049#O PidFile=/var/run/sendmail.pid
1050
1051
1052
1053# Prefix string for the process title shown on 'ps' listings
1054
1055#O ProcessTitlePrefix=prefix
1056
1057
1058
1059# Data file (df) memory-buffer file maximum size
1060
1061#O DataFileBufferSize=4096
1062
1063
1064
1065# Transcript file (xf) memory-buffer file maximum size
1066
1067#O XscriptFileBufferSize=4096
1068
1069
1070
1071# lookup type to find information about local mailboxes
1072
1073#O MailboxDatabase=pw
1074
1075
1076
1077# list of authentication mechanisms
1078
1079#O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
1080
1081
1082
1083# default authentication information for outgoing connections
1084
1085#O DefaultAuthInfo=/etc/mail/default-auth-info
1086
1087
1088
1089# SMTP AUTH flags
1090
1091O AuthOptions=A
1092
1093
1094
1095# SMTP AUTH maximum encryption strength
1096
1097#O AuthMaxBits
1098
1099
1100
1101# SMTP STARTTLS server options
1102
1103#O TLSSrvOptions
1104
1105
1106
1107# Input mail filters
1108
1109#O InputMailFilters
1110
1111
1112
1113
1114
1115# CA directory
1116
1117#O CACertPath
1118
1119# CA file
1120
1121#O CACertFile
1122
1123# Server Cert
1124
1125#O ServerCertFile
1126
1127# Server private key
1128
1129#O ServerKeyFile
1130
1131# Client Cert
1132
1133#O ClientCertFile
1134
1135# Client private key
1136
1137#O ClientKeyFile
1138
1139# DHParameters (only required if DSA/DH is used)
1140
1141#O DHParameters
1142
1143# Random data source (required for systems without /dev/urandom under OpenSSL)
1144
1145#O RandFile
1146
1147
1148
1149############################
1150
1151# QUEUE GROUP DEFINITIONS #
1152
1153############################
1154
1155
1156
1157
1158
1159###########################
1160
1161# Message precedences #
1162
1163###########################
1164
1165
1166
1167Pfirst-class=0
1168
1169Pspecial-delivery=100
1170
1171Plist=-30
1172
1173Pbulk=-60
1174
1175Pjunk=-100
1176
1177
1178
1179#####################
1180
1181# Trusted users #
1182
1183#####################
1184
1185
1186
1187# this is equivalent to setting class "t"
1188
1189Ft/etc/mail/trusted-users
1190
1191Troot
1192
1193Tdaemon
1194
1195Tuucp
1196
1197
1198
1199#########################
1200
1201# Format of headers #
1202
1203#########################
1204
1205
1206
1207H?P?Return-Path: <$g>
1208
1209HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
1210
1211$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
1212
1213$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
1214
1215(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
1216
1217for $u; $|;
1218
1219$.$b
1220
1221H?D?Resent-Date: $a
1222
1223H?D?Date: $a
1224
1225H?F?Resent-From: $?x$x <$g>$|$g$.
1226
1227H?F?From: $?x$x <$g>$|$g$.
1228
1229H?x?Full-Name: $x
1230
1231# HPosted-Date: $a
1232
1233# H?l?Received-Date: $b
1234
1235H?M?Resent-Message-Id: <$t.$i@$j>
1236
1237H?M?Message-Id: <$t.$i@$j>
1238
1239
1240
1241#
1242
1243######################################################################
1244
1245######################################################################
1246
1247#####
1248
1249##### REWRITING RULES
1250
1251#####
1252
1253######################################################################
1254
1255######################################################################
1256
1257
1258
1259############################################
1260
1261### Ruleset 3 -- Name Canonicalization ###
1262
1263############################################
1264
1265Scanonify=3
1266
1267
1268
1269# handle null input (translate to <@> special case)
1270
1271R$@ $@ <@>
1272
1273
1274
1275# strip group: syntax (not inside angle brackets!) and trailing semicolon
1276
1277R$* $: $1 <@> mark addresses
1278
1279R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
1280
1281R@ $* <@> $: @ $1 unmark @host:...
1282
1283R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr
1284
1285R$* :: $* <@> $: $1 :: $2 unmark node::addr
1286
1287R:include: $* <@> $: :include: $1 unmark :include:...
1288
1289R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
1290
1291R$* : $* <@> $: $2 strip colon if marked
1292
1293R$* <@> $: $1 unmark
1294
1295R$* ; $1 strip trailing semi
1296
1297R$* < $+ :; > $* $@ $2 :; <@> catch <list:;>
1298
1299R$* < $* ; > $1 < $2 > bogus bracketed semi
1300
1301
1302
1303# null input now results from list:; syntax
1304
1305R$@ $@ :; <@>
1306
1307
1308
1309# strip angle brackets -- note RFC733 heuristic to get innermost item
1310
1311R$* $: < $1 > housekeeping <>
1312
1313R$+ < $* > < $2 > strip excess on left
1314
1315R< $* > $+ < $1 > strip excess on right
1316
1317R<> $@ < @ > MAIL FROM:<> case
1318
1319R< $+ > $: $1 remove housekeeping <>
1320
1321
1322
1323# strip route address <@a,@b,@c:user@d> -> <user@d>
1324
1325R@ $+ , $+ $2
1326
1327R@ [ $* ] : $+ $2
1328
1329R@ $+ : $+ $2
1330
1331
1332
1333# find focus for list syntax
1334
1335R $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax
1336
1337R $+ : $* ; $@ $1 : $2; list syntax
1338
1339
1340
1341# find focus for @ syntax addresses
1342
1343R$+ @ $+ $: $1 < @ $2 > focus on domain
1344
1345R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
1346
1347R$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical
1348
1349
1350
1351
1352
1353# convert old-style addresses to a domain-based address
1354
1355R$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names
1356
1357R$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps
1358
1359R$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains
1360
1361
1362
1363# if we have % signs, take the rightmost one
1364
1365R$* % $* $1 @ $2 First make them all @s.
1366
1367R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
1368
1369R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish
1370
1371
1372
1373# else we must be a local name
1374
1375R$* $@ $>Canonify2 $1
1376
1377
1378
1379
1380
1381################################################
1382
1383### Ruleset 96 -- bottom half of ruleset 3 ###
1384
1385################################################
1386
1387
1388
1389SCanonify2=96
1390
1391
1392
1393# handle special cases for local names
1394
1395R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
1396
1397R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
1398
1399R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
1400
1401
1402
1403# check for IPv4/IPv6 domain literal
1404
1405R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr]
1406
1407R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
1408
1409R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421# if really UUCP, handle it immediately
1422
1423
1424
1425# try UUCP traffic as a local address
1426
1427R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
1428
1429R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
1430
1431
1432
1433# hostnames ending in class P are always canonical
1434
1435R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
1436
1437R$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
1438
1439R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6
1440
1441R$* CC $* $| $* $: $3
1442
1443# pass to name server to make hostname canonical
1444
1445R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4
1446
1447R$* $| $* $: $2
1448
1449
1450
1451# local host aliases and pseudo-domains are always canonical
1452
1453R$* < @ $=w > $* $: $1 < @ $2 . > $3
1454
1455R$* < @ $=M > $* $: $1 < @ $2 . > $3
1456
1457R$* < @ $={VirtHost} > $* $: $1 < @ $2 . > $3
1458
1459R$* < @ $* . . > $* $1 < @ $2 . > $3
1460
1461
1462
1463
1464
1465##################################################
1466
1467### Ruleset 4 -- Final Output Post-rewriting ###
1468
1469##################################################
1470
1471Sfinal=4
1472
1473
1474
1475R$+ :; <@> $@ $1 : handle <list:;>
1476
1477R$* <@> $@ handle <> and list:;
1478
1479
1480
1481# strip trailing dot off possibly canonical name
1482
1483R$* < @ $+ . > $* $1 < @ $2 > $3
1484
1485
1486
1487# eliminate internal code
1488
1489R$* < @ *LOCAL* > $* $1 < @ $j > $2
1490
1491
1492
1493# externalize local domain info
1494
1495R$* < $+ > $* $1 $2 $3 defocus
1496
1497R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
1498
1499R@ $* $@ @ $1 ... and exit
1500
1501
1502
1503# UUCP must always be presented in old form
1504
1505R$+ @ $- . UUCP $2!$1 [email protected] => h!u
1506
1507
1508
1509# delete duplicate local names
1510
1511R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
1512
1513
1514
1515
1516
1517
1518
1519##############################################################
1520
1521### Ruleset 97 -- recanonicalize and call ruleset zero ###
1522
1523### (used for recursive calls) ###
1524
1525##############################################################
1526
1527
1528
1529SRecurse=97
1530
1531R$* $: $>canonify $1
1532
1533R$* $@ $>parse $1
1534
1535
1536
1537
1538
1539######################################
1540
1541### Ruleset 0 -- Parse Address ###
1542
1543######################################
1544
1545
1546
1547Sparse=0
1548
1549
1550
1551R$* $: $>Parse0 $1 initial parsing
1552
1553R<@> $#local $: <@> special case error msgs
1554
1555R$* $: $>ParseLocal $1 handle local hacks
1556
1557R$* $: $>Parse1 $1 final parsing
1558
1559
1560
1561#
1562
1563# Parse0 -- do initial syntax checking and eliminate local addresses.
1564
1565# This should either return with the (possibly modified) input
1566
1567# or return with a #error mailer. It should not return with a
1568
1569# #mailer other than the #error mailer.
1570
1571#
1572
1573
1574
1575SParse0
1576
1577R<@> $@ <@> special case error msgs
1578
1579R$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
1580
1581R@ <@ $* > < @ $1 > catch "@@host" bogosity
1582
1583R<@ $+> $#error $@ 5.1.3 $: "553 User address required"
1584
1585R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"
1586
1587R$* $: <> $1
1588
1589R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4
1590
1591R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4
1592
1593R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"
1594
1595R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
1596
1597R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
1598
1599R<> $* $1
1600
1601R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
1602
1603R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
1604
1605R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"
1606
1607R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"
1608
1609R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"
1610
1611
1612
1613
1614
1615# now delete the local info -- note $=O to find characters that cause forwarding
1616
1617R$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user
1618
1619R< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...
1620
1621R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
1622
1623R< @ $+ > $#error $@ 5.1.3 $: "553 User address required"
1624
1625R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
1626
1627R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
1628
1629R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"
1630
1631R$* $=O $* < @ *LOCAL* >
1632
1633$@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
1634
1635R$* < @ *LOCAL* > $: $1
1636
1637
1638
1639#
1640
1641# Parse1 -- the bottom half of ruleset 0.
1642
1643#
1644
1645
1646
1647SParse1
1648
1649
1650
1651# handle numeric address spec
1652
1653R$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec
1654
1655R$* < @ [ $+ ] > $* $: $1 < @ [ $2 ] : $S > $3 Add smart host to path
1656
1657R$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send
1658
1659R$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer
1660
1661R$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer
1662
1663
1664
1665# handle virtual users
1666
1667R$+ $: <!-- --> $1 Mark for lookup
1668
1669R<!-- --> $+ < @ $={VirtHost} . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
1670
1671R<!-- --> $+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
1672
1673R<@> $+ + $+ < @ $* . >
1674
1675$: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
1676
1677R<@> $+ + $* < @ $* . >
1678
1679$: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
1680
1681R<@> $+ + $* < @ $* . >
1682
1683$: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
1684
1685R<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
1686
1687R<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
1688
1689R<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . >
1690
1691R<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
1692
1693R<@> $+ $: $1
1694
1695R<!-- --> $+ $: $1
1696
1697R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
1698
1699R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
1700
1701R< $+ > $+ < @ $+ > $: $>Recurse $1
1702
1703
1704
1705# short circuit local delivery so forwarded email works
1706
1707
1708
1709
1710
1711R$=L < @ $=w . > $#local $: @ $1 special local names
1712
1713R$+ < @ $=w . > $#local $: $1 regular local name
1714
1715
1716
1717# not local -- try mailer table lookup
1718
1719R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name
1720
1721R< $+ . > $* $: < $1 > $2 strip trailing dot
1722
1723R< $+ > $* $: < $(mailertable $1 $) > $2 lookup
1724
1725R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check -- resolved?
1726
1727R< $+ > $* $: $>Mailertable <$1> $2 try domain
1728
1729
1730
1731# resolve remotely connected UUCP links (if any)
1732
1733
1734
1735# resolve fake top level domains by forwarding to other hosts
1736
1737
1738
1739
1740
1741
1742
1743# pass names that still have a host to a smarthost (if defined)
1744
1745R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name
1746
1747
1748
1749# deal with other remote names
1750
1751R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 [email protected] in
1752
1753
1754
1755# handle locally delivered names
1756
1757R$=L $#local $: @ $1 special local names
1758
1759R$+ $#local $: $1 regular local names
1760
1761
1762
1763###########################################################################
1764
1765### Ruleset 5 -- special rewriting after aliases have been expanded ###
1766
1767###########################################################################
1768
1769
1770
1771SLocal_localaddr
1772
1773Slocaladdr=5
1774
1775R$+ $: $1 $| $>"Local_localaddr" $1
1776
1777R$+ $| $#ok $@ $1 no change
1778
1779R$+ $| $#$* $#$2
1780
1781R$+ $| $* $: $1
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791# deal with plussed users so aliases work nicely
1792
1793R$+ + * $#local $@ $&h $: $1
1794
1795R$+ + $* $#local $@ + $2 $: $1 + *
1796
1797
1798
1799# prepend an empty "forward host" on the front
1800
1801R$+ $: <> $1
1802
1803
1804
1805
1806
1807
1808
1809R< > $+ $: < > < $1 <> $&h > nope, restore +detail
1810
1811
1812
1813R< > < $+ <> \+ $* > $: < > < $1 + $2 > check whether +detail
1814
1815R< > < $+ <> $* > $: < > < $1 > else discard
1816
1817R< > < $+ + $* > $* < > < $1 > \+ $2 $3 find the user part
1818
1819R< > < $+ > \+ $* $#local $@ $2 $: @ $1 strip the extra +
1820
1821R< > < $+ > $@ $1 no +detail
1822
1823R$+ $: $1 <> $&h add +detail back in
1824
1825
1826
1827R$+ <> \+ $* $: $1 + $2 check whether +detail
1828
1829R$+ <> $* $: $1 else discard
1830
1831R< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension
1832
1833R< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension
1834
1835
1836
1837R< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
1838
1839
1840
1841R< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 >
1842
1843
1844
1845
1846
1847###################################################################
1848
1849### Ruleset 90 -- try domain part of mailertable entry ###
1850
1851###################################################################
1852
1853
1854
1855SMailertable=90
1856
1857R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
1858
1859R$* <$~[ : $* > $* $>MailerToTriple < $2 : $3 > $4 check -- resolved?
1860
1861R$* < . $+ > $* $@ $>Mailertable $1 . <$2> $3 no -- strip & try again
1862
1863R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."
1864
1865R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 "." found?
1866
1867R< $* > $* $@ $2 no mailertable match
1868
1869
1870
1871###################################################################
1872
1873### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
1874
1875###################################################################
1876
1877
1878
1879SMailerToTriple=95
1880
1881R< > $* $@ $1 strip off null relay
1882
1883R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
1884
1885R< error : $- : $+ > $* $#error $@ $(dequote $1 $) $: $2
1886
1887R< error : $+ > $* $#error $: $1
1888
1889R< local : $* > $* $>CanonLocal < $1 > $2
1890
1891R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
1892
1893R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
1894
1895R< $=w > $* $@ $2 delete local host
1896
1897R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
1898
1899
1900
1901###################################################################
1902
1903### Ruleset CanonLocal -- canonify local: syntax ###
1904
1905###################################################################
1906
1907
1908
1909SCanonLocal
1910
1911# strip local host from routed addresses
1912
1913R< $* > < @ $+ > : $+ $@ $>Recurse $3
1914
1915R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4
1916
1917
1918
1919# strip trailing dot from any host name that may appear
1920
1921R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
1922
1923
1924
1925# handle local: syntax -- use old user, either with or without host
1926
1927R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
1928
1929R< > $+ $#local $@ $1 $: $1
1930
1931
1932
1933# handle local:user@host syntax -- ignore host part
1934
1935R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
1936
1937
1938
1939# handle local:user syntax
1940
1941R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
1942
1943R< $+ > $* $#local $@ $2 $: $1
1944
1945
1946
1947###################################################################
1948
1949### Ruleset 93 -- convert header names to masqueraded form ###
1950
1951###################################################################
1952
1953
1954
1955SMasqHdr=93
1956
1957
1958
1959
1960
1961# do not masquerade anything in class N
1962
1963R$* < @ $* $=N . > $@ $1 < @ $2 $3 . >
1964
1965
1966
1967R$* < @ *LOCAL* > $@ $1 < @ $j . >
1968
1969
1970
1971###################################################################
1972
1973### Ruleset 94 -- convert envelope names to masqueraded form ###
1974
1975###################################################################
1976
1977
1978
1979SMasqEnv=94
1980
1981R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1982
1983
1984
1985###################################################################
1986
1987### Ruleset 98 -- local part of ruleset zero (can be null) ###
1988
1989###################################################################
1990
1991
1992
1993SParseLocal=98
1994
1995
1996
1997# addresses sent to [email protected] RECT will give a 551 error code
1998
1999R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
2000
2001R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
2002
2003R$* < @ $+ .REDIRECT. > < $- > $#error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013######################################################################
2014
2015### D: LookUpDomain -- search for domain in access database
2016
2017###
2018
2019### Parameters:
2020
2021### <$1> \-- key (domain name)
2022
2023### <$2> \-- default (what to return if not found in db)
2024
2025### <$3> \-- mark (must be <(!|+) single-token> )
2026
2027### ! does lookup only with tag
2028
2029### + does lookup with and without tag
2030
2031### <$4> \-- passthru (additional data passed unchanged through)
2032
2033######################################################################
2034
2035
2036
2037SD
2038
2039R<$*> <$+> <$- $-> <$*> $: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>
2040
2041R<? > <$+> <$+> <\+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <\+ $3> <$4>
2042
2043R<? > <[$+.$-]> <$+> <$- $-> <$*> $@ $>D <[$1]> <$3> <$4 $5> <$6>
2044
2045R<? > <[$+::$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>
2046
2047R<? > <[$+:$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>
2048
2049R<? > <$+.$+> <$+> <$- $-> <$*> $@ $>D <$2> <$3> <$4 $5> <$6>
2050
2051R<? > <$+> <$+> <$- $-> <$*> $@ <$2> <$5>
2052
2053R<$* <tmpf>> <$+> <$+> <$- $-> <$*> $@ <<tmpf>> <$6>
2054
2055R<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6>
2056
2057
2058
2059######################################################################
2060
2061### A: LookUpAddress -- search for host address in access database
2062
2063###
2064
2065### Parameters:
2066
2067### <$1> \-- key (dot quadded host address)
2068
2069### <$2> \-- default (what to return if not found in db)
2070
2071### <$3> \-- mark (must be <(!|+) single-token> )
2072
2073### ! does lookup only with tag
2074
2075### + does lookup with and without tag
2076
2077### <$4> \-- passthru (additional data passed through)
2078
2079######################################################################
2080
2081
2082
2083SA
2084
2085R<$+> <$+> <$- $-> <$*> $: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>
2086
2087R<? > <$+> <$+> <\+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <\+ $3> <$4>
2088
2089R<? > <$+::$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>
2090
2091R<? > <$+:$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>
2092
2093R<? > <$+.$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>
2094
2095R<? > <$+> <$+> <$- $-> <$*> $@ <$2> <$5>
2096
2097R<$* <tmpf>> <$+> <$+> <$- $-> <$*> $@ <<tmpf>> <$6>
2098
2099R<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6>
2100
2101
2102
2103######################################################################
2104
2105### CanonAddr -- Convert an address into a standard form for
2106
2107### relay checking. Route address syntax is
2108
2109### crudely converted into a %-hack address.
2110
2111###
2112
2113### Parameters:
2114
2115### $1 -- full recipient address
2116
2117###
2118
2119### Returns:
2120
2121### parsed address, not in source route form
2122
2123######################################################################
2124
2125
2126
2127SCanonAddr
2128
2129R$* $: $>Parse0 $>canonify $1 make domain canonical
2130
2131
2132
2133
2134
2135######################################################################
2136
2137### ParseRecipient -- Strip off hosts in $=R as well as possibly
2138
2139### $* $=m or the access database.
2140
2141### Check user portion for host separators.
2142
2143###
2144
2145### Parameters:
2146
2147### $1 -- full recipient address
2148
2149###
2150
2151### Returns:
2152
2153### parsed, non-local-relaying address
2154
2155######################################################################
2156
2157
2158
2159SParseRecipient
2160
2161R$* $: <? > $>CanonAddr $1
2162
2163R<? > $* < @ $* . > <? > $1 < @ $2 > strip trailing dots
2164
2165R<? > $- < @ $* > $: <? > $(dequote $1 $) < @ $2 > dequote local part
2166
2167
2168
2169# if no $=O character, no host in the user portion, we are done
2170
2171R<? > $* $=O $* < @ $* > $: <no> $1 $2 $3 < @ $4>
2172
2173R<? > $* $@ $1
2174
2175
2176
2177
2178
2179R<no> $* < @ $* $=R > $: <relay> $1 < @ $2 $3 >
2180
2181R<no> $* < @ $+ > $: $>D <$2> <no> <\+ To> <$1 < @ $2 >>
2182
2183R<$+> <$+> $: <$1> $2
2184
2185
2186
2187
2188
2189
2190
2191R<relay> $* < @ $* > $@ $>ParseRecipient $1
2192
2193R<$+> $* $@ $2
2194
2195
2196
2197
2198
2199######################################################################
2200
2201### check_relay -- check hostname/address on SMTP startup
2202
2203######################################################################
2204
2205
2206
2207SLocal_check_relay
2208
2209Scheck_relay
2210
2211R$* $: $1 $| $>"Local_check_relay" $1
2212
2213R$* $| $* $| $#$* $#$3
2214
2215R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
2216
2217
2218
2219SBasic_check_relay
2220
2221# check for deferred delivery mode
2222
2223R$* $: < $&{deliveryMode} > $1
2224
2225R< d > $* $@ deferred
2226
2227R< $* > $* $: $2
2228
2229
2230
2231R$+ $| $+ $: $>D < $1 > <? > <\+ Connect> < $2 >
2232
2233R $| $+ $: $>A < $1 > <? > <\+ Connect> <> empty client_name
2234
2235R<? > <$+> $: $>A < $1 > <? > <\+ Connect> <> no: another lookup
2236
2237R<? > <$*> $: OK found nothing
2238
2239R<$={Accept}> <$*> $@ $1 return value of lookup
2240
2241R<reject> <$*> $#error $@ 5.7.1 $: "550 Access denied"
2242
2243R<discard> <$*> $#discard $: discard
2244
2245R<error:$-.$-.$-:$+> <$*> $#error $@ $1.$2.$3 $: $4
2246
2247R<error:$+> <$*> $#error $: $1
2248
2249R<$* <tmpf>> <$*> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2250
2251R<$+> <$*> $#error $: $1
2252
2253
2254
2255
2256
2257
2258
2259######################################################################
2260
2261### check_mail -- check SMTP `MAIL FROM:' command argument
2262
2263######################################################################
2264
2265
2266
2267SLocal_check_mail
2268
2269Scheck_mail
2270
2271R$* $: $1 $| $>"Local_check_mail" $1
2272
2273R$* $| $#$* $#$2
2274
2275R$* $| $* $@ $>"Basic_check_mail" $1
2276
2277
2278
2279SBasic_check_mail
2280
2281# check for deferred delivery mode
2282
2283R$* $: < $&{deliveryMode} > $1
2284
2285R< d > $* $@ deferred
2286
2287R< $* > $* $: $2
2288
2289
2290
2291# authenticated?
2292
2293R$* $: $1 $| $>"tls_client" $&{verify} $| MAIL
2294
2295R$* $| $#$+ $#$2
2296
2297R$* $| $* $: $1
2298
2299
2300
2301R<> $@ <ok> we MUST accept <> (RFC 1123)
2302
2303R$+ $: <? > $1
2304
2305R<? ><$+> $: <@> <$1>
2306
2307R<? >$+ $: <@> <$1>
2308
2309R$* $: $&{daemon_flags} $| $1
2310
2311R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >
2312
2313R$* u $* $| <@> < $* > $: <? > < $3 >
2314
2315R$* $| $* $: $2
2316
2317# handle case of @localhost on address
2318
2319R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
2320
2321R<@> < $* @ [127.0.0.1] >
2322
2323$: < ? $&{client_name} > < $1 @ [127.0.0.1] >
2324
2325R<@> < $* @ localhost.$m >
2326
2327$: < ? $&{client_name} > < $1 @ localhost.$m >
2328
2329R<@> < $* @ localhost.UUCP >
2330
2331$: < ? $&{client_name} > < $1 @ localhost.UUCP >
2332
2333R<@> $* $: $1 no localhost as domain
2334
2335R<? $=w> $* $: $2 local client: ok
2336
2337R<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
2338
2339R<? > $* $: $1
2340
2341R$* $: <? > $>CanonAddr $1 canonify sender address and mark it
2342
2343R<? > $* < @ $+ . > <? > $1 < @ $2 > strip trailing dots
2344
2345# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
2346
2347R<? > $* < @ $* $=P > $: <okr> $1 < @ $2 $3 >
2348
2349R<? > $* < @ $j > $: <okr> $1 < @ $j >
2350
2351R<? > $* < @ $+ > $: <okr> $1 < @ $2 > ... unresolvable OK
2352
2353
2354
2355# check sender address: user@address, user@, address
2356
2357R<$+> $+ < @ $* > $: @<$1> <$2 < @ $3 >> $| <f:$2@$3> <u:$2@> <d:$3>
2358
2359R<$+> $+ $: @<$1> <$2> $| <u:$2@>
2360
2361R@ <$+> <$*> $| <$+> $: <@> <$1> <$2> $| $>SearchList <\+ From> $| <$3> <>
2362
2363R<@> <$+> <$*> $| <$*> $: <$3> <$1> <$2> reverse result
2364
2365# retransform for further use
2366
2367R<? > <$+> <$*> $: <$1> $2 no match
2368
2369R<$+> <$+> <$*> $: <$1> $3 relevant result, keep it
2370
2371
2372
2373# handle case of no @domain on address
2374
2375R<? > $* $: $&{daemon_flags} $| <? > $1
2376
2377R$* u $* $| <? > $* $: <okr> $3
2378
2379R$* $| $* $: $2
2380
2381R<? > $* $: < ? $&{client_addr} > $1
2382
2383R<? > $* $@ <okr> ...local unqualed ok
2384
2385R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
2386
2387...remote is not
2388
2389# check results
2390
2391R<? > $* $: @ $1 mark address: nothing known about it
2392
2393R<$={ResOk}> $* $@ <okr> domain ok: stop
2394
2395R<temp> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
2396
2397R<perm> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
2398
2399R<$={Accept}> $* $# $1 accept from access map
2400
2401R<discard> $* $#discard $: discard
2402
2403R<reject> $* $#error $@ 5.7.1 $: "550 Access denied"
2404
2405R<error:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4
2406
2407R<error:$+> $* $#error $: $1
2408
2409R<<tmpf>> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2410
2411R<$+> $* $#error $: $1 error from access db
2412
2413
2414
2415######################################################################
2416
2417### check_rcpt -- check SMTP `RCPT TO:' command argument
2418
2419######################################################################
2420
2421
2422
2423SLocal_check_rcpt
2424
2425Scheck_rcpt
2426
2427R$* $: $1 $| $>"Local_check_rcpt" $1
2428
2429R$* $| $#$* $#$2
2430
2431R$* $| $* $@ $>"Basic_check_rcpt" $1
2432
2433
2434
2435SBasic_check_rcpt
2436
2437# empty address?
2438
2439R<> $#error $@ nouser $: "553 User address required"
2440
2441R$@ $#error $@ nouser $: "553 User address required"
2442
2443# check for deferred delivery mode
2444
2445R$* $: < $&{deliveryMode} > $1
2446
2447R< d > $* $@ deferred
2448
2449R< $* > $* $: $2
2450
2451
2452
2453
2454
2455######################################################################
2456
2457R$* $: $1 $| @ $>"Rcpt_ok" $1
2458
2459R$* $| @ $#TEMP $+ $: $1 $| T $2
2460
2461R$* $| @ $#$* $#$2
2462
2463R$* $| @ RELAY $@ RELAY
2464
2465R$* $| @ $* $: O $| $>"Relay_ok" $1
2466
2467R$* $| T $+ $: T $2 $| $>"Relay_ok" $1
2468
2469R$* $| $#TEMP $+ $#error $2
2470
2471R$* $| $#$* $#$2
2472
2473R$* $| RELAY $@ RELAY
2474
2475R T $+ $| $* $#error $1
2476
2477# anything else is bogus
2478
2479R$* $#error $@ 5.7.1 $: "550 Relaying denied"
2480
2481
2482
2483
2484
2485######################################################################
2486
2487### Rcpt_ok: is the recipient ok?
2488
2489######################################################################
2490
2491SRcpt_ok
2492
2493R$* $: $>ParseRecipient $1 strip relayable hosts
2494
2495
2496
2497
2498
2499
2500
2501# blacklist local users or any host from receiving mail
2502
2503R$* $: <? > $1
2504
2505R<? > $+ < @ $=w > $: <> <$1 < @ $2 >> $| <f:$1@$2> <u:$1@> <d:$2>
2506
2507R<? > $+ < @ $* > $: <> <$1 < @ $2 >> $| <f:$1@$2> <d:$2>
2508
2509R<? > $+ $: <> <$1> $| <u:$1@>
2510
2511R<> <$*> $| <$+> $: <@> <$1> $| $>SearchList <\+ To> $| <$2> <>
2512
2513R<@> <$*> $| <$*> $: <$2> <$1> reverse result
2514
2515R<? > <$*> $: @ $1 mark address as no match
2516
2517R<$={Accept}> <$*> $: @ $2 mark address as no match
2518
2519
2520
2521R<reject> $* $#error $@ 5.2.1 $: "550 Mailbox disabled for this recipient"
2522
2523R<discard> $* $#discard $: discard
2524
2525R<error:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4
2526
2527R<error:$+> $* $#error $: $1
2528
2529R<<tmpf>> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2530
2531R<$+> $* $#error $: $1 error from access db
2532
2533R@ $* $1 remove mark
2534
2535
2536
2537# authenticated via TLS?
2538
2539R$* $: $1 $| $>RelayTLS client authenticated?
2540
2541R$* $| $# $+ $# $2 error/ok?
2542
2543R$* $| $* $: $1 no
2544
2545
2546
2547R$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
2548
2549R$* $| $# $* $# $2
2550
2551R$* $| NO $: $1
2552
2553R$* $| $* $: $1 $| $&{auth_type}
2554
2555R$* $| $: $1
2556
2557R$* $| $={TrustAuthMech} $# RELAY
2558
2559R$* $| $* $: $1
2560
2561# anything terminating locally is ok
2562
2563R$+ < @ $=w > $@ RELAY
2564
2565R$+ < @ $* $=R > $@ RELAY
2566
2567R$+ < @ $+ > $: $>D <$2> <? > <\+ To> <$1 < @ $2 >>
2568
2569R<relay> $* $@ RELAY
2570
2571R<$* <tmpf>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2572
2573R<$*> <$*> $: $2
2574
2575
2576
2577
2578
2579
2580
2581# check for local user (i.e. unqualified address)
2582
2583R$* $: <? > $1
2584
2585R<? > $* < @ $+ > $: <remote> $1 < @ $2 >
2586
2587# local user is ok
2588
2589R<? > $+ $@ RELAY
2590
2591R<$+> $* $: $2
2592
2593
2594
2595######################################################################
2596
2597### Relay_ok: is the relay/sender ok?
2598
2599######################################################################
2600
2601SRelay_ok
2602
2603# anything originating locally is ok
2604
2605# check IP address
2606
2607R$* $: $&{client_addr}
2608
2609R$@ $@ RELAY originated locally
2610
2611R0 $@ RELAY originated locally
2612
2613R127.0.0.1 $@ RELAY originated locally
2614
2615RIPv6:::1 $@ RELAY originated locally
2616
2617R$=R $* $@ RELAY relayable IP address
2618
2619R$* $: $>A <$1> <? > <\+ Connect> <$1>
2620
2621R<relay> $* $@ RELAY relayable IP address
2622
2623
2624
2625R<<tmpf>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2626
2627R<$*> <$*> $: $2
2628
2629R$* $: [ $1 ] put brackets around it...
2630
2631R$=w $@ RELAY ... and see if it is local
2632
2633
2634
2635
2636
2637# check client name: first: did it resolve?
2638
2639R$* $: < $&{client_resolve} >
2640
2641R<temp> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
2642
2643R<forged> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
2644
2645R<fail> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
2646
2647R$* $: <@> $&{client_name}
2648
2649# pass to name server to make hostname canonical
2650
2651R<@> $* $=P $:<? > $1 $2
2652
2653R<@> $+ $:<? > $[ $1 $]
2654
2655R$* . $1 strip trailing dots
2656
2657R<? > $=w $@ RELAY
2658
2659R<? > $* $=R $@ RELAY
2660
2661R<? > $* $: $>D <$1> <? > <\+ Connect> <$1>
2662
2663R<relay> $* $@ RELAY
2664
2665R<$* <tmpf>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
2666
2667R<$*> <$*> $: $2
2668
2669
2670
2671
2672
2673######################################################################
2674
2675### F: LookUpFull -- search for an entry in access database
2676
2677###
2678
2679### lookup of full key (which should be an address) and
2680
2681### variations if +detail exists: +* and without +detail
2682
2683###
2684
2685### Parameters:
2686
2687### <$1> \-- key
2688
2689### <$2> \-- default (what to return if not found in db)
2690
2691### <$3> \-- mark (must be <(!|+) single-token> )
2692
2693### ! does lookup only with tag
2694
2695### + does lookup with and without tag
2696
2697### <$4> \-- passthru (additional data passed unchanged through)
2698
2699######################################################################
2700
2701
2702
2703SF
2704
2705R<$+> <$*> <$- $-> <$*> $: <$(access $4:$1 $: ? $)> <$1> <$2> <$3 $4> <$5>
2706
2707R<</tmpf></relay></fail></forged></temp></tmpf></relay></remote></tmpf></relay></tmpf></error:$+></error:$-.$-.$-:$+></discard></reject></u:$1@></d:$2></f:$1@$2></d:$2></u:$1@></f:$1@$2></tmpf></error:$+></error:$-.$-.$-:$+></reject></discard></perm></temp></okr></okr></okr></u:$2@></d:$3></u:$2@></f:$2@$3></okr></okr></okr></ok></tmpf></error:$+></error:$-.$-.$-:$+></discard></reject></relay></no></no></relay></no></no></tmpf></tmpf></tmpf></tmpf></i></route-addr></list:;></user@d></list:;></addr></tmpf></[email protected]>