carterdte_smtp_filter 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48b021452547b95cf8e39e280ba9313cfbf42b95
4
- data.tar.gz: f48def6d7ee510c4b5433e5ff0e994fa50f8e22e
3
+ metadata.gz: 15763b5bf2fc025f796cedede2b41f276e0946b7
4
+ data.tar.gz: 87f49d7fb60cb7e8d631ad3e8df40c64234eabe6
5
5
  SHA512:
6
- metadata.gz: b436782a20003d01854a65b571da4781b76468b8f64d28c9bbc014a11cf7811daaeae108f9901c2ba65fc07e807db232fbc02262dd43f4b0267ebe6f9ace0133
7
- data.tar.gz: 236b3d79c940ae603b9e3fc59099b844849616138bb490a0701a45c7a2889884c1486199e19f916ac6b117bc3794d4708a9f38c8df1438ec3b17895a95c9a27a
6
+ metadata.gz: 4392e86bf4752fb742ebe09b01927b3d2fac5b55d304d389d86798ea771afe79d15f469dd08220bada18a234820b4cbb03dc0f660e5592b4910aafd11ced61ef
7
+ data.tar.gz: 81dd3a6567fdd151cf49ba839ed3167aea291c4adbe31b259318276b71a34915df7861fb2d4b96747190eddedddd2f0ac203a3f6426e25ad77eab82ae7ec56d0
data/README.md CHANGED
@@ -28,11 +28,56 @@ elasticsearch_host: 127.0.0.1
28
28
  elasticsearch_port: 9200
29
29
  api_user: pbruna@example.com
30
30
  api_password: 123456
31
- api_host: "api.dte.zboxapp.com"
31
+ api_url: "http://api.dte.zboxapp.com/dte_messages"
32
32
  log_file: "./test/tmp/carterdte_smtp_filter.log"
33
33
  stand_alone: ""
