dust-deploy 0.10.6 → 0.10.7
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.
- data/changelog.md +15 -0
- data/lib/dust/helper.rb +14 -8
- data/lib/dust/recipes/sshd.rb +21 -6
- data/lib/dust/version.rb +1 -1
- metadata +3 -3
data/changelog.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
Changelog
|
2
2
|
=============
|
3
3
|
|
4
|
+
0.10.7
|
5
|
+
------------
|
6
|
+
|
7
|
+
- sshd recipe supports conditional blocks
|
8
|
+
|
9
|
+
recipes:
|
10
|
+
sshd:
|
11
|
+
Match:
|
12
|
+
User john:
|
13
|
+
ChrootDirectory: /srv
|
14
|
+
ForceCommand: internal-sftp
|
15
|
+
AllowTcpForwarding: no
|
16
|
+
X11Forwarding: no
|
17
|
+
|
18
|
+
|
4
19
|
0.10.6
|
5
20
|
------------
|
6
21
|
|
data/lib/dust/helper.rb
CHANGED
@@ -41,25 +41,31 @@ class Hash
|
|
41
41
|
self
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
|
45
45
|
# converts each value to an array, so .each and .combine won't get hickups
|
46
46
|
def values_to_array!
|
47
|
-
self.keys.each { |k| self[k] = [ self[k] ] unless self[k].is_a? Array }
|
47
|
+
self.keys.each { |k| self[k] = [ self[k] ] unless self[k].is_a? Array }
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
# converts each value that is a boolean to 'yes' resp. 'no' strings
|
51
51
|
def boolean_to_string!
|
52
|
-
self.each
|
53
|
-
|
52
|
+
self.each do |k, v|
|
53
|
+
self[k] = 'yes' if v.is_a? TrueClass
|
54
|
+
self[k] = 'no' if v.is_a? FalseClass
|
55
|
+
|
56
|
+
# recursion
|
57
|
+
v.boolean_to_string! if v.is_a? Hash
|
58
|
+
end
|
59
|
+
end
|
54
60
|
end
|
55
61
|
|
56
62
|
|
57
63
|
class String
|
58
64
|
# stole this from Afz902k who posted something similar at stackoverflow.com
|
59
|
-
# adds ability to check if a class with the name of a string exists
|
65
|
+
# adds ability to check if a class with the name of a string exists
|
60
66
|
def to_class
|
61
67
|
Kernel.const_get self.capitalize
|
62
|
-
rescue NameError
|
68
|
+
rescue NameError
|
63
69
|
nil
|
64
70
|
end
|
65
71
|
|
@@ -75,7 +81,7 @@ module Dust
|
|
75
81
|
# converts string to kilobytes (rounded)
|
76
82
|
def self.convert_size s
|
77
83
|
i, unit = s.split(' ')
|
78
|
-
|
84
|
+
|
79
85
|
case unit.downcase
|
80
86
|
when 'kb'
|
81
87
|
return i.to_i
|
data/lib/dust/recipes/sshd.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Sshd < Recipe
|
2
|
-
|
2
|
+
|
3
3
|
desc 'sshd:deploy', 'installs and configures the ssh server'
|
4
|
-
def deploy
|
4
|
+
def deploy
|
5
5
|
if @node.uses_pacman?
|
6
6
|
return unless @node.install_package 'openssh'
|
7
7
|
else
|
@@ -9,7 +9,6 @@ class Sshd < Recipe
|
|
9
9
|
end
|
10
10
|
|
11
11
|
generate_default_config
|
12
|
-
@config.values_to_array!
|
13
12
|
|
14
13
|
check_hostkeys
|
15
14
|
apply_configuration
|
@@ -28,7 +27,7 @@ class Sshd < Recipe
|
|
28
27
|
'HostKey' => [ '/etc/ssh/ssh_host_dsa_key',
|
29
28
|
'/etc/ssh/ssh_host_ecdsa_key',
|
30
29
|
'/etc/ssh/ssh_host_rsa_key' ],
|
31
|
-
'PasswordAuthentication' => 'yes',
|
30
|
+
'PasswordAuthentication' => 'yes',
|
32
31
|
'ChallengeResponseAuthentication' => 'no',
|
33
32
|
'X11Forwarding' => 'yes',
|
34
33
|
'UsePAM' => 'yes',
|
@@ -58,9 +57,25 @@ class Sshd < Recipe
|
|
58
57
|
|
59
58
|
def apply_configuration
|
60
59
|
@sshd_config = ''
|
61
|
-
|
62
|
-
|
60
|
+
conditional_blocks = ''
|
61
|
+
|
62
|
+
@config.each do |key, value|
|
63
|
+
|
64
|
+
# hashes are conditional blocks
|
65
|
+
# which have to be placed at the end of the file
|
66
|
+
if value.is_a? Hash
|
67
|
+
value.each do |k, v|
|
68
|
+
conditional_blocks << "#{key} #{k}\n"
|
69
|
+
v.to_array.each { |x, y| conditional_blocks << " #{x} #{y}\n" }
|
70
|
+
end
|
71
|
+
|
72
|
+
else
|
73
|
+
value.to_array.each { |value| @sshd_config << "#{key} #{value}\n" }
|
74
|
+
end
|
63
75
|
end
|
76
|
+
|
77
|
+
# append conditional blocks
|
78
|
+
@sshd_config << conditional_blocks
|
64
79
|
end
|
65
80
|
|
66
81
|
def check_hostkeys
|
data/lib/dust/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
8
|
+
- 7
|
9
|
+
version: 0.10.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- kris kechagia
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-04-
|
17
|
+
date: 2012-04-23 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|