Class: Property::Postfix

Inherits:
Property
  • Object
show all
Defined in:
app/models/property/postfix.rb

Instance Attribute Summary

Attributes inherited from Property

#collection, #multiple, #translate

Class Method Summary collapse

Methods inherited from Property

add, all_new_values, all_new_values_for_write, all_to_show, #has_new_value?, #input_type, #set_value

Class Method Details

.dkim_power(a, run) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/models/property/postfix.rb', line 38

def self.dkim_power(a, run)
  a.edit :file => "#{etc_postfix}/main.cf", :backup => false do
    if run
      uncomment 'smtpd_milters = inet:127.0.0.1:8891'
      uncomment 'non_smtpd_milters = inet:127.0.0.1:8891'
    else
      comment 'smtpd_milters = inet:127.0.0.1:8891'
      comment 'non_smtpd_milters = inet:127.0.0.1:8891'
    end
  end
  a.edit :file => "/etc/default/opendkim", :backup => false do
    if run
      uncomment 'SOCKET="inet:8891@localhost"'
    else
      comment 'SOCKET="inet:8891@localhost"'
    end
  end
end

.dspam_power(a, run) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/property/postfix.rb', line 26

def self.dspam_power(a, run)
  a.edit :file => "#{etc_postfix}/master.cf", :backup => false do
    if run
      uncomment 'filter=lmtp:unix:/var/run/dspam'
      uncomment 'localhost:7711 inet'
    else
      comment 'filter=lmtp:unix:/var/run/dspam'
      comment 'localhost:7711 inet'
    end
  end
end

.main_value_template(a, locals) ⇒ Object



7
8
9
10
11
12
13
# File 'app/models/property/postfix.rb', line 7

def self.main_value_template(a, locals)
  a.edit :file => "#{etc_postfix}/main.cf", :backup => false do
    locals.each do |key, value|
      replace /^#{key}\s*=\s*.*$/, "#{key}=#{value}"
    end
  end
end

.rbl_client_template(a, values) ⇒ Object

reject_rbl_client bl.spamcop.net reject_rbl_client zen.spamhaus.org … values = => true, ‘zen.spamhaus.org’ => false



18
19
20
21
22
23
24
# File 'app/models/property/postfix.rb', line 18

def self.rbl_client_template(a, values)
  a.edit :file => "#{etc_postfix}/main.cf", :backup => false do
    values.each do |key, value|
      value ? uncomment(key) : comment(key)
    end
  end
end

.serviceObject



3
# File 'app/models/property/postfix.rb', line 3

def self.service; POSTFIX ;end