Class: PostDB::DKIM
- Inherits:
-
Object
- Object
- PostDB::DKIM
- Defined in:
- lib/postdb/dkim.rb
Class Attribute Summary collapse
-
.key_table_path ⇒ Object
readonly
The path to the key table file.
-
.keys_directory ⇒ Object
readonly
The path to the directory where DKIM keys are stored.
-
.signing_table_path ⇒ Object
readonly
The path to the signing table file.
-
.trusted_hosts_path ⇒ Object
readonly
The path to the trusted hosts file.
Class Method Summary collapse
-
.generate_configuration ⇒ Object
Generate the OpenDKIM configuration files.
-
.setup_with_configuration! ⇒ Object
Setup the DKIM configuration.
Class Attribute Details
.key_table_path ⇒ Object (readonly)
The path to the key table file
14 15 16 |
# File 'lib/postdb/dkim.rb', line 14 def key_table_path @key_table_path end |
.keys_directory ⇒ Object (readonly)
The path to the directory where DKIM keys are stored
6 7 8 |
# File 'lib/postdb/dkim.rb', line 6 def keys_directory @keys_directory end |
.signing_table_path ⇒ Object (readonly)
The path to the signing table file
18 19 20 |
# File 'lib/postdb/dkim.rb', line 18 def signing_table_path @signing_table_path end |
.trusted_hosts_path ⇒ Object (readonly)
The path to the trusted hosts file
10 11 12 |
# File 'lib/postdb/dkim.rb', line 10 def trusted_hosts_path @trusted_hosts_path end |
Class Method Details
.generate_configuration ⇒ Object
Generate the OpenDKIM configuration files
Example:
>> PostDB::DKIM.generate_configuration
=> nil
68 69 70 71 72 73 74 75 76 |
# File 'lib/postdb/dkim.rb', line 68 def generate_configuration dump_private_keys generate_trusted_hosts_configuration generate_key_table_configuration generate_signing_table_configuration restart_opendkim nil end |
.setup_with_configuration! ⇒ Object
Setup the DKIM configuration
Example:
>> PostDB::DKIM.setup_with_configuration!
=> nil
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/postdb/dkim.rb', line 26 def setup_with_configuration! configuration = PostDB::Configuration[:dkim] unless configuration.is_a?(Hash) raise PostDB::SetupError.new(:missing_dkim_args) end unless configuration[:directory] raise PostDB::SetupError.new(:missing_dkim_directory) end unless configuration[:trusted_hosts_path] raise PostDB::SetupError.new(:missing_trusted_hosts_path) end unless configuration[:key_table_path] raise PostDB::SetupError.new(:missing_key_table_path) end unless configuration[:signing_table_path] raise PostDB::SetupError.new(:missing_signing_table_path) end @keys_directory = configuration[:directory] unless File.directory?(@keys_directory) FileUtils.mkdir_p(@keys_directory) end @trusted_hosts_path = configuration[:trusted_hosts_path] @key_table_path = configuration[:key_table_path] @signing_table_path = configuration[:signing_table_path] true end |