schleuder 2.2.4 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +138 -0
  3. data/Rakefile +136 -0
  4. data/bin/pinentry-clearpassphrase +72 -0
  5. data/bin/schleuder +9 -89
  6. data/bin/schleuder-api-daemon +4 -0
  7. data/db/migrate/20140501103532_create_lists.rb +39 -0
  8. data/db/migrate/20140501112859_create_subscriptions.rb +21 -0
  9. data/db/migrate/201508092100_add_language_to_lists.rb +11 -0
  10. data/db/migrate/20150812165700_change_keywords_admin_only_defaults.rb +8 -0
  11. data/db/migrate/20150813235800_add_forward_all_incoming_to_admins.rb +11 -0
  12. data/db/migrate/201508141727_change_send_encrypted_only_default.rb +8 -0
  13. data/db/migrate/201508222143_add_logfiles_to_keep_to_lists.rb +11 -0
  14. data/db/migrate/201508261723_rename_delivery_disabled_to_delivery_enabled_and_change_default.rb +14 -0
  15. data/db/migrate/201508261815_strip_gpg_passphrase.rb +11 -0
  16. data/db/migrate/201508261827_remove_default_mime.rb +9 -0
  17. data/db/migrate/20160501172700_fix_headers_to_meta_defaults.rb +8 -0
  18. data/db/migrate/20170713215059_add_internal_footer_to_list.rb +11 -0
  19. data/db/schema.rb +62 -0
  20. data/etc/init.d/schleuder-api-daemon +87 -0
  21. data/etc/list-defaults.yml +123 -0
  22. data/etc/postfix/schleuder_sqlite.cf +28 -0
  23. data/etc/schleuder-api-daemon.service +10 -0
  24. data/etc/schleuder.cron.weekly +6 -0
  25. data/etc/schleuder.yml +61 -0
  26. data/lib/schleuder-api-daemon.rb +420 -0
  27. data/lib/schleuder.rb +81 -47
  28. data/lib/schleuder/cli.rb +334 -0
  29. data/lib/schleuder/cli/cert.rb +24 -0
  30. data/lib/schleuder/cli/schleuder_cert_manager.rb +84 -0
  31. data/lib/schleuder/cli/subcommand_fix.rb +11 -0
  32. data/lib/schleuder/conf.rb +131 -0
  33. data/lib/schleuder/errors/active_model_error.rb +15 -0
  34. data/lib/schleuder/errors/base.rb +17 -0
  35. data/lib/schleuder/errors/decryption_failed.rb +16 -0
  36. data/lib/schleuder/errors/fatal_error.rb +13 -0
  37. data/lib/schleuder/errors/file_not_found.rb +14 -0
  38. data/lib/schleuder/errors/invalid_listname.rb +13 -0
  39. data/lib/schleuder/errors/key_adduid_failed.rb +13 -0
  40. data/lib/schleuder/errors/key_generation_failed.rb +16 -0
  41. data/lib/schleuder/errors/keyword_admin_only.rb +13 -0
  42. data/lib/schleuder/errors/list_exists.rb +13 -0
  43. data/lib/schleuder/errors/list_not_found.rb +14 -0
  44. data/lib/schleuder/errors/list_property_missing.rb +14 -0
  45. data/lib/schleuder/errors/listdir_problem.rb +16 -0
  46. data/lib/schleuder/errors/loading_list_settings_failed.rb +14 -0
  47. data/lib/schleuder/errors/message_empty.rb +14 -0
  48. data/lib/schleuder/errors/message_not_from_admin.rb +13 -0
  49. data/lib/schleuder/errors/message_sender_not_subscribed.rb +13 -0
  50. data/lib/schleuder/errors/message_too_big.rb +14 -0
  51. data/lib/schleuder/errors/message_unauthenticated.rb +13 -0
  52. data/lib/schleuder/errors/message_unencrypted.rb +13 -0
  53. data/lib/schleuder/errors/message_unsigned.rb +13 -0
  54. data/lib/schleuder/errors/standard_error.rb +5 -0
  55. data/lib/schleuder/errors/too_many_keys.rb +17 -0
  56. data/lib/schleuder/errors/unknown_list_option.rb +14 -0
  57. data/lib/schleuder/filters/auth_filter.rb +39 -0
  58. data/lib/schleuder/filters/bounces_filter.rb +12 -0
  59. data/lib/schleuder/filters/forward_filter.rb +17 -0
  60. data/lib/schleuder/filters/forward_incoming.rb +13 -0
  61. data/lib/schleuder/filters/hotmail_message_filter.rb +25 -0
  62. data/lib/schleuder/filters/max_message_size.rb +14 -0
  63. data/lib/schleuder/filters/request_filter.rb +26 -0
  64. data/lib/schleuder/filters/send_key_filter.rb +20 -0
  65. data/lib/schleuder/filters/strip_alternative_filter.rb +21 -0
  66. data/lib/schleuder/filters_runner.rb +83 -0
  67. data/lib/schleuder/gpgme/ctx.rb +274 -0
  68. data/lib/schleuder/gpgme/import_status.rb +27 -0
  69. data/lib/schleuder/gpgme/key.rb +212 -0
  70. data/lib/schleuder/gpgme/sub_key.rb +13 -0
  71. data/lib/schleuder/gpgme/user_id.rb +22 -0
  72. data/lib/schleuder/list.rb +318 -127
  73. data/lib/schleuder/list_builder.rb +139 -0
  74. data/lib/schleuder/listlogger.rb +31 -0
  75. data/lib/schleuder/logger.rb +23 -0
  76. data/lib/schleuder/logger_notifications.rb +69 -0
  77. data/lib/schleuder/mail/message.rb +482 -0
  78. data/lib/schleuder/mail/parts_list.rb +9 -0
  79. data/lib/schleuder/plugin_runners/base.rb +91 -0
  80. data/lib/schleuder/plugin_runners/list_plugins_runner.rb +24 -0
  81. data/lib/schleuder/plugin_runners/request_plugins_runner.rb +27 -0
  82. data/lib/schleuder/plugins/attach_listkey.rb +17 -0
  83. data/lib/schleuder/plugins/get_version.rb +7 -0
  84. data/lib/schleuder/plugins/key_management.rb +113 -0
  85. data/lib/schleuder/plugins/list_management.rb +15 -0
  86. data/lib/schleuder/plugins/resend.rb +196 -0
  87. data/lib/schleuder/plugins/sign_this.rb +46 -0
  88. data/lib/schleuder/plugins/subscription_management.rb +140 -0
  89. data/lib/schleuder/runner.rb +130 -0
  90. data/lib/schleuder/subscription.rb +98 -0
  91. data/lib/schleuder/validators/boolean_validator.rb +7 -0
  92. data/lib/schleuder/validators/email_validator.rb +7 -0
  93. data/lib/schleuder/validators/fingerprint_validator.rb +7 -0
  94. data/lib/schleuder/validators/greater_than_zero_validator.rb +7 -0
  95. data/lib/schleuder/validators/no_line_breaks_validator.rb +7 -0
  96. data/lib/schleuder/version.rb +1 -1
  97. data/locales/de.yml +179 -0
  98. data/locales/en.yml +179 -0
  99. metadata +305 -108
  100. checksums.yaml.gz.sig +0 -3
  101. data.tar.gz.sig +0 -2
  102. data/LICENSE +0 -339
  103. data/README +0 -32
  104. data/bin/schleuder-fix-gem-dependencies +0 -37
  105. data/bin/schleuder-init-setup +0 -37
  106. data/bin/schleuder-migrate-v2.1-to-v2.2 +0 -225
  107. data/bin/schleuder-newlist +0 -413
  108. data/contrib/check-expired-keys.rb +0 -60
  109. data/contrib/mutt-schleuder-colors.rc +0 -10
  110. data/contrib/mutt-schleuder-resend.vim +0 -24
  111. data/contrib/smtpserver.rb +0 -76
  112. data/ext/default-list.conf +0 -149
  113. data/ext/default-members.conf +0 -7
  114. data/ext/list.conf.example +0 -14
  115. data/ext/schleuder.conf +0 -64
  116. data/lib/schleuder/archiver.rb +0 -46
  117. data/lib/schleuder/crypt.rb +0 -210
  118. data/lib/schleuder/errors.rb +0 -5
  119. data/lib/schleuder/list_config.rb +0 -146
  120. data/lib/schleuder/log/listlogger.rb +0 -57
  121. data/lib/schleuder/log/outputter/emailoutputter.rb +0 -120
  122. data/lib/schleuder/log/outputter/metaemailoutputter.rb +0 -50
  123. data/lib/schleuder/log/schleuderlogger.rb +0 -34
  124. data/lib/schleuder/mail.rb +0 -873
  125. data/lib/schleuder/mailer.rb +0 -26
  126. data/lib/schleuder/member.rb +0 -69
  127. data/lib/schleuder/plugin.rb +0 -54
  128. data/lib/schleuder/processor.rb +0 -363
  129. data/lib/schleuder/schleuder_config.rb +0 -75
  130. data/lib/schleuder/storage.rb +0 -84
  131. data/lib/schleuder/utils.rb +0 -80
  132. data/man/schleuder-newlist.8 +0 -174
  133. data/man/schleuder.8 +0 -416
  134. data/plugins/README +0 -20
  135. data/plugins/manage_keys_plugin.rb +0 -113
  136. data/plugins/manage_members_plugin.rb +0 -156
  137. data/plugins/manage_self_plugin.rb +0 -26
  138. data/plugins/resend_plugin.rb +0 -35
  139. data/plugins/sign_this_plugin.rb +0 -14
  140. data/plugins/version_plugin.rb +0 -12
  141. metadata.gz.sig +0 -0
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This script checks all public keys in the keyring of the given schleuder-list
4
- # for being expired (or otherwise unusable) and reports the output (if there
5
- # was something found) to the list-admins.
6
- # Key are being reported if they expire within the next 14 days.
7
- # We suggest to run this script from cron once a week.
8
-
9
- $VERBOSE = nil
10
-
11
- $:.unshift File.dirname(__FILE__) + '/../lib'
12
- require 'schleuder'
13
- include Schleuder
14
-
15
- if ARGV.size != 1
16
- puts "Usage: #{File.basename(__FILE__)} listname"
17
- exit 1
18
- elsif ! File.directory?(List.listdir(ARGV.first))
19
- puts "No such list: '#{ARGV.first}'."
20
- exit 1
21
- end
22
-
23
- listname = ARGV.first
24
- Schleuder.list = List.new(listname)
25
-
26
- now = Time.now
27
- checkdate = now + (60 * 60 * 24 * 14) # two weeks
28
- crypt = Crypt.new('')
29
- msg = ''
30
- unusable = []
31
- expiring = []
32
-
33
- crypt.list_keys.each do |key|
34
- if (exp = key.subkeys.first.expires) > Time.utc(1971, 1, 1, 1)
35
- # key has expiry date
36
- if now < exp && exp < checkdate
37
- # key expires in the near future
38
- expdays = ((exp - now)/86400).to_i
39
- expiring << [key, expdays]
40
- end
41
- end
42
-
43
- if not (trust = [:revoked, :expired, :disabled, :invalid].grep(key.trust)).empty?
44
- unusable << [key, trust]
45
- end
46
- end
47
-
48
- expiring.each do |key,days|
49
- msg << "-> Key expires in #{days} days:\n#{key.to_s}\n\n"
50
- end
51
-
52
- unusable.each do |key,trust|
53
- msg << "-> Key is #{trust.join(' and ')}:\n#{key.to_s}\n"
54
- end
55
-
56
- unless msg.empty?
57
- prefix = "Checking the public keys present in the keyring of list #{listname} for usability gave the following result:".fmt(72)
58
- Schleuder.log.notify_admin('keys', prefix + "\n\n" + msg)
59
- end
60
-
@@ -1,10 +0,0 @@
1
- # insert "source /path/to/mutt-schleuder-colors.rc" into your muttrc
2
- # metadata schleuder v2
3
- color body red default "^From: .*"
4
- color body red default "^To: .*"
5
- color body red default "^Cc: .*"
6
- color body red default "^Date: .*"
7
- color body brightred default "^Enc: unenc.*"
8
- color body red default "^Enc: enc.*"
9
- color body brightred default "^Sig: [^G]?.*"
10
- color body red default "^Sig: Good signature.*"
@@ -1,24 +0,0 @@
1
- " Reply-helper for mutt with schleuder (>= v2.0.0).
2
- " Will insert a resend-line filled with the address from the quoted Text
3
- " you're replying to.
4
- function! SchleuderInsert(string)
5
- let fromline = search('> From:', 'n')
6
- let addr = matchstr(getline(fromline), '[^ <]*@[^ >]*')
7
- let insline = search('^$', 'n')
8
- " append after the first blank line
9
- let foo = append(insline, a:string . addr)
10
- " can't figure out how to append() a newline, so we simply add another
11
- " empty line
12
- return append(insline+1, '')
13
- endfunction
14
-
15
- function! SchleuderInsertResendEncrypted()
16
- return SchleuderInsert('X-RESEND-ENCRYPTED-ONLY: ')
17
- endfunction
18
-
19
- function! SchleuderInsertResend()
20
- return SchleuderInsert('X-RESEND: ')
21
- endfunction
22
-
23
- nmap ;sr :call SchleuderInsertResend()<CR>
24
- nmap ;sc :call SchleuderInsertResendEncrypted()<CR>
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # defaults
4
- port = 25
5
- output = "/tmp"
6
-
7
- def usage
8
- file = File.basename(__FILE__)
9
- puts "Usage: #{file} [-p portnum] { .../output_base_dir/ | .../bin/schleuder listname }"
10
- exit 1
11
- end
12
-
13
- # get args
14
- if (not ARGV.empty?) and (ARGV.first[0..0] == '-')
15
- arg = ARGV.shift
16
- if arg == '-p'
17
- port = ARGV.shift.to_i
18
- usage if port == 0 # nil or not convertable strings convert to 0
19
- else
20
- usage
21
- end
22
- end
23
-
24
- output = ARGV.join(" ") || output
25
-
26
-
27
- # run the server
28
- require 'socket'
29
- server = TCPServer.new("localhost", port)
30
-
31
- def p(msg)
32
- #puts "o:" + msg
33
- @s.print msg + "\r\n"
34
- end
35
-
36
- # receive input
37
- while (@s = server.accept)
38
- input = ''
39
- #p "200 OK"
40
- p "220 localhost SMTP"
41
- #p "Wazzup?"
42
- begin
43
- while i = @s.gets.chomp
44
- #puts "i:" + i
45
- case i[0..3].downcase
46
- when 'ehlo', 'helo'
47
- p "250 localhost"
48
- when 'mail', 'rcpt', 'rset', '.'
49
- p "250 ok"
50
- when 'data'
51
- p "354 go ahead"
52
- when 'quit'
53
- p "221 localhost"
54
- @s.close
55
- else
56
- input << i + "\n"
57
- end
58
- end
59
- rescue IOError
60
- end
61
- # write input to #{output}
62
- if File.directory? output
63
- file = output + "/schleuder-#{$$}-#{Time.now.to_f}"
64
- File.open(file, 'w') do |f|
65
- f.puts input
66
- end
67
- File.chown 1000, 10, file
68
- puts file
69
- else
70
- IO.popen(output, 'w') do |p|
71
- p.puts input
72
- end
73
- end
74
- end
75
-
76
-
@@ -1,149 +0,0 @@
1
- # Setting default values for lists. Each setting can be overridden by the
2
- # list-specific config-file.
3
- # Options are listed alphabetically and provided with the default behaviour.
4
- # Some options that need to be set for each list individually are listed in
5
- # list.conf.example.
6
- #
7
- # The configuration format is yaml (http://www.yaml.org).
8
- #
9
- # Be careful with changes here once lists are running! You might change
10
- # their behaviour!
11
- ---
12
- # Emailaddresses and key_fingerprints of the admin(s) (aka maintainer) of the
13
- # list, which will receive errormsgs etc. Must be a non-empty array of hashes
14
- # (:email, :key_fingerprint).
15
- #admins:
16
- #- email: anna@example.org
17
- # key_fingerprint: 01234567DEADBEE01234567DEADBEEF
18
- #- email: arthur@example.org
19
- # key_fingerprint: DEADBEE01234567DEADBEEF01234567
20
- #
21
- # Only send out enrypted emails?
22
- #send_encrypted_only: false
23
- #
24
- # Allow receiving unenrypted mails? If false, any other email will be bounced.
25
- #receive_encrypted_only: false
26
- #
27
- # Allow receiving mails not validly signed? If false, any other email will be
28
- # bounced.
29
- #receive_signed_only: false
30
- #
31
- # Allow receiving mails that are not validly signed by a list members key? If
32
- # true, any other email will be bounced.
33
- #receive_authenticated_only: false
34
- #
35
- # Only allow mails being sent from a members address? If true, any other sending
36
- # address will be dropped.
37
- # NOTE: This is a very weak restriction mechanism on which you should not rely,
38
- # as sending addresses can easily be faked! We recommend you to rather
39
- # rely on the `receive_authenticated_only` option. Setting the
40
- # `receive_authenticated_only` option to true, will authenticated senders
41
- # based on the signature on the mail, which is the strongest
42
- # authentication mechanism you can get.
43
- # This option could be useful, if you would like to have a closed
44
- # mailinglist, but could not yet get all members to properly use GPG.
45
- #receive_from_member_emailaddresses_only: false
46
- #
47
- # Whether to accept only emails that are validly signed by a list-admin's key
48
- # This is useful for newsletters, announce or notification lists
49
- #receive_admin_only: false
50
- #
51
- # Which pgp encoding? Chose out of PLAIN (text/plain), APPL (application/pgp)
52
- # and MIME (pgp/mime)
53
- #default_mime: MIME
54
- #
55
- # Schleuder can include various metadata from the original mail. You can tweak
56
- # Schleuder which header fields should be included.
57
- #headers_to_meta:
58
- #- :from
59
- #- :to
60
- #- :cc
61
- #- :date
62
- #
63
- # Whether to keep the msgids (In-Reply-To:, References:) or not
64
- # Schleuder will only pass valid schleuder Message-Ids, all the others
65
- # are filtered out.
66
- # This setting can lead to information leakage, as replies are connectable
67
- # and a thread of (encrypted) messages can be built by an eavesdropper.
68
- #keep_msgid: true
69
- #
70
- # Schleuder can be commanded to process various plugins via keywords in signed
71
- # emails. To restrict the usage of specific keywords to the admin (some can
72
- # cause fatal damage) list them here.
73
- #keywords_admin_only: ['ADD-MEMBER', 'DELETE-MEMBER', 'DELETE-KEY', 'SAVE-MEMBERS', 'DEL-KEY']
74
- #
75
- # For keywords listed here the list-admin(s) will receive a notice whenever a
76
- # member triggers a command with it.
77
- #keywords_admin_notify: ['ADD-KEY']
78
- #
79
- # list-specific log-level: ERROR || WARN || INFO || DEBUG
80
- #log_level: ERROR
81
- #
82
- # Log to SYSLOG? To enable set to true.
83
- #log_syslog: false
84
- #
85
- # Log to IO (write into STDIN of another process/executable)? To enable specify
86
- # executable with full path and optional arguments here.
87
- # Example: /path/to/multilog tt /var/schleuderlists/listname/log/
88
- #log_io: false
89
- #
90
- # Log to a file? To enable specify a filename, optionally with full path.
91
- # If you specify a directory (ending with '/'), the file will be named
92
- # "$LISTNAME.log" in that directory.
93
- # To disable logging to a file set to false.
94
- #log_file: 'list.log'
95
- #
96
- # speaks for itself, no?
97
- #public_footer:
98
- #
99
- # A string that the subject of every email that *is* validly signed by a
100
- # list-member will be prefixed with (unless the string is already present in
101
- # the subject)
102
- #prefix: ''
103
- #
104
- # A string that the subject of every email that is *not* validly signed by a
105
- # list-member will be prefixed with.
106
- #prefix_in: ''
107
- #
108
- # A string that the subject of every internal email, that has been resent to
109
- # the outside, will be prefixed with.
110
- #prefix_out: ''
111
- #
112
- # Drop any bounces (incoming email not passing the receive_*_only-rules)
113
- #bounces_drop_all: false
114
- #
115
- # Drop bounces if they match one of these headers. Must be a hash, keys and
116
- # values are case insensitive.
117
- #bounces_drop_on_headers: {'x-spam-flag' => 'yes'}
118
- #
119
- # Send a notice to admin(s) on bouncing or dropping
120
- #bounces_notify_admins: true
121
- #
122
- # Include RFC-compliant List-* Headers into member mails
123
- #include_list_headers: true
124
- #
125
- # Include OpenPGP-Header
126
- #include_openpgp_header: true
127
- #
128
- # Prefered way to receive emails to note in OpenPGP-Header ('sign'|'encrypt'|'signencrypt'|'unprotected'|'none')
129
- # 'none' to not include a preference
130
- # default: 'signencrypt'
131
- #openpgp_header_preference: 'signencrypt'
132
- #
133
- # If we want to dump the original incoming mail.
134
- # ATTENTION: this stores the incoming e-mail on disk!
135
- #dump_incoming_mail: false
136
- #
137
- # Maximum size of message allowed on the list in kilobyte. All others will be bounced.
138
- # Default is 10MB
139
- #max_message_size: 10240
140
- #
141
- # Whether to archive messages sent to list members or not.
142
- # Setting this option to true will archive every message sent to list members
143
- # into <listdir>/archive/$YEAR/$MONTH/$DAY/$MESSAGEID.msg
144
- # The messages are encrypted with the lists' public key and dumped as it would
145
- # have been handed over to the MTA.
146
- # Beware that this will archive every communication over that list on a remote
147
- # box amongst the matching private key and its password!
148
- # Default: false
149
- #archive: false
@@ -1,7 +0,0 @@
1
- # Example members-file to give an idea of the syntax.
2
- ---
3
- - email: root@localhost
4
- key_fingerprint: DEADBEEFDEADBEEFDEADBEEFDEADBEEF
5
- - email: postmaster@localhost
6
- key_fingerprint: BEEFDEADBEEFDEADBEEFDEADBEEFDEAD
7
- mime: plain
@@ -1,14 +0,0 @@
1
- # Configuration options for individal lists.
2
- # Options are listed alphabetically and provided with the default behaviour.
3
- # Beyond those options listed here all options listed in default-list.conf can be specified.
4
- #
5
- # The configuration format is yaml (http://www.yaml.org).
6
- ---
7
- # The emailaddress of the list. Needed to identify headers, loops and also the GnuPG key.
8
- # Must be a valid email address.
9
- #myaddr: list@example.org
10
- # Realname of this list address (mainly used for GnuPG key)
11
- #myname: The Listname
12
- # Password for the GnuPG private key. (You're working on an encrypted filesystem, aren't you?)
13
- # Make it long and complicated, you won't ever need to type it.
14
- #gpg_password: "iuttIs6flewd)#misIg5drash/#tesJor:5Quej"
@@ -1,64 +0,0 @@
1
- # Configuration options for schleuder.
2
- # The options are sorted alphabetically and the defaults
3
- # are provided as commented option.
4
- # The configuration format is yaml.
5
- ---
6
- # Outgoing SMTP host
7
- #smtp_host: localhost
8
- #
9
- # Outgoing SMTP port
10
- #smtp_port: 25
11
- #
12
- # Set the type of a key we might create for new lists.
13
- #gpg_key_type: RSA
14
- #
15
- # Set the length of a key we might create for new lists.
16
- #gpg_key_length: 4096
17
- #
18
- # Set the type of the subkey of a key we might create
19
- # for new lists.
20
- #gpg_subkey_type: RSA
21
- #
22
- # Set the length of the subkey of a key we might create
23
- # for new lists.
24
- #gpg_subkey_length: 4096
25
- #
26
- # Name of the per list config file. Either:
27
- # - a file name that resides in the list data directory,
28
- # - a directory, ending with '/' holding list configs as
29
- # "$DOMAIN/$LISTNAME.conf".
30
- #lists_configfile: list.conf
31
- #
32
- # Name of the per list file containing all members and their
33
- # options.
34
- #lists_memberfile: members.conf
35
- #
36
- # Where we find the global options for all lists.
37
- # Note: the following notion isn't valid. You have
38
- # to provide a fully qualified path.
39
- #lists_default_conf: conf_dir + '/default-list.conf'
40
- #
41
- # Location of the various schleuderlists' directory.
42
- #lists_dir: /var/schleuderlists
43
- #
44
- # Location of the global logfile. Specify "syslog" to log through
45
- # the syslog(3) facility.
46
- #log_file: /var/log/schleuder/schleuder.log
47
- #
48
- # Global schleuder log level, might change after the list config
49
- # have been read.
50
- # Possible values: ERROR || WARN || INFO || DEBUG
51
- #log_level: ERROR
52
- #
53
- # Location of schleuder plugins. Note: the following notion
54
- # isn't valid. You have to provide a fully qualified path.
55
- # Multiple plugins directory are supported.
56
- #plugins_dir:
57
- #-schleuder_base + '/plugins'
58
- #
59
- # The super administrator of this schleuder installation. This
60
- # address will receive all notices which can'tbe delivered to a certain list
61
- # admin. It will also be used as sender for emails to list-admins and thus
62
- # receive their bounces and be seen in public.
63
- #superadminaddr: root@localhost
64
-
@@ -1,46 +0,0 @@
1
- module Schleuder
2
- class Archiver
3
- def archive(mail)
4
- Schleuder.log.info "Archiving email"
5
- mail2archive = mail.individualize_member(_receiver)
6
-
7
- # TODO: wrap that duplicated code out into it's dedicated method
8
- begin
9
- encrypted, errmsg = mail2archive.encrypt!(_receiver)
10
- rescue GPGME::Error::UnusablePublicKey => e
11
- # This exception is thrown, if the public key of a certain list
12
- # member is not usable (because it is revoked, expired, disabled or
13
- # invalid).
14
- k = e.keys.first
15
- key = mail2archive.crypt.get_key(k.fpr).first
16
- errmsg = "#{e.message}: (#{k.class})\n#{key.to_s}"
17
- encrypted = false
18
- rescue GPGME::Error::General => e
19
- errmsg = e.message
20
- encrypted = false
21
- end
22
-
23
- if encrypted
24
- _dump(mail2archive)
25
- else
26
- Schleuder.log.error("Could not encrypt message with list's key to archive it. Skipping archiving of message...\n\nError Message: #{errmsg}")
27
- end
28
- end
29
-
30
- private
31
-
32
- def _dump(mail)
33
- now = Time.now
34
- dump_dir = File.join(Schleuder.list.listdir,'archive',[:year,:month,:day].collect{|m| now.send(m).to_s })
35
- require 'fileutils'
36
- FileUtils.mkdir_p dump_dir unless File.directory? dump_dir
37
- msg_file = File.join(dump_dir,"#{Time.now.strftime('%H%M%S')}-#{mail.message_id[1..-2]}")
38
- Schleuder.log.info("Archiving message to #{msg_file}")
39
- File.open(msg_file,"w") { |f| f << mail.to_s }
40
- end
41
-
42
- def _receiver
43
- @receiver ||= Member.new('email' => Schleuder.list.config.myaddr)
44
- end
45
- end
46
- end