aboutsummaryrefslogtreecommitdiffstats
path: root/modules/openssl/manifests/init.pp
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2010-12-07 02:40:29 +0000
committerMichael Scherer <misc@mageia.org>2010-12-07 02:40:29 +0000
commit8c1904c5fd98e99accb0937ee1ee7f358af163e6 (patch)
tree53caf9d66082ddad5183a02d91e9175b5d067878 /modules/openssl/manifests/init.pp
parent19eaa13c7bb4f8d93ec3bc1e03657e1b82f26c1d (diff)
downloadpuppet-8c1904c5fd98e99accb0937ee1ee7f358af163e6.tar
puppet-8c1904c5fd98e99accb0937ee1ee7f358af163e6.tar.gz
puppet-8c1904c5fd98e99accb0937ee1ee7f358af163e6.tar.bz2
puppet-8c1904c5fd98e99accb0937ee1ee7f358af163e6.tar.xz
puppet-8c1904c5fd98e99accb0937ee1ee7f358af163e6.zip
add a type for selfsigned certificate in 2 file
Diffstat (limited to 'modules/openssl/manifests/init.pp')
-rw-r--r--modules/openssl/manifests/init.pp25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/openssl/manifests/init.pp b/modules/openssl/manifests/init.pp
index 5399e969..b1800a54 100644
--- a/modules/openssl/manifests/init.pp
+++ b/modules/openssl/manifests/init.pp
@@ -15,4 +15,29 @@ class openssl {
require => Package['openssl']
}
}
+
+ define self_signed_splitted_cert($filename = '',
+ $directory = '/etc/certs',
+ $owner = "root",
+ $group = 'root',
+ $mode = '600') {
+ include openssl::base
+
+ $crt_file = "$filename.crt"
+ $key_file = "$filename.key"
+ exec { "openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $key_file -out $crt_file -subj '/CN=$name'":
+ cwd => "$directory",
+ creates => "$directory/$key_file",
+ require => Package['openssl'],
+ before => [ File["$directory/$key_file"],
+ File["$directory/$crt_file"]]
+ }
+
+ file { ["$directory/$key_file","$directory/$crt_file"]:
+ owner => $owner,
+ group => $group,
+ mode => $mode
+ }
+ }
+
}