puppet 2.7.5 → 2.7.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +121 -0
- data/conf/redhat/puppet.spec +16 -7
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/cert.rb +17 -3
- data/lib/puppet/application/device.rb +1 -0
- data/lib/puppet/application/kick.rb +0 -2
- data/lib/puppet/application/resource.rb +73 -66
- data/lib/puppet/configurer/plugin_handler.rb +6 -2
- data/lib/puppet/defaults.rb +60 -5
- data/lib/puppet/face/ca.rb +11 -2
- data/lib/puppet/face/certificate.rb +33 -4
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
- data/lib/puppet/file_serving/metadata.rb +43 -4
- data/lib/puppet/indirector.rb +0 -1
- data/lib/puppet/indirector/request.rb +3 -4
- data/lib/puppet/indirector/resource/active_record.rb +3 -10
- data/lib/puppet/indirector/resource/ral.rb +2 -2
- data/lib/puppet/indirector/rest.rb +1 -1
- data/lib/puppet/network/handler/ca.rb +16 -106
- data/lib/puppet/network/handler/master.rb +0 -3
- data/lib/puppet/network/handler/runner.rb +1 -0
- data/lib/puppet/parser/scope.rb +10 -0
- data/lib/puppet/provider/file/posix.rb +72 -34
- data/lib/puppet/provider/file/windows.rb +100 -0
- data/lib/puppet/provider/group/windows_adsi.rb +2 -2
- data/lib/puppet/provider/user/windows_adsi.rb +19 -4
- data/lib/puppet/resource.rb +16 -0
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/ssl/certificate.rb +2 -2
- data/lib/puppet/ssl/certificate_authority.rb +86 -10
- data/lib/puppet/ssl/certificate_authority/interface.rb +64 -19
- data/lib/puppet/ssl/certificate_factory.rb +112 -91
- data/lib/puppet/ssl/certificate_request.rb +88 -1
- data/lib/puppet/ssl/host.rb +20 -3
- data/lib/puppet/type/file.rb +15 -34
- data/lib/puppet/type/file/group.rb +11 -91
- data/lib/puppet/type/file/mode.rb +11 -41
- data/lib/puppet/type/file/owner.rb +18 -34
- data/lib/puppet/type/file/source.rb +22 -7
- data/lib/puppet/type/group.rb +4 -3
- data/lib/puppet/type/user.rb +4 -1
- data/lib/puppet/util.rb +59 -6
- data/lib/puppet/util/adsi.rb +11 -0
- data/lib/puppet/util/log.rb +4 -0
- data/lib/puppet/util/log/destinations.rb +7 -1
- data/lib/puppet/util/monkey_patches.rb +19 -0
- data/lib/puppet/util/network_device/config.rb +4 -5
- data/lib/puppet/util/settings.rb +5 -0
- data/lib/puppet/util/suidmanager.rb +0 -1
- data/lib/puppet/util/windows.rb +4 -0
- data/lib/puppet/util/windows/error.rb +16 -0
- data/lib/puppet/util/windows/security.rb +593 -0
- data/spec/integration/defaults_spec.rb +27 -0
- data/spec/integration/network/handler_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +382 -145
- data/spec/integration/util/windows/security_spec.rb +468 -0
- data/spec/shared_behaviours/file_serving.rb +4 -3
- data/spec/unit/application/agent_spec.rb +1 -0
- data/spec/unit/application/device_spec.rb +5 -0
- data/spec/unit/application/resource_spec.rb +62 -101
- data/spec/unit/configurer/downloader_spec.rb +2 -2
- data/spec/unit/configurer/plugin_handler_spec.rb +15 -8
- data/spec/unit/configurer_spec.rb +2 -2
- data/spec/unit/face/ca_spec.rb +34 -0
- data/spec/unit/face/certificate_spec.rb +168 -1
- data/spec/unit/file_serving/fileset_spec.rb +1 -1
- data/spec/unit/file_serving/indirection_hooks_spec.rb +1 -1
- data/spec/unit/file_serving/metadata_spec.rb +151 -107
- data/spec/unit/indirector/certificate_request/ca_spec.rb +0 -3
- data/spec/unit/indirector/direct_file_server_spec.rb +10 -9
- data/spec/unit/indirector/file_metadata/file_spec.rb +6 -4
- data/spec/unit/indirector/request_spec.rb +13 -3
- data/spec/unit/indirector/resource/active_record_spec.rb +4 -10
- data/spec/unit/indirector/resource/ral_spec.rb +6 -4
- data/spec/unit/indirector/rest_spec.rb +5 -6
- data/spec/unit/network/handler/ca_spec.rb +86 -0
- data/spec/unit/parser/collector_spec.rb +7 -7
- data/spec/unit/parser/scope_spec.rb +20 -0
- data/spec/unit/provider/file/posix_spec.rb +226 -0
- data/spec/unit/provider/file/windows_spec.rb +136 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +7 -2
- data/spec/unit/provider/user/windows_adsi_spec.rb +36 -3
- data/spec/unit/resource/catalog_spec.rb +20 -10
- data/spec/unit/resource_spec.rb +55 -8
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +97 -54
- data/spec/unit/ssl/certificate_authority_spec.rb +133 -23
- data/spec/unit/ssl/certificate_factory_spec.rb +90 -70
- data/spec/unit/ssl/certificate_request_spec.rb +62 -1
- data/spec/unit/ssl/certificate_spec.rb +20 -14
- data/spec/unit/ssl/host_spec.rb +52 -6
- data/spec/unit/type/file/content_spec.rb +4 -4
- data/spec/unit/type/file/group_spec.rb +34 -96
- data/spec/unit/type/file/mode_spec.rb +88 -0
- data/spec/unit/type/file/owner_spec.rb +32 -123
- data/spec/unit/type/file/source_spec.rb +120 -41
- data/spec/unit/type/file_spec.rb +1033 -753
- data/spec/unit/type_spec.rb +19 -1
- data/spec/unit/util/adsi_spec.rb +19 -0
- data/spec/unit/util/log/destinations_spec.rb +75 -0
- data/spec/unit/util/log_spec.rb +15 -0
- data/spec/unit/util/network_device/config_spec.rb +7 -0
- data/spec/unit/util/settings_spec.rb +10 -0
- data/spec/unit/util_spec.rb +126 -13
- data/test/language/functions.rb +0 -1
- data/test/language/snippets.rb +0 -9
- data/test/lib/puppettest/exetest.rb +1 -1
- data/test/lib/puppettest/servertest.rb +0 -1
- data/test/rails/rails.rb +0 -1
- data/test/ral/type/filesources.rb +0 -60
- metadata +13 -33
- data/lib/puppet/network/client.rb +0 -174
- data/lib/puppet/network/client/ca.rb +0 -56
- data/lib/puppet/network/client/file.rb +0 -6
- data/lib/puppet/network/client/proxy.rb +0 -27
- data/lib/puppet/network/client/report.rb +0 -26
- data/lib/puppet/network/client/runner.rb +0 -10
- data/lib/puppet/network/client/status.rb +0 -4
- data/lib/puppet/network/http_server.rb +0 -3
- data/lib/puppet/network/http_server/mongrel.rb +0 -130
- data/lib/puppet/network/http_server/webrick.rb +0 -155
- data/lib/puppet/network/xmlrpc/client.rb +0 -211
- data/lib/puppet/provider/file/win32.rb +0 -72
- data/lib/puppet/sslcertificates.rb +0 -146
- data/lib/puppet/sslcertificates/ca.rb +0 -375
- data/lib/puppet/sslcertificates/certificate.rb +0 -255
- data/lib/puppet/sslcertificates/inventory.rb +0 -38
- data/lib/puppet/sslcertificates/support.rb +0 -146
- data/spec/integration/network/client_spec.rb +0 -18
- data/spec/unit/network/xmlrpc/client_spec.rb +0 -172
- data/spec/unit/sslcertificates/ca_spec.rb +0 -106
- data/test/certmgr/certmgr.rb +0 -308
- data/test/certmgr/inventory.rb +0 -69
- data/test/certmgr/support.rb +0 -105
- data/test/network/client/ca.rb +0 -69
- data/test/network/client/dipper.rb +0 -34
- data/test/network/handler/ca.rb +0 -273
- data/test/network/server/mongrel_test.rb +0 -99
- data/test/network/server/webrick.rb +0 -111
- data/test/network/xmlrpc/client.rb +0 -45
@@ -1,99 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
|
4
|
-
|
5
|
-
require 'puppettest'
|
6
|
-
require 'mocha'
|
7
|
-
|
8
|
-
class TestMongrelServer < PuppetTest::TestCase
|
9
|
-
confine "Missing mongrel" => Puppet.features.mongrel?
|
10
|
-
|
11
|
-
include PuppetTest::ServerTest
|
12
|
-
|
13
|
-
def mkserver(handlers = nil)
|
14
|
-
handlers ||= { :Status => nil }
|
15
|
-
mongrel = Puppet::Network::HTTPServer::Mongrel.new(handlers)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Make sure client info is correctly extracted.
|
19
|
-
def test_client_info
|
20
|
-
obj = Object.new
|
21
|
-
obj.singleton_class.send(:attr_accessor, :params)
|
22
|
-
params = {}
|
23
|
-
obj.params = params
|
24
|
-
|
25
|
-
mongrel = mkserver
|
26
|
-
|
27
|
-
ip = Facter.value(:ipaddress)
|
28
|
-
params["REMOTE_ADDR"] = ip
|
29
|
-
params[Puppet[:ssl_client_header]] = ""
|
30
|
-
params[Puppet[:ssl_client_verify_header]] = "failure"
|
31
|
-
info = nil
|
32
|
-
Resolv.expects(:getname).with(ip).returns("host.domain.com").times(4)
|
33
|
-
assert_nothing_raised("Could not call client_info") do
|
34
|
-
info = mongrel.send(:client_info, obj)
|
35
|
-
end
|
36
|
-
assert(! info.authenticated?, "Client info object was marked valid even though headers were missing")
|
37
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
38
|
-
|
39
|
-
assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
|
40
|
-
|
41
|
-
# Now pass the X-Forwarded-For header and check it is preferred over REMOTE_ADDR
|
42
|
-
params["REMOTE_ADDR"] = '127.0.0.1'
|
43
|
-
params["HTTP_X_FORWARDED_FOR"] = ip
|
44
|
-
info = nil
|
45
|
-
assert_nothing_raised("Could not call client_info") do
|
46
|
-
info = mongrel.send(:client_info, obj)
|
47
|
-
end
|
48
|
-
assert(! info.authenticated?, "Client info object was marked valid even though headers were missing")
|
49
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
50
|
-
|
51
|
-
assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
|
52
|
-
|
53
|
-
# Now add a valid auth header.
|
54
|
-
params["REMOTE_ADDR"] = ip
|
55
|
-
params["HTTP_X_FORWARDED_FOR"] = nil
|
56
|
-
params[Puppet[:ssl_client_header]] = "/CN=host.domain.com"
|
57
|
-
assert_nothing_raised("Could not call client_info") do
|
58
|
-
info = mongrel.send(:client_info, obj)
|
59
|
-
end
|
60
|
-
assert(! info.authenticated?, "Client info object was marked valid even though the verify header was fals")
|
61
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
62
|
-
assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
|
63
|
-
|
64
|
-
# Now change the verify header to be true
|
65
|
-
params[Puppet[:ssl_client_verify_header]] = "SUCCESS"
|
66
|
-
assert_nothing_raised("Could not call client_info") do
|
67
|
-
info = mongrel.send(:client_info, obj)
|
68
|
-
end
|
69
|
-
|
70
|
-
assert(info.authenticated?, "Client info object was not marked valid even though all headers were correct")
|
71
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
72
|
-
assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
|
73
|
-
|
74
|
-
# Now try it with a different header name
|
75
|
-
params.delete(Puppet[:ssl_client_header])
|
76
|
-
Puppet[:ssl_client_header] = "header_testing"
|
77
|
-
params["header_testing"] = "/CN=other.domain.com"
|
78
|
-
info = nil
|
79
|
-
assert_nothing_raised("Could not call client_info with other header") do
|
80
|
-
info = mongrel.send(:client_info, obj)
|
81
|
-
end
|
82
|
-
|
83
|
-
assert(info.authenticated?, "Client info object was not marked valid even though the header was present")
|
84
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
85
|
-
assert_equal("other.domain.com", info.name, "Did not copy over hostname correctly")
|
86
|
-
|
87
|
-
# Now make sure it's considered invalid without that header
|
88
|
-
params.delete("header_testing")
|
89
|
-
info = nil
|
90
|
-
assert_nothing_raised("Could not call client_info with no header") do
|
91
|
-
info = mongrel.send(:client_info, obj)
|
92
|
-
end
|
93
|
-
|
94
|
-
assert(! info.authenticated?, "Client info object was marked valid without header")
|
95
|
-
assert_equal(ip, info.ip, "Did not copy over ip correctly")
|
96
|
-
assert_equal(Resolv.getname(ip), info.name, "Did not look up hostname correctly")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
@@ -1,111 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
|
4
|
-
|
5
|
-
require 'puppettest'
|
6
|
-
require 'puppet/network/http_server/webrick'
|
7
|
-
require 'mocha'
|
8
|
-
|
9
|
-
class TestWebrickServer < Test::Unit::TestCase
|
10
|
-
include PuppetTest::ServerTest
|
11
|
-
|
12
|
-
def setup
|
13
|
-
Puppet::Util::SUIDManager.stubs(:asuser).yields
|
14
|
-
Puppet::SSL::Host.instance_variable_set(:@localhost, nil)
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
# Make sure we can create a server, and that it knows how to create its
|
19
|
-
# certs by default.
|
20
|
-
def test_basics
|
21
|
-
server = nil
|
22
|
-
assert_raise(Puppet::Error, "server succeeded with no cert") do
|
23
|
-
server = Puppet::Network::HTTPServer::WEBrick.new(
|
24
|
-
:Port => @@port,
|
25
|
-
:Handlers => {
|
26
|
-
:Status => nil
|
27
|
-
}
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
assert_nothing_raised("Could not create simple server") do
|
32
|
-
server = Puppet::Network::HTTPServer::WEBrick.new(
|
33
|
-
:Port => @@port,
|
34
|
-
:Handlers => {
|
35
|
-
:CA => {}, # so that certs autogenerate
|
36
|
-
:Status => nil
|
37
|
-
}
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
assert(server, "did not create server")
|
42
|
-
|
43
|
-
assert(server.cert, "did not retrieve cert")
|
44
|
-
end
|
45
|
-
|
46
|
-
# test that we can connect to the server
|
47
|
-
# we have to use fork here, because we apparently can't use threads
|
48
|
-
# to talk to other threads
|
49
|
-
def test_connect_with_fork
|
50
|
-
Puppet[:autosign] = true
|
51
|
-
serverpid, server = mk_status_server
|
52
|
-
|
53
|
-
# create a status client, and verify it can talk
|
54
|
-
client = mk_status_client
|
55
|
-
|
56
|
-
assert(client.cert, "did not get cert for client")
|
57
|
-
|
58
|
-
retval = nil
|
59
|
-
assert_nothing_raised("Could not connect to server") {
|
60
|
-
retval = client.status
|
61
|
-
}
|
62
|
-
assert_equal(1, retval)
|
63
|
-
end
|
64
|
-
|
65
|
-
def mk_status_client
|
66
|
-
client = nil
|
67
|
-
|
68
|
-
assert_nothing_raised {
|
69
|
-
client = Puppet::Network::Client.status.new(
|
70
|
-
:Server => "localhost",
|
71
|
-
:Port => @@port
|
72
|
-
)
|
73
|
-
}
|
74
|
-
client
|
75
|
-
end
|
76
|
-
|
77
|
-
def mk_status_server
|
78
|
-
server = nil
|
79
|
-
Puppet[:certdnsnames] = "localhost"
|
80
|
-
assert_nothing_raised {
|
81
|
-
server = Puppet::Network::HTTPServer::WEBrick.new(
|
82
|
-
:Port => @@port,
|
83
|
-
:Handlers => {
|
84
|
-
:CA => {}, # so that certs autogenerate
|
85
|
-
:Status => nil
|
86
|
-
}
|
87
|
-
)
|
88
|
-
}
|
89
|
-
|
90
|
-
pid = fork {
|
91
|
-
Puppet.run_mode.stubs(:master?).returns true
|
92
|
-
assert_nothing_raised {
|
93
|
-
trap(:INT) { server.shutdown }
|
94
|
-
server.start
|
95
|
-
}
|
96
|
-
}
|
97
|
-
@@tmppids << pid
|
98
|
-
[pid, server]
|
99
|
-
end
|
100
|
-
|
101
|
-
def kill_and_wait(pid, file)
|
102
|
-
%x{kill -INT #{pid} 2>/dev/null}
|
103
|
-
count = 0
|
104
|
-
while count < 30 && File::exist?(file)
|
105
|
-
count += 1
|
106
|
-
sleep(1)
|
107
|
-
end
|
108
|
-
assert(count < 30, "Killing server #{pid} failed")
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
@@ -1,45 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
|
4
|
-
|
5
|
-
require 'puppettest'
|
6
|
-
require 'puppet/network/xmlrpc/client'
|
7
|
-
require 'mocha'
|
8
|
-
|
9
|
-
class TestXMLRPCClient < Test::Unit::TestCase
|
10
|
-
include PuppetTest
|
11
|
-
|
12
|
-
def setup
|
13
|
-
Puppet::Util::SUIDManager.stubs(:asuser).yields
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_set_backtrace
|
18
|
-
error = Puppet::Network::XMLRPCClientError.new("An error")
|
19
|
-
assert_nothing_raised do
|
20
|
-
error.set_backtrace ["caller"]
|
21
|
-
end
|
22
|
-
assert_equal(["caller"], error.backtrace)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Make sure we correctly generate a netclient
|
26
|
-
def test_handler_class
|
27
|
-
# Create a test handler
|
28
|
-
klass = Puppet::Network::XMLRPCClient
|
29
|
-
yay = Class.new(Puppet::Network::Handler) do
|
30
|
-
@interface = XMLRPC::Service::Interface.new("yay") { |iface|
|
31
|
-
iface.add_method("array getcert(csr)")
|
32
|
-
}
|
33
|
-
|
34
|
-
@name = :Yay
|
35
|
-
end
|
36
|
-
Object.const_set("Yay", yay)
|
37
|
-
|
38
|
-
net = nil
|
39
|
-
assert_nothing_raised("Failed when retrieving client for handler") do
|
40
|
-
net = klass.handler_class(yay)
|
41
|
-
end
|
42
|
-
|
43
|
-
assert(net, "did not get net client")
|
44
|
-
end
|
45
|
-
end
|