34
34
  ```
35
35
 
36
+ ## Postifx Configuration
37
+
38
+ ```
39
+ # master.cf
40
+ [0.0.0.0]:30025 inet n - n - - smtpd
41
+ -o content_filter=
42
+ -o local_recipient_maps=
43
+ -o virtual_mailbox_maps=
44
+ -o virtual_alias_maps=
45
+ -o relay_recipient_maps=
46
+ -o smtpd_restriction_classes=
47
+ -o smtpd_delay_reject=no
48
+ -o smtpd_client_restrictions=permit_mynetworks,reject
49
+ -o smtpd_data_restrictions=
50
+ -o smtpd_end_of_data_restrictions=
51
+ -o smtpd_helo_restrictions=
52
+ -o smtpd_milters=
53
+ -o smtpd_sender_restrictions=
54
+ -o smtpd_reject_unlisted_sender=no
55
+ -o smtpd_relay_restrictions=
56
+ -o smtpd_recipient_restrictions=permit_mynetworks,reject
57
+ -o mynetworks_style=host
58
+ -o mynetworks=127.0.0.0/8,[::1]/128
59
+ -o strict_rfc821_envelopes=yes
60
+ -o smtpd_error_sleep_time=0
61
+ -o smtpd_soft_error_limit=1001
62
+ -o smtpd_hard_error_limit=1000
63
+ -o smtpd_client_connection_count_limit=0
64
+ -o smtpd_client_connection_rate_limit=0
65
+ -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
66
+ -o local_header_rewrite_clients=
67
+ -o syslog_name=postfix/carterdte
68
+ smtp-carterdte unix - - n - 10 smtp
69
+ -o smtp_data_done_timeout=1200
70
+ -o smtp_send_xforward_command=yes
71
+ -o disable_dns_lookups=yes
72
+ -o max_use=20
73
+ ```
74
+
75
+ ```
76
+ # main.cf
77
+ content_filter = smtp-carterdte:[127.0.0.1]:30024
78
+ ```
79
+
80
+
36
81
  ## Contributing
37
82
 
38
83
  1. Fork it ( https://github.com/[my-github-username]/carterdte_smtp_filter/fork )
@@ -45,8 +45,7 @@ module CarterdteSmtpFilter
45
45
  end
46
46
 
47
47
  def post(opts = {})
48
- protocol = CarterdteSmtpFilter::Config::use_https ? "https" : "http"
49
- url = opts[:url] || "#{protocol}://#{CarterdteSmtpFilter::Config::api_host}/messages"
48
+ url = opts[:url] || CarterdteSmtpFilter::Config::api_url
50
49
  payload = opts[:payload] || {}
51
50
  begin
52
51
  resource = RestClient::Resource.new url, api_user, api_password
@@ -1,3 +1,3 @@
1
1
  module CarterdteSmtpFilter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/test/fake_api.rb CHANGED
@@ -30,7 +30,7 @@ class FakeApi < Sinatra::Base
30
30
  end
31
31
 
32
32
 
33
- post '/messages' do
33
+ post '/dte_messages' do
34
34
  request.body.rewind
35
35
  data = JSON.parse request.body.read
36
36
  status = 200
@@ -9,7 +9,6 @@ elasticsearch_host: 127.0.0.1
9
9
  elasticsearch_port: 9200
10
10
  api_user: pbruna@example.com
11
11
  api_password: 123456
12
- api_host: "api.dte.zboxapp.com"
12
+ api_url: "http://api.dte.zboxapp.com/dte_messages"
13
13
  log_file: "./test/tmp/carterdte_smtp_filter.log"
14
- spool_directory: "./test/tmp/spool"
15
- use_https: true
14
+ spool_directory: "./test/tmp/spool"
@@ -5,9 +5,9 @@ class TestApiClient < Minitest::Test
5
5
 
6
6
  def setup
7
7
  CarterdteSmtpFilter::Config.parse("./test/fixtures/config.yml")
8
- @api_host = CarterdteSmtpFilter::Config::api_host
9
- @api_url = "http://#{@api_host}"
10
- stub_request(:any, /#{@api_host}/).to_rack(FakeApi)
8
+ @api_host = "api.dte.zboxapp.com"
9
+ @api_url = CarterdteSmtpFilter::Config::api_url
10
+ stub_request(:any, /api.dte.zboxapp.com/).to_rack(FakeApi)
11
11
  end
12
12
 
13
13
  def test_push_should_return_false_if_message_is_not_json
@@ -22,12 +22,12 @@ class TestApiClient < Minitest::Test
22
22
  end
23
23
 
24
24
  def test_post_should_workout_unauthorized
25
- response = CarterdteSmtpFilter::ApiClient.new.post({url: "#{@api_url}/api/v1/denied" })
25
+ response = CarterdteSmtpFilter::ApiClient.new.post({url: "http://#{@api_host}/api/v1/denied" })
26
26
  assert(!response, "Failure message.")
27
27
  end
28
28
 
29
29
  def test_post_should_workout_application_error
30
- response = CarterdteSmtpFilter::ApiClient.new.post({url: "#{@api_url}/api/v1/app_error" })
30
+ response = CarterdteSmtpFilter::ApiClient.new.post({url: "http://#{@api_host}/api/v1/app_error" })
31
31
  assert(!response, "Failure message.")
32
32
  end
33
33
 
@@ -41,7 +41,7 @@ class TestApiClient < Minitest::Test
41
41
  end
42
42
 
43
43
  def test_post_duplicated_message_should_return_true
44
- response = CarterdteSmtpFilter::ApiClient.new.post({url: "#{@api_url}/messages/uniq" })
44
+ response = CarterdteSmtpFilter::ApiClient.new.post({url: "http://#{@api_host}/messages/uniq" })
45
45
  assert(response, "Failure message.")
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ class TestApiClient < Minitest::Test
49
49
  CarterdteSmtpFilter::Spool.directory_setup
50
50
  raw_mail = File.open("./test/fixtures/mail_with_dte.eml", "rb").read
51
51
  message = CarterdteSmtpFilter::Message.new raw_mail
52
- CarterdteSmtpFilter::ApiClient.new.push(message, "#{@api_url}/api/v1/app_error")
52
+ CarterdteSmtpFilter::ApiClient.new.push(message, "http://#{@api_host}/api/v1/app_error")
53
53
  assert(File.file?("#{message.queue_file}"), "Failure message.")
54
54
  end
55
55
 
data/test/test_config.rb CHANGED
@@ -20,7 +20,7 @@ class TestConfig < Minitest::Test
20
20
  assert_equal(@config["return_port"], CarterdteSmtpFilter::Config::return_port)
21
21
  assert_equal(@config["api_user"], CarterdteSmtpFilter::Config::api_user)
22
22
  assert_equal(@config["api_password"], CarterdteSmtpFilter::Config::api_password)
23
- assert_equal(@config["api_host"], CarterdteSmtpFilter::Config::api_host)
23
+ assert_equal(@config["api_url"], CarterdteSmtpFilter::Config::api_url)
24
24
  assert_equal(@config["log_file"], CarterdteSmtpFilter::Config::log_file)
25
25
  end
26
26
 
@@ -4,8 +4,8 @@ class TestSpoolManager < Minitest::Test
4
4
  require 'sucker_punch/testing/inline'
5
5
 
6
6
  def setup
7
- @api_host = CarterdteSmtpFilter::Config::api_host
8
- @api_url = "http://#{@api_host}"
7
+ @api_host = "api.dte.zboxapp.com"
8
+ @api_url = CarterdteSmtpFilter::Config::api_url
9
9
  stub_request(:any, /#{@api_host}/).to_rack(FakeApi)
10
10
  CarterdteSmtpFilter::Config.parse("./test/fixtures/config.yml")
11
11
  CarterdteSmtpFilter::Spool.directory_setup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carterdte_smtp_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patricio Bruna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail