summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/CloudConfig/cc_mcollective.py21
-rw-r--r--doc/examples/cloud-config-mcollective.txt33
2 files changed, 50 insertions, 4 deletions
diff --git a/cloudinit/CloudConfig/cc_mcollective.py b/cloudinit/CloudConfig/cc_mcollective.py
index 9aae2d64..3b358302 100644
--- a/cloudinit/CloudConfig/cc_mcollective.py
+++ b/cloudinit/CloudConfig/cc_mcollective.py
@@ -50,10 +50,23 @@ def handle(name,cfg,cloud,log,args):
# Read server.cfg values from original file in order to be able to mix the rest up
mcollective_config.readfp(FakeSecHead(open('/etc/mcollective/server.cfg')))
for cfg_name, cfg in mcollective_cfg['conf'].iteritems():
- # Iterate throug the config items, we'll use ConfigParser.set
- # to overwrite or create new items as needed
- for o, v in cfg.iteritems():
- mcollective_config.set(cfg_name,o,v)
+ if cfg_name == 'public-cert':
+ publicrt_fh = open('/etc/mcollective/ssl/server-public.pem', 'w')
+ publicrt_fh.write(cfg)
+ publicrt_fh.close()
+ mcollective_config.set(cfg_name,'plugin.ssl_server_public','/etc/mcollective/ssl/server-public.pem')
+ mcollective_config.set(cfg_name,'securityprovider','ssl')
+ elif cfg_name == 'private-cert':
+ privcrt_fh = open('/etc/mcollective/ssl/server-private.pem', 'w')
+ privcrt_fh.write(cfg)
+ privcrt_fh.close()
+ mcollective_config.set(cfg_name,'plugin.ssl_server_private','/etc/mcollective/ssl/server-private.pem')
+ mcollective_config.set(cfg_name,'securityprovider','ssl')
+ else:
+ # Iterate throug the config items, we'll use ConfigParser.set
+ # to overwrite or create new items as needed
+ for o, v in cfg.iteritems():
+ mcollective_config.set(cfg_name,o,v)
# We got all our config as wanted we'll rename
# the previous server.cfg and create our new one
os.rename('/etc/mcollective/server.cfg','/etc/mcollective/server.cfg.old')
diff --git a/doc/examples/cloud-config-mcollective.txt b/doc/examples/cloud-config-mcollective.txt
index ca7ba03e..ddeaf0c6 100644
--- a/doc/examples/cloud-config-mcollective.txt
+++ b/doc/examples/cloud-config-mcollective.txt
@@ -13,3 +13,36 @@ mcollective:
# plugin.stomp.host: dbhost
conf:
plugin.stomp.host: dbhost
+ # This will add ssl certs to mcollective
+ # WARNING WARNING WARNING
+ # Please remember cloud-init data is transmitted without encryption
+ # If you want security for this, please use include-once + SSL urls
+ public-cert: |
+ -----BEGIN CERTIFICATE-----
+ MIICCTCCAXKgAwIBAgIBATANBgkqhkiG9w0BAQUFADANMQswCQYDVQQDDAJjYTAe
+ Fw0xMDAyMTUxNzI5MjFaFw0xNTAyMTQxNzI5MjFaMA0xCzAJBgNVBAMMAmNhMIGf
+ MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCu7Q40sm47/E1Pf+r8AYb/V/FWGPgc
+ b014OmNoX7dgCxTDvps/h8Vw555PdAFsW5+QhsGr31IJNI3kSYprFQcYf7A8tNWu
+ 1MASW2CfaEiOEi9F1R3R4Qlz4ix+iNoHiUDTjazw/tZwEdxaQXQVLwgTGRwVa+aA
+ qbutJKi93MILLwIDAQABo3kwdzA4BglghkgBhvhCAQ0EKxYpUHVwcGV0IFJ1Ynkv
+ T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwDwYDVR0TAQH/BAUwAwEB/zAd
+ BgNVHQ4EFgQUu4+jHB+GYE5Vxo+ol1OAhevspjAwCwYDVR0PBAQDAgEGMA0GCSqG
+ SIb3DQEBBQUAA4GBAH/rxlUIjwNb3n7TXJcDJ6MMHUlwjr03BDJXKb34Ulndkpaf
+ +GAlzPXWa7bO908M9I8RnPfvtKnteLbvgTK+h+zX1XCty+S2EQWk29i2AdoqOTxb
+ hppiGMp0tT5Havu4aceCXiy2crVcudj3NFciy8X66SoECemW9UYDCb9T5D0d
+ -----END CERTIFICATE-----
+ private-cert: |
+ -----BEGIN CERTIFICATE-----
+ MIICCTCCAXKgAwIBAgIBATANBgkqhkiG9w0BAQUFADANMQswCQYDVQQDDAJjYTAe
+ Fw0xMDAyMTUxNzI5MjFaFw0xNTAyMT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