smailr 0.5.5 → 0.6.1
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 +4 -4
- data/README.md +2 -4
- data/bin/commander +16 -0
- data/bin/sequel +16 -0
- data/bin/smailr +19 -4
- data/contrib/dovecot-sql.conf +1 -1
- data/contrib/dovecot.conf +1 -1
- data/contrib/exim4.conf +12 -15
- data/lib/smailr/alias.rb +4 -0
- data/lib/smailr/mailbox.rb +4 -0
- data/lib/smailr/model.rb +1 -0
- data/lib/smailr.rb +1 -1
- data/migrations/005_mailboxes_add_digest_identifier_to_passwords.rb +27 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a210f85857566e3db628005398f0de0f9f0a512b
|
4
|
+
data.tar.gz: 86751942bbe91990eeb678238d64d581ae75bf53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533d32daf44f0561363885a384ca062f78d93925bb3d687b04e9c9250f927d4fe6d80bc91b15c0a68e2decdeb1b6e459216824e61be94d931a264c2c75d5df3b
|
7
|
+
data.tar.gz: 84210fefd6cea9d4b30e34af42204fd2b77207ed5329e008594c6d1152274bffe1e231fb011afab0449b58de16e81ec9bbb52ef2664c88d6b001fc2305473ee0
|
data/README.md
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
# Smailr - A Virtual Mail Hosting Management CLI
|
1
|
+
# Smailr - A Virtual Mail Hosting Management CLI
|
2
2
|
|
3
3
|
Smailr is a small CLI application, which lets you manage the database for a
|
4
|
-
typical Exim/Dovecot
|
4
|
+
typical mailserver (examples provided for Exim/Dovecot).
|
5
5
|
|
6
6
|
Configuration files are provided within the contrib directory, so you should be
|
7
7
|
able to get everything up and running within a couple of minutes.
|
8
8
|
|
9
|
-
Please note, Smailr is still in development!
|
10
|
-
|
11
9
|
## Installation
|
12
10
|
|
13
11
|
Install Packages
|
data/bin/commander
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'commander' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('commander', 'commander')
|
data/bin/sequel
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'sequel' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('sequel', 'sequel')
|
data/bin/smailr
CHANGED
@@ -56,7 +56,7 @@ command :add do |c|
|
|
56
56
|
if options.dkim
|
57
57
|
selector = options.dkim
|
58
58
|
key = Smailr::Dkim.add(address, selector)
|
59
|
-
|
59
|
+
|
60
60
|
puts "public-key " + key.to_a[1..-2].join.gsub(/\n/, '')
|
61
61
|
else
|
62
62
|
Smailr::Domain.add(address)
|
@@ -172,17 +172,32 @@ end
|
|
172
172
|
|
173
173
|
|
174
174
|
command :mutt do |c|
|
175
|
+
base = Smailr.config["mail_spool_path"]
|
176
|
+
|
175
177
|
c.syntax = "smailr mutt address"
|
176
178
|
c.summary = "View the mailbox of the specified address in mutt."
|
177
179
|
c.description = "Open the mailbox of the specified address in mutt.\n\n " +
|
178
|
-
"Requires that mutt is installed and
|
179
|
-
"storage directory structure: /srv/mail/users/<fqdn>/<localpart>"
|
180
|
+
"Requires that mutt is installed and tries to find a suitable maildir in: " + base
|
180
181
|
c.example 'Open test@example.com', 'smailr mutt test@example.com'
|
181
182
|
c.action do |args,options|
|
182
183
|
localpart, fqdn = args[0].split('@')
|
184
|
+
|
183
185
|
mutt = `command -v mutt || { echo "Please install mutt first. Aborting." >&2; exit 1; }`
|
184
186
|
if $?
|
185
|
-
|
187
|
+
|
188
|
+
possibilities = [
|
189
|
+
"#{base}/#{fqdn}/#{localpart}/Maildir",
|
190
|
+
"#{base}/users/#{fqdn}/#{localpart}/Maildir",
|
191
|
+
"#{base}/users/#{fqdn}/#{localpart}/.maildir",
|
192
|
+
"#{base}/users/#{fqdn}/#{localpart}"
|
193
|
+
]
|
194
|
+
|
195
|
+
possibilities.each do |path|
|
196
|
+
if File.readable?(path)
|
197
|
+
puts "Opening maildir #{path} with mutt."
|
198
|
+
exec "MAIL=#{path} MAILDIR=#{path} #{mutt} -mMaildir"
|
199
|
+
end
|
200
|
+
end
|
186
201
|
end
|
187
202
|
end
|
188
203
|
end
|
data/contrib/dovecot-sql.conf
CHANGED
@@ -126,7 +126,7 @@ default_pass_scheme = MD5
|
|
126
126
|
# string. For example:
|
127
127
|
|
128
128
|
password_query = \
|
129
|
-
SELECT
|
129
|
+
SELECT mailboxes.password_scheme || mailboxes.password AS password, \
|
130
130
|
mailboxes.localpart AS username, \
|
131
131
|
domains.fqdn AS domain \
|
132
132
|
FROM mailboxes, domains \
|
data/contrib/dovecot.conf
CHANGED
@@ -890,7 +890,7 @@ auth default {
|
|
890
890
|
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
|
891
891
|
# gss-spnego
|
892
892
|
# NOTE: See also disable_plaintext_auth setting.
|
893
|
-
mechanisms = plain
|
893
|
+
mechanisms = plain login
|
894
894
|
|
895
895
|
#
|
896
896
|
# Password database is used to verify user's password (and nothing more).
|
data/contrib/exim4.conf
CHANGED
@@ -325,21 +325,18 @@ begin retry
|
|
325
325
|
|
326
326
|
begin authenticators
|
327
327
|
|
328
|
+
login:
|
329
|
+
driver = dovecot
|
330
|
+
public_name = LOGIN
|
331
|
+
server_socket = /var/run/dovecot/auth-client
|
332
|
+
# setting server_set_id might break several headers in
|
333
|
+
# mails sent by authenticated smtp. So be careful.
|
334
|
+
server_set_id = $auth1
|
335
|
+
client_condition = ${if !eq{$tls_cipher}{}}
|
336
|
+
|
328
337
|
plain:
|
329
|
-
driver =
|
338
|
+
driver = dovecot
|
330
339
|
public_name = PLAIN
|
331
|
-
|
332
|
-
|
333
|
-
server_prompts = :
|
334
|
-
server_condition = \
|
335
|
-
"${if and { \
|
336
|
-
{!eq{$2}{}} \
|
337
|
-
{!eq{$3}{}} \
|
338
|
-
{crypteq{$3}{\\{sha1\\}${lookup sqlite{SQLITE_DATABASE_FILE \
|
339
|
-
SELECT mailboxes.password \
|
340
|
-
FROM mailboxes, domains \
|
341
|
-
WHERE mailboxes.localpart = '${quote_sqlite:${local_part:$auth2}}' \
|
342
|
-
AND domains.fqdn = '${quote_sqlite:${domain:$auth2}}' \
|
343
|
-
AND domains.id = mailboxes.domain_id} \
|
344
|
-
{$value}fail}} }} {yes}{no}}"
|
340
|
+
server_socket = /var/run/dovecot/auth-client
|
341
|
+
server_set_id = $auth1
|
345
342
|
client_condition = ${if !eq{$tls_cipher}{}}
|
data/lib/smailr/alias.rb
CHANGED
@@ -13,6 +13,8 @@ module Smailr
|
|
13
13
|
destinations.each do |dst|
|
14
14
|
dstlocalpart, dstdomain = dst.split('@')
|
15
15
|
|
16
|
+
puts "Adding alias: #{source} -> #{dst}"
|
17
|
+
|
16
18
|
Model::Alias.find_or_create(:domain => Model::Domain[:fqdn => srcdomain],
|
17
19
|
:localpart => srclocalpart,
|
18
20
|
:dstdomain => dstdomain,
|
@@ -24,6 +26,8 @@ module Smailr
|
|
24
26
|
srclocalpart, srcdomain = source.split('@')
|
25
27
|
|
26
28
|
destinations.each do |dst|
|
29
|
+
puts "Removing alias: #{source} -> #{dst}"
|
30
|
+
|
27
31
|
dstlocalpart, dstdomain = dst.split('@')
|
28
32
|
|
29
33
|
Model::Alias.filter(:domain => Model::Domain[:fqdn => srcdomain],
|
data/lib/smailr/mailbox.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Smailr
|
2
2
|
module Mailbox
|
3
3
|
def self.add(address, password)
|
4
|
+
puts "Adding mailbox: #{address}"
|
5
|
+
|
4
6
|
fqdn = address.split('@')[1]
|
5
7
|
|
6
8
|
if not Model::Domain[:fqdn => fqdn]
|
@@ -20,6 +22,8 @@ module Smailr
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def self.rm(address, options)
|
25
|
+
puts "Removing mailbox (from database): #{address}"
|
26
|
+
|
23
27
|
mbox = Model::Mailbox.for_address(address)
|
24
28
|
mbox.rm_related
|
25
29
|
mbox.destroy
|
data/lib/smailr/model.rb
CHANGED
data/lib/smailr.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
puts <<-MESSAGE
|
4
|
+
|
5
|
+
WARNING ---------------------------------------------------------------------------------
|
6
|
+
|
7
|
+
You need to adapt your mailserver configuration with this version of smailr, as
|
8
|
+
passwords are now stored including the hash scheme.
|
9
|
+
|
10
|
+
Select the hash from `mailboxes.password` and the scheme from `mailboxes.password_scheme`
|
11
|
+
|
12
|
+
--------------------------------------------------------------------------------- WARNING
|
13
|
+
|
14
|
+
MESSAGE
|
15
|
+
|
16
|
+
add_column :mailboxes, :password_scheme, String
|
17
|
+
|
18
|
+
from(:mailboxes).update(password_scheme: "{SHA}")
|
19
|
+
|
20
|
+
alter_table(:mailboxes) do
|
21
|
+
set_column_not_null(:password_scheme)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Downgrade is not supported, as we would drop necessary information do do effective hashing
|
26
|
+
# in case this feature was already used to add various hashes to the database
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smailr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -39,8 +39,8 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: |-
|
42
|
-
Smailr is a CLI tool which lets you manage your
|
43
|
-
from the shell. It currently uses SQLite as a backend.
|
42
|
+
Smailr is a CLI tool which lets you manage your virtual mailhosting setup
|
43
|
+
from the shell. It currently uses SQLite as a backend, samples for Dovecot/Exim provided.
|
44
44
|
email: sts@ono.at
|
45
45
|
executables:
|
46
46
|
- smailr
|
@@ -48,6 +48,8 @@ extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
50
|
- README.md
|
51
|
+
- bin/commander
|
52
|
+
- bin/sequel
|
51
53
|
- bin/smailr
|
52
54
|
- contrib/dovecot-sql.conf
|
53
55
|
- contrib/dovecot.conf
|
@@ -63,6 +65,7 @@ files:
|
|
63
65
|
- migrations/002_mailboxes.rb
|
64
66
|
- migrations/003_aliases.rb
|
65
67
|
- migrations/004_dkims.rb
|
68
|
+
- migrations/005_mailboxes_add_digest_identifier_to_passwords.rb
|
66
69
|
- smailr.yml
|
67
70
|
homepage: http://github.com/sts/smailr
|
68
71
|
licenses: []
|
@@ -106,7 +109,7 @@ requirements:
|
|
106
109
|
- Dovecot
|
107
110
|
- Debian
|
108
111
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.4.
|
112
|
+
rubygems_version: 2.4.6
|
110
113
|
signing_key:
|
111
114
|
specification_version: 4
|
112
115
|
summary: Simple MAIL manageR - Virtual mail hosting management from the CLI
|