Hex Artifact Content
Logged in as anonymous

Artifact 01323d89198ebc782a6183ee103454889853ad26b094dd3ad485fa490185221b:


0000: 46 69 72 73 74 20 6f 66 20 61 6c 6c 20 6d 61 6b  First of all mak
0010: 65 20 73 75 72 65 20 74 6f 20 6e 65 76 65 72 20  e sure to never 
0020: 6c 69 73 74 65 6e 20 6f 6e 20 70 75 62 6c 69 63  listen on public
0030: 20 49 50 73 20 61 6e 64 20 61 6c 77 61 79 73 20   IPs and always 
0040: 70 75 74 20 73 6f 63 6b 65 74 73 20 69 6e 0a 64  put sockets in.d
0050: 69 72 65 63 74 6f 72 69 65 73 20 6e 6f 74 20 61  irectories not a
0060: 63 65 73 73 69 62 6c 65 20 62 79 20 6a 75 73 74  cessible by just
0070: 20 61 62 6f 75 74 20 65 76 65 72 79 6f 6e 65 20   about everyone 
0080: 6f 6e 20 79 6f 75 72 20 73 79 73 74 65 6d 2e 20  on your system. 
0090: 54 68 6f 75 67 68 0a 6c 69 73 74 65 6e 69 6e 67  Though.listening
00a0: 20 6f 6e 20 31 32 37 2e 30 2e 30 2e 31 3a 58 58   on 127.0.0.1:XX
00b0: 58 58 20 69 73 20 65 71 75 69 76 61 6c 65 6e 74  XX is equivalent
00c0: 20 74 6f 20 63 72 65 61 74 69 6e 67 20 61 20 77   to creating a w
00d0: 6f 72 6c 64 2d 77 72 69 74 61 62 6c 65 20 73 6f  orld-writable so
00e0: 63 6b 65 74 2e 0a 0a 54 6f 20 63 61 74 63 68 20  cket...To catch 
00f0: 62 6f 75 6e 63 65 73 20 28 73 6f 20 74 68 65 79  bounces (so they
0100: 20 77 6f 75 6c 64 6e 27 74 20 73 74 75 63 6b 20   wouldn't stuck 
0110: 69 6e 20 75 70 70 65 72 20 6d 61 69 6c 20 73 65  in upper mail se
0120: 72 76 65 72 29 20 6d 61 6b 65 20 73 75 72 65 20  rver) make sure 
0130: 73 65 6e 64 65 72 0a 65 6e 76 65 6c 6f 70 65 20  sender.envelope 
0140: 61 64 64 72 65 73 73 20 69 73 20 72 65 61 6c 20  address is real 
0150: 61 73 20 72 65 71 75 69 72 65 64 20 62 79 20 53  as required by S
0160: 61 4d 6f 54 6f 50 2e 20 46 6f 72 20 65 78 61 6d  aMoToP. For exam
0170: 70 6c 65 20 50 6f 73 74 66 69 78 20 68 61 73 20  ple Postfix has 
0180: 74 6f 20 62 65 0a 74 77 65 61 6b 65 64 20 6c 69  to be.tweaked li
0190: 6b 65 20 74 68 69 73 3a 0a 0a 24 63 6f 6e 66 69  ke this:..$confi
01a0: 67 5f 64 69 72 65 63 74 6f 72 79 2f 6d 61 69 6e  g_directory/main
01b0: 2e 63 66 3a 0a 09 73 6d 74 70 5f 67 65 6e 65 72  .cf:..smtp_gener
01c0: 69 63 5f 6d 61 70 73 20 3d 20 68 61 73 68 3a 24  ic_maps = hash:$
01d0: 63 6f 6e 66 69 67 5f 64 69 72 65 63 74 6f 72 79  config_directory
01e0: 2f 67 65 6e 65 72 69 63 0a 0a 24 63 6f 6e 66 69  /generic..$confi
01f0: 67 5f 64 69 72 65 63 74 6f 72 79 2f 67 65 6e 65  g_directory/gene
0200: 72 69 63 3a 0a 09 22 22 09 70 6f 73 74 6d 61 73  ric:.."".postmas
0210: 74 65 72 40 65 78 61 6d 70 6c 65 2e 63 6f 6d 0a  ter@example.com.
0220: 09 3c 3e 09 70 6f 73 74 6d 61 73 74 65 72 40 65  .<>.postmaster@e
0230: 78 61 6d 70 6c 65 2e 63 6f 6d 0a 0a 41 63 74 75  xample.com..Actu
0240: 61 6c 6c 79 20 6e 6f 74 20 73 75 72 65 20 77 68  ally not sure wh
0250: 69 63 68 20 6f 6e 65 20 77 6f 72 6b 73 2e 2e 2e  ich one works...
0260: 0a 0a 49 20 6b 69 6e 64 64 61 20 6b 6e 6f 77 20  ..I kindda know 
0270: 74 68 69 73 20 77 68 6f 6c 65 20 73 74 75 66 66  this whole stuff
0280: 20 69 73 20 77 72 69 74 74 65 6e 20 69 6e 20 63   is written in c
0290: 6f 6d 70 6c 65 74 65 6c 79 20 77 72 6f 6e 67 20  ompletely wrong 
02a0: 77 61 79 2c 20 62 75 74 20 49 20 68 61 76 65 0a  way, but I have.
02b0: 72 65 61 73 6f 6e 73 20 66 6f 72 20 74 68 61 74  reasons for that
02c0: 2e 20 53 61 4d 6f 54 6f 50 20 70 72 65 76 65 6e  . SaMoToP preven
02d0: 74 20 6d 65 20 66 72 6f 6d 20 63 72 65 61 74 69  t me from creati
02e0: 6e 67 20 61 20 73 65 70 61 72 61 74 65 20 74 72  ng a separate tr
02f0: 61 6e 73 70 6f 72 74 20 73 6f 20 49 27 6d 0a 6a  ansport so I'm.j
0300: 75 73 74 20 75 73 69 6e 67 20 4d 61 69 6c 44 69  ust using MailDi
0310: 72 20 61 6e 64 20 64 69 72 65 63 74 6c 79 20 72  r and directly r
0320: 65 61 64 69 6e 67 20 66 69 6c 65 73 20 66 72 6f  eading files fro
0330: 6d 20 74 68 65 72 65 20 69 6e 20 73 65 70 61 72  m there in separ
0340: 61 74 65 20 74 61 73 6b 2e 20 41 6c 73 6f 0a 73  ate task. Also.s
0350: 6f 63 6b 65 74 20 70 65 72 6d 69 73 73 69 6f 6e  ocket permission
0360: 73 20 63 61 6e 27 74 20 61 63 74 75 61 6c 6c 79  s can't actually
0370: 20 62 65 20 68 69 6e 74 65 64 20 74 6f 20 53 61   be hinted to Sa
0380: 4d 6f 54 6f 50 2c 20 61 6e 64 20 49 20 64 6f 6e  MoToP, and I don
0390: 27 74 20 77 61 6e 74 20 74 6f 0a 6d 65 73 73 20  't want to.mess 
03a0: 77 69 74 68 20 75 6d 61 73 6b 20 69 6e 20 74 68  with umask in th
03b0: 69 73 20 63 61 73 65 2c 20 68 65 6e 63 65 20 74  is case, hence t
03c0: 68 65 20 65 78 74 72 61 20 74 61 73 6b 20 74 68  he extra task th
03d0: 61 74 20 63 68 61 6e 67 65 73 20 73 6f 63 6b 65  at changes socke
03e0: 74 0a 70 65 72 6d 69 73 73 69 6f 6e 73 20 6c 61  t.permissions la
03f0: 74 65 72 2e 20 54 68 65 20 77 68 6f 6c 65 20 4d  ter. The whole M
0400: 61 69 6c 44 69 72 20 69 64 65 61 20 77 61 73 20  ailDir idea was 
0410: 73 68 61 6d 65 6c 65 73 73 6c 79 20 72 69 70 70  shamelessly ripp
0420: 65 64 20 66 72 6f 6d 0a 68 74 74 70 73 3a 2f 2f  ed from.https://
0430: 67 69 74 68 75 62 2e 63 6f 6d 2f 6d 65 79 73 61  github.com/meysa
0440: 6d 38 31 2f 6c 6f 72 69 2c 20 6b 75 64 6f 73 20  m81/lori, kudos 
0450: 74 6f 20 74 68 65 20 61 75 74 68 6f 72 2e 20 41  to the author. A
0460: 6e 64 20 69 66 20 79 6f 75 20 74 68 69 6e 6b 20  nd if you think 
0470: 49 0a 61 63 74 75 61 6c 6c 79 20 63 6f 70 79 70  I.actually copyp
0480: 61 73 74 65 64 20 74 6f 6f 20 6d 75 63 68 20 63  asted too much c
0490: 6f 64 65 20 2d 20 79 6f 75 20 61 72 65 20 66 72  ode - you are fr
04a0: 65 65 20 74 6f 20 75 73 65 20 74 68 69 73 20 75  ee to use this u
04b0: 6e 64 65 72 20 41 50 41 43 48 45 2d 32 2e 30 0a  nder APACHE-2.0.
04c0: 6c 69 63 65 6e 73 65 2e 0a                       license..