smailr 0.8.3 → 0.8.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 +4 -4
- data/README.md +4 -4
- data/lib/smailr/alias.rb +3 -2
- data/lib/smailr/cli.rb +14 -12
- data/lib/smailr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3da734e8d32a11dd96f3c2a3e820aa04cab4841e22bccab9488a4258f782f923
|
|
4
|
+
data.tar.gz: bbcc0c1719497142b3aea0a4ce3c70b257fb7c5787086b3458bb2088edb772af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 072341ff8b4a7ca1691c61686e762d1c1b44e222d239b728fc3189dd5a5325a1714d923ef71e3ab46e08248b0b1b49e9f0615950708c66c8176f07e5e25b68ca
|
|
7
|
+
data.tar.gz: b56b46286fa30700bf5d4e434b7b3bfeca03330dfbef714c61e965a46df4d2d2ae7cec8779b06fd00aea10d592e370c27f43b47e4fe3253c2f07f00a286f600d
|
data/README.md
CHANGED
|
@@ -10,9 +10,10 @@ able to get everything up and running within a couple of minutes.
|
|
|
10
10
|
|
|
11
11
|
Install Packages
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# apt install exim4-daemon-heavy dovecot-imapd dovecot-pop3d
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# apt install ruby-rubygems ruby-bcrypt ruby-sqlite3
|
|
16
|
+
# apt install ruby-rubygems ruby-bcrypt ruby-mysql2
|
|
16
17
|
|
|
17
18
|
Install Smailr Gem package
|
|
18
19
|
|
|
@@ -54,7 +55,7 @@ But you can configure any other database as well. Eg. for MySQL use:
|
|
|
54
55
|
database: smailr
|
|
55
56
|
password: S3cr3t
|
|
56
57
|
|
|
57
|
-
Just make sure the database driver is installed (for MySQL:
|
|
58
|
+
Just make sure the database driver is installed (for MySQL: apt install
|
|
58
59
|
ruby-mysql2). Smailr uses the Sequel ORM, check out the following page for
|
|
59
60
|
connection parameters: [sequel.jeremyevans.net/opening_databases_rdoc](http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html)
|
|
60
61
|
|
|
@@ -186,4 +187,3 @@ https://github.com/sts/smailr/issues
|
|
|
186
187
|
## WHO
|
|
187
188
|
|
|
188
189
|
Stefan Schlesinger / sts@ono.at / @stsonoat / http://sts.ono.at
|
|
189
|
-
|
data/lib/smailr/alias.rb
CHANGED
|
@@ -2,10 +2,11 @@ module Smailr
|
|
|
2
2
|
class Alias
|
|
3
3
|
def self.add(source, destinations)
|
|
4
4
|
srclocalpart, srcdomain = source.split('@')
|
|
5
|
+
domain = Model::Domain[:fqdn => srcdomain]
|
|
5
6
|
|
|
6
7
|
# We don't want aliases for non-local domains, since the
|
|
7
8
|
# exim router won't accept it.
|
|
8
|
-
|
|
9
|
+
unless domain
|
|
9
10
|
raise MissingDomain, "You are trying to add an alias for a non existing domain: #{source}"
|
|
10
11
|
end
|
|
11
12
|
|
|
@@ -14,7 +15,7 @@ module Smailr
|
|
|
14
15
|
|
|
15
16
|
Smailr::logger.warn("Adding alias: #{source} -> #{dst}")
|
|
16
17
|
|
|
17
|
-
Model::Alias.find_or_create(:domain =>
|
|
18
|
+
Model::Alias.find_or_create(:domain => domain,
|
|
18
19
|
:localpart => srclocalpart,
|
|
19
20
|
:dstdomain => dstdomain,
|
|
20
21
|
:dstlocalpart => dstlocalpart)
|
data/lib/smailr/cli.rb
CHANGED
|
@@ -27,22 +27,24 @@ module Smailr
|
|
|
27
27
|
# Returns a string containing the entered password if password and
|
|
28
28
|
# confirmation match.
|
|
29
29
|
def ask_password
|
|
30
|
-
min_password_length = Smailr.config["password_policy"]["length"]
|
|
30
|
+
min_password_length = Smailr.config["password_policy"]["length"].to_i
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
loop do
|
|
33
|
+
password = ask("Password: ") { |q| q.echo = "*" }
|
|
34
|
+
confirm = ask("Confirm: ") { |q| q.echo = "*" }
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
if password != confirm
|
|
36
37
|
say("Mismatch; try again.")
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
next
|
|
39
|
+
end
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
if password.length < min_password_length
|
|
41
42
|
say("Too short; try again.")
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
next
|
|
44
|
+
end
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
return password
|
|
47
|
+
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
# Initialize the Cli
|
|
@@ -107,7 +109,7 @@ module Smailr
|
|
|
107
109
|
when /^[^@][A-Z0-9.-]+\.[A-Z]{2,6}$/i then
|
|
108
110
|
domain = Smailr::Model::Domain[:fqdn => args[0]]
|
|
109
111
|
unless domain
|
|
110
|
-
|
|
112
|
+
say_error "No such domain: #{args[0]}"
|
|
111
113
|
exit 1
|
|
112
114
|
end
|
|
113
115
|
|
|
@@ -124,7 +126,7 @@ module Smailr
|
|
|
124
126
|
puts d[:fqdn]
|
|
125
127
|
end
|
|
126
128
|
else
|
|
127
|
-
|
|
129
|
+
say_error "You can either list a domains or a domains addresses."
|
|
128
130
|
exit 1
|
|
129
131
|
end
|
|
130
132
|
end
|
data/lib/smailr/version.rb
CHANGED