From 4e3ac2fbce938d2db76ca18938342b189c5cd0ef Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at> Date: Thu, 28 Nov 2013 12:51:58 +0000 Subject: [PATCH] improved postgresql authentication in vagrantbox also added phpPgAdmin to bootstraph.sh of vagrantbox --- etc/vagrant/bootstrap.sh | 22 ++++++++++++++++++---- etc/vagrant/pg_hba.conf | 6 +++--- etc/vagrant/phpPgAdmin.conf | 6 ++++++ 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 etc/vagrant/phpPgAdmin.conf diff --git a/etc/vagrant/bootstrap.sh b/etc/vagrant/bootstrap.sh index fa5e9765..73d7400c 100644 --- a/etc/vagrant/bootstrap.sh +++ b/etc/vagrant/bootstrap.sh @@ -20,6 +20,7 @@ INSTALL_HTTPD=true INSTALL_NEO4J=true INSTALL_POSTGIS=true INSTALL_TOMCAT=true +INSTALL_POSTGRES_ADMIN=true DISTRI=$(cat /etc/issue | head -n 1 | cut -d " " -f 1) DOWNLOAD_DIR=/tmp/vagrant-cache/wget @@ -43,7 +44,8 @@ OSM2PGROUTING_VERSION=v2.0.0 OSM2PGROUTING_MAPPING_CONF=$DEPLOY_DIR/osm2pgrouting/mapconfig.xml OSMOSIS_VERSION=0.43.1 OSMOSIS_FILE=osmosis-$OSMOSIS_VERSION.zip -POSTGRESQL_HBA_CONF=/var/lib/pgsql/9.3/data/pg_hba.conf +POSTGRESQL_DATA_DIR=/var/lib/pgsql/9.3/data +POSTGRESQL_HBA_CONF=$POSTGRESQL_DATA_DIR/pg_hba.conf POSTGRESQL_PKG_NAME=postgresql93 POSTGRESQL_REPO_RPM=http://yum.postgresql.org/9.3/fedora/fedora-19-x86_64/pgdg-fedora93-9.3-1.noarch.rpm POSTGRESQL_SERVICE_NAME=postgresql-9.3 @@ -55,9 +57,9 @@ TOMCAT_PKG_NAME=tomcat TOMCAT_SERVICE_NAME=$TOMCAT_PKG_NAME WORKING_DIR=`pwd` -DATABASE_NAME=isochrone -DATABASE_USER=niko -DATABASE_PASSWORD=secretPhdPassword#2013! +DATABASE_NAME="isochrone" +DATABASE_USER="niko" +DATABASE_PASSWORD="secretPhdPassword#2013!" ## Functions ############ @@ -167,6 +169,11 @@ if [ $INSTALL_POSTGIS ]; then cd $WORKING_DIR fi +if [ $INSTALL_POSTGRES_ADMIN ]; then + echo "Installing phpPgAdmin" + yum -y install phpPgAdmin > install_phpPgAdmin.log 2>&1 +fi + if [ $INSTALL_TOMCAT ]; then echo "Installing $TOMCAT_PKG_NAME servlet container" yum -y install $TOMCAT_PKG_NAME $TOMCAT_PKG_NAME-webapps $TOMCAT_PKG_NAME-admin-webapps > install_tomcat.log 2>&1 @@ -282,7 +289,14 @@ if [ $INSTALL_POSTGIS ]; then echo "Configuring and starting postgresql-server" cp /vagrant/pg_hba.conf $POSTGRESQL_HBA_CONF + echo "listen_addresses = '*'" >> $POSTGRESQL_DATA_DIR/postgresql.conf + echo "port = 5432" >> $POSTGRESQL_DATA_DIR/postgresql.conf +fi +if [ $INSTALL_POSTGRES_ADMIN ]; then + echo "Configuring phpPgAdmin" + cp /vagrant/phpPgAdmin.conf /etc/httpd/conf.d/phpPgAdmin.conf + sed -i 's/\$conf\['\''servers'\''\]\[0\]\['\''host'\''\] = '\'''\''/\$conf\['\''servers'\''\]\[0\]\['\''host'\''\] = '\''localhost'\''/' /usr/share/phpPgAdmin/conf/config.inc.php fi if [ $INSTALL_NEO4J ]; then diff --git a/etc/vagrant/pg_hba.conf b/etc/vagrant/pg_hba.conf index d4ccaa1a..13509e0c 100644 --- a/etc/vagrant/pg_hba.conf +++ b/etc/vagrant/pg_hba.conf @@ -1,5 +1,5 @@ # TYPE DATABASE USER ADDRESS METHOD -local all all peer -host all all 127.0.0.1/32 trust -host all all ::1/128 trust +local all all peer +host all all 127.0.0.1/32 md5 +host all all ::1/128 md5 diff --git a/etc/vagrant/phpPgAdmin.conf b/etc/vagrant/phpPgAdmin.conf new file mode 100644 index 00000000..9b376601 --- /dev/null +++ b/etc/vagrant/phpPgAdmin.conf @@ -0,0 +1,6 @@ +Alias /phpPgAdmin /usr/share/phpPgAdmin + +<Location /phpPgAdmin> + Order deny,allow + Allow from all +</Location> -- GitLab