summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwadronaut <kwadronaut@leap.se>2012-09-25 10:11:45 +0200
committerkwadronaut <kwadronaut@leap.se>2012-09-25 10:11:45 +0200
commitb4020afadc24aa6c1da3a1b8b0b2aa7936353d1d (patch)
tree3457aa556f60f4239001cc3e60403f4881206ea2
parentdb599ad72b63b6374ec1d6d25feb02c6cbb56aef (diff)
adding ssl support
-rw-r--r--manifests/params.pp5
-rw-r--r--manifests/ssl.pp26
2 files changed, 31 insertions, 0 deletions
diff --git a/manifests/params.pp b/manifests/params.pp
index df59ad0..4f4487f 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -15,4 +15,9 @@ class couchdb::params {
default => $couchdb_backupdir,
}
+ $cert_path = $couchdb_cert_path ? {
+ "" => "etc/certs/",
+ default => $couchdb_cert_path,
+ }
+
}
diff --git a/manifests/ssl.pp b/manifests/ssl.pp
new file mode 100644
index 0000000..633cf2f
--- /dev/null
+++ b/manifests/ssl.pp
@@ -0,0 +1,26 @@
+class couchdb::ssl {
+
+ package { ['openssl']:
+ ensure => 'installed',
+ }
+
+ file { $couchdb::cert_path:
+ ensure => 'directory',
+ mode => '0600',
+ owner => 'couchdb',
+ group => 'couchdb';
+ }
+
+exec { 'generate-certs':
+ command => "/usr/bin/openssl req -new -inform PEM -x509 -nodes -days 150 -subj \
+'/C=ZZ/ST=AutoSign/O=AutoSign/localityName=AutoSign/commonName=${::hostname}/organizationalUnitName=AutoSign/emailAddress=AutoSign/' \
+-newkey rsa:2048 -out ${couchdb::cert_path}/couchdb_cert.pem -keyout ${couchdb::cert_path}/couchdb_key.pem",
+ unless => "/usr/bin/test -f ${couchdb::cert_path}/couchdb_cert.pem &&
+/usr/bin/test -f ${couchdb::params::cert_path}/couchdb_key.pem",
+ require => [
+ File[$couchdb::params::cert_path],
+ Exec['make-install']
+ ],
+ notify => Service['couchdb'],
+ }
+}