[PATCH configure] BZ #850571 - replace insecure postgres initdb w/ standard secure approach

Mo Morsi mmorsi at redhat.com
Thu Aug 23 20:10:06 UTC 2012


---
 recipes/aeolus/manifests/conductor.pp |    7 ++++++-
 recipes/postgres/manifests/server.pp  |    4 +---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/recipes/aeolus/manifests/conductor.pp b/recipes/aeolus/manifests/conductor.pp
index 00c80e4..9d3c44b 100644
--- a/recipes/aeolus/manifests/conductor.pp
+++ b/recipes/aeolus/manifests/conductor.pp
@@ -103,6 +103,11 @@ class aeolus::conductor inherits aeolus {
                group   => 'postgres',
                notify  => Service['postgresql']}
     }
+    exec{ "pgauthuser":
+      command     => "/usr/bin/sed -i s/ident/md5/ /var/lib/pgsql/data/pg_hba.conf",
+      require     => Exec["pginitdb"],
+      notify      => Service["postgresql"]
+    }
     postgres::user{"aeolus":
                      password => "v23zj59an",
                      roles    => "CREATEDB",
@@ -113,7 +118,7 @@ class aeolus::conductor inherits aeolus {
     aeolus::rails::create::db{"create_aeolus_database":
                 cwd        => "/usr/share/aeolus-conductor",
                 rails_env  => "production",
-                require    => [Postgres::User[aeolus], Package['aeolus-conductor']] }
+                require    => [Postgres::User[aeolus], Exec['pgauthuser'], Package['aeolus-conductor']] }
     aeolus::rails::migrate::db{"migrate_aeolus_database":
                 cwd             => "/usr/share/aeolus-conductor",
                 rails_env       => "production",
diff --git a/recipes/postgres/manifests/server.pp b/recipes/postgres/manifests/server.pp
index 09ea6d7..1bd4b28 100644
--- a/recipes/postgres/manifests/server.pp
+++ b/recipes/postgres/manifests/server.pp
@@ -24,9 +24,7 @@ class postgres::server inherits postgres {
     }
 
     exec { "pginitdb":
-        command         => "/usr/bin/initdb --pgdata='/var/lib/pgsql/data' -E UTF8",
-        user            => "postgres",
-        group           => "postgres",
+        command         => "/usr/bin/postgresql-setup initdb",
         creates         => "/var/lib/pgsql/data/PG_VERSION",
         require         => Package["postgresql-server"],
         notify          => Service["postgresql"],
-- 
1.7.10.2




More information about the aeolus-devel mailing list