<commit_before>#!/bin/sh -x
# This bash script performs the following Postgresql setup actions: 
#   1. Changes the postgres user password to a new password, 
#      as chosen by the user running the script. 
#   2. Modifies the /etc/postgresql/9.1/main/postgresql.conf
#      file to accept all incoming connections to the database
#      (additional security measures taken in a later step). Also
#      modifies this file to increase the shared memory setting 
#      (shared_buffers changes from 24MB to 64MB). 
#   3. Modifies the /etc/postgresql/9.1/main/pg_hba.conf file 
#      to have md5 encryption for all users and also configures
#      the database server to accept connections from a specific 
#      IP address range on the LAN, only (192.168.0.0/24). 
# It does no error checking at the present time

echo ""
echo "This is a script to configure the Postgresql database server"
echo "There is no error checking. Please be careful!"
sleep 3
echo ""
echo -n "You will now be prompted for a new postgres user password."
echo ""
sleep 1
#read PostgresUserPassword
sudo passwd postgres
echo ""
echo "Done setting postgres user password."
echo "Please check for any errors above."
sleep 1

#Now configure md5 encryption/authentication, rather than peer
#Hack right now is a quick find-and-remplate for the word "peer"
#It would be better not to modify the entire commented text of the file,
#which provides instructions. 
echo ""
echo "Now modifying the pg_hba.conf file to reflect md5 authentication..."
sleep 1
sed -i "s/peer/md5/g" /etc/postgresql/9.1/main/pg_hba.conf 
echo "   ...Done configuring for md5 authentication."
sleep 1
#Now adding to the /etc/pg_hba_conf file the LAN IP's to accept connections from<commit_msg>Resolved issue where postgres user's password would not get updated properly.<commit_after>#!/bin/sh -x
# This bash script performs the following Postgresql setup actions: 
#   1. Changes the postgres user password to a new password, 
#      as chosen by the user running the script. 
#   2. Modifies the /etc/postgresql/9.1/main/postgresql.conf
#      file to accept all incoming connections to the database
#      (additional security measures taken in a later step). Also
#      modifies this file to increase the shared memory setting 
#      (shared_buffers changes from 24MB to 64MB). 
#   3. Modifies the /etc/postgresql/9.1/main/pg_hba.conf file 
#      to have md5 encryption for all users and also configures
#      the database server to accept connections from a specific 
#      IP address range on the LAN, only (192.168.0.0/24). 
# It does no error checking at the present time

echo ""
echo "This is a script to configure the Postgresql database server"
echo "There is no error checking. Please be careful!"
sleep 3
echo ""
echo -n "You will now be prompted for a new postgres user password."
echo ""
sleep 1
#A hack to change the password to '<PASSWORD>'
sudo -u postgres psql -c "ALTER USER postgres PASSWORD '<PASSWORD>';"
echo ""
echo "Done setting postgres user password."
echo ""
echo "To change the postgres user's password, log in to"
echo "the postgres server and type '\password postgres' "
sleep 3
echo "Please check for any errors above."
sleep 1

#Now configure md5 encryption/authentication, rather than peer
#Hack right now is a quick find-and-remplate for the word "peer"
#It would be better not to modify the entire commented text of the file,
#which provides instructions. 
echo ""
echo "Now modifying the pg_hba.conf file to reflect md5 authentication..."
sleep 1
sed -i "s/peer/md5/g" /etc/postgresql/9.1/main/pg_hba.conf 
echo "   ...Done configuring for md5 authentication."
sleep 1
#Now adding to the /etc/pg_hba_conf file the LAN IP's to accept connections from
{'fraction_non_alphanumeric': 0.07276618512573568, 'fraction_numerical': 0.01792402354200107, 'mean_word_length': 3.64472049689441, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '629868', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1065, 'n_words': 525}