net-receiver 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -40
- data/lib/net/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d5eea2e6448830a5f0eab76eec380fd40da0f8a
|
4
|
+
data.tar.gz: 9b5373996ea3bc356c5d41f979cd35bdd49fa5ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71299d172ed45dd97cfcf98e13dc19bf48d7fe02dca670e382d1df0a3e53e7b4198f94713c2cefa30b27b7562a8385c56290583d37a848ab83ebb2b68a469582
|
7
|
+
data.tar.gz: bb0f889c65ec8c97ae6e00714efb642fdd51ea7a139440454f5199cc38588df22ad4c327f6e871946dcf445956b5d369f7e2391b0bcc7a4cba1b1aecf9d7363e
|
data/README.md
CHANGED
@@ -8,6 +8,8 @@ Currently, I'm using this as the base for an MTA written in Ruby. There's no int
|
|
8
8
|
|
9
9
|
That being said, If you use this for anything, and want me to make special changes that don't interfere with my purpose, email me at mjwelchphd@gmail.com, and I'll work with you as best I can.
|
10
10
|
|
11
|
+
The source code for this project is located at https://github.com/mjwelchphd/net-receiver
|
12
|
+
|
11
13
|
# General
|
12
14
|
|
13
15
|
This gem sits on top of my net-server gem, and receives standard emails. It has only a few checks that it makes on the incoming email, leaving the specialized checks up to you. You can change it's behavior by overriding base methods, and adding your own programming; don't worry, I'll show you how. Your Ruby overrides are the same as witing a configuration file for a standard MTA.
|
@@ -113,6 +115,7 @@ The method `psych_value` is used with MAIL FROM and RCPT TO commands to validate
|
|
113
115
|
- characters ! # $ % & ' * + - / = ? ^ _ ` { | } ~
|
114
116
|
- dots, which must not be first or last character, and must not appear two or more times consecutively
|
115
117
|
4. If the option is selected, it does a Dig MX lookup, followed by a Dig A (IP) lookup if the MX was successful. This is helpful to determine if the sender's domain is legitimate.
|
118
|
+
5. `psych_value` also checks for an empty address ("<>") which means it's a bounced message.
|
116
119
|
|
117
120
|
The main method is the `receive` method (which is called by net-server when a connection is requested). Receive uses the aforementioned table to read the commands and process them. It also allocates an 'item of mail' structure to put it's findings in.
|
118
121
|
|
@@ -179,23 +182,23 @@ Here is a sample structure for an authenticated email.
|
|
179
182
|
{
|
180
183
|
:local_port=>"2001",
|
181
184
|
:local_hostname=>"mail.example.com",
|
182
|
-
:remote_port=>"
|
183
|
-
:remote_hostname=>"
|
184
|
-
:remote_ip=>"::ffff:107.
|
185
|
-
:id=>"
|
186
|
-
:time=>"2016-
|
185
|
+
:remote_port=>"54278",
|
186
|
+
:remote_hostname=>"example.com",
|
187
|
+
:remote_ip=>"::ffff:107.105.187.182",
|
188
|
+
:id=>"OELGQA-A58QI3-AA",
|
189
|
+
:time=>"2016-10-05 21:51:46 +0000",
|
187
190
|
:accepted=>true,
|
188
191
|
:prohibited=>false,
|
189
192
|
:encrypted=>true,
|
190
|
-
:authenticated=>
|
193
|
+
:authenticated=>false,
|
191
194
|
:connect=>{
|
192
|
-
:value=>"::ffff:107.
|
195
|
+
:value=>"::ffff:107.105.187.182",
|
193
196
|
:domain=>nil
|
194
197
|
},
|
195
198
|
:ehlo=>{
|
196
|
-
:value=>"
|
197
|
-
:rip=>"
|
198
|
-
:fip=>"
|
199
|
+
:value=>"example.com",
|
200
|
+
:rip=>"93.184.216.34",
|
201
|
+
:fip=>"93.184.216.34",
|
199
202
|
:domain=>"mail.example.com"
|
200
203
|
},
|
201
204
|
:mailfrom=>{
|
@@ -207,45 +210,48 @@ Here is a sample structure for an authenticated email.
|
|
207
210
|
:domain=>"example.com",
|
208
211
|
:bad_characters=>false,
|
209
212
|
:wrong_dot_usage=>false,
|
210
|
-
:ip=>"
|
213
|
+
:ip=>"93.184.216.34",
|
211
214
|
:mxs=>[
|
212
215
|
"mail.example.com"
|
213
216
|
],
|
214
217
|
:ips=>[
|
215
|
-
"
|
216
|
-
]
|
218
|
+
"93.184.216.34"
|
219
|
+
],
|
220
|
+
:spf=>:pass
|
217
221
|
},
|
218
222
|
:rcptto=>[
|
219
223
|
{
|
220
224
|
:accepted=>true,
|
221
|
-
:value=>"<
|
225
|
+
:value=>"<abuse@example.com>",
|
222
226
|
:name=>"",
|
223
|
-
:url=>"
|
224
|
-
:local_part=>"
|
225
|
-
:domain=>"example.com"
|
227
|
+
:url=>"abuse@example.com",
|
228
|
+
:local_part=>"abuse",
|
229
|
+
:domain=>"example.com",
|
230
|
+
:bad_characters=>false,
|
231
|
+
:wrong_dot_usage=>false,
|
232
|
+
:ip=>"93.184.216.34",
|
233
|
+
:mxs=>[
|
234
|
+
"mail.example.com"
|
235
|
+
],
|
236
|
+
:ips=>[
|
237
|
+
"93.184.216.34"
|
238
|
+
]
|
226
239
|
}
|
227
240
|
],
|
228
241
|
:data=>{
|
229
242
|
:accepted=>true,
|
230
243
|
:value=>"",
|
244
|
+
:headers=>{
|
245
|
+
:date=>"Date: Wed, 05 Oct 2016 14:51:46 -0700",
|
246
|
+
:to=>"To: abuse@example.com",
|
247
|
+
:from=>"From: admin@example.com",
|
248
|
+
:subject=>"Subject: test Wed, 05 Oct 2016 14:51:46 -0700",
|
249
|
+
:x_mailer=>"X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/"
|
250
|
+
},
|
231
251
|
:text=>[
|
232
|
-
"Date: Fri, 23 Sep 2016 19:38:55 -0700",
|
233
|
-
"To: coco@example.com",
|
234
|
-
"From: admin@example.com",
|
235
|
-
"Subject: test Fri, 23 Sep 2016 19:38:55 -0700",
|
236
|
-
"X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/",
|
237
|
-
"",
|
238
252
|
"This is a test mailing",
|
239
|
-
""
|
240
|
-
|
241
|
-
],
|
242
|
-
:headers=>{
|
243
|
-
:date=>"Fri, 23 Sep 2016 19:38:55 -0700",
|
244
|
-
:to=>"coco@example.com",
|
245
|
-
:from=>"admin@example.com",
|
246
|
-
:subject=>"test Fri, 23 Sep 2016 19:38:55 -0700",
|
247
|
-
:x_mailer=>"swaks v20130209.0 jetmore.org/john/code/swaks/"
|
248
|
-
}
|
253
|
+
""
|
254
|
+
]
|
249
255
|
}
|
250
256
|
}
|
251
257
|
```
|
@@ -299,6 +305,7 @@ Here is a sample structure for an authenticated email.
|
|
299
305
|
| :ip | This is the IP from looking up the domain. |
|
300
306
|
| :mxs | This is a list of one or more mail servers for this domain. |
|
301
307
|
| :ips | This is a list of IPs obtained by looking up the MXs above. |
|
308
|
+
| :spf | This is the SPF check on the sender. It will normally be :pass or :fail. To learn more about SPF, go to `http://www.openspf.org/`. |
|
302
309
|
|
303
310
|
### RCPT TO Values (a list)
|
304
311
|
|
@@ -327,14 +334,13 @@ Here's an example:
|
|
327
334
|
|
328
335
|
|Key |Value |
|
329
336
|
|:--- |:--- |
|
330
|
-
| :date | "
|
331
|
-
| :to | "
|
332
|
-
| :from | "admin@example.com"
|
333
|
-
| :subject | "test
|
334
|
-
| :x_mailer | "swaks v20130209.0 jetmore.org/john/code/swaks/" |
|
335
|
-
|
337
|
+
| :date | "Date: Wed, 05 Oct 2016 14:51:46 -0700" |
|
338
|
+
| :to | "To: abuse@example.com" |
|
339
|
+
| :from | "From: admin@example.com" |
|
340
|
+
| :subject | "Subject: test Wed, 05 Oct 2016 14:51:46 -0700" |
|
341
|
+
| :x_mailer | "X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/" |
|
336
342
|
|
337
|
-
The headers are put into a hash like this so that you may easily locate them, or test to see if they exist or not.
|
343
|
+
The headers are put into a hash like this so that you may easily locate them, or test to see if they exist or not.
|
338
344
|
|
339
345
|
|
340
346
|
FIN
|
data/lib/net/version.rb
CHANGED