<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US" xml:base="http://www.kelvinwong.ca/wp-atom.php">
	<title type="text">Bongo's Codeways</title>
	<subtitle type="text">web programming, life, etc...</subtitle>

	<updated>2013-05-04T01:03:09Z</updated>

	<link rel="alternate" type="text/html" href="http://www.kelvinwong.ca" />
	<id>http://www.kelvinwong.ca/feed/atom/</id>
	

	<generator uri="http://wordpress.org/" version="3.5.1">WordPress</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/BongosCodeways" /><feedburner:info uri="bongoscodeways" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<author>
			<name>kelvin.wong</name>
						<uri>http://</uri>
					</author>
		<title type="html"><![CDATA[LinkedIn now with less salt!]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BongosCodeways/~3/gt6eVSK8dbQ/" />
		<id>http://www.kelvinwong.ca/?p=1099</id>
		<updated>2012-06-07T16:37:36Z</updated>
		<published>2012-06-07T16:37:36Z</published>
		<category scheme="http://www.kelvinwong.ca" term="etc" />		<summary type="html"><![CDATA[Even the finest sword plunged into salt water will eventually rust. &#160; &#160; Sun Tzu * Yesterday, the word of the day at LinkedIn was &#8220;Salt&#8221; (in the cryptographic sense and not the NaCl sense). Some dodgy fellow made off with at least some of the LinkedIn password database. Those passwords were not stored in [...]]]></summary>
		<content type="html" xml:base="http://www.kelvinwong.ca/2012/06/07/linkedin-now-with-less-salt/">&lt;p&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/06/linkedin_funny_tweets_src.jpg" alt="Funny tweets about LinkedIn" title="LinkedIn funny tweets" width="450" height="231" class="aligncenter size-full wp-image-1100" /&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Even the finest sword plunged into salt water will eventually rust.&lt;/strong&gt; &amp;nbsp; &amp;nbsp; Sun Tzu &lt;b style="color:black" title="See epigram note at bottom of the blog post!!!"&gt;*&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yesterday, the word of the day at LinkedIn was &amp;#8220;&lt;a href="http://en.wikipedia.org/wiki/Salt_(cryptography)"&gt;Salt&lt;/a&gt;&amp;#8221; (in the cryptographic sense and not the &lt;i title="Sodium Chloride"&gt;NaCl&lt;/i&gt; sense). &lt;a href="http://www.computerworld.com/s/article/9227869/Hackers_crack_more_than_60_of_breached_LinkedIn_passwords"&gt;Some dodgy fellow made off with at least some of the LinkedIn password database&lt;/a&gt;. Those passwords were &lt;strong&gt;not&lt;/strong&gt; stored in cleartext (thank Jupiter) but the hashes weren&amp;#8217;t salted. This means tools like &lt;a href="http://en.wikipedia.org/wiki/John_the_Ripper"&gt;John The Ripper&lt;/a&gt; can be used to find the original password and that is exactly what happened.&lt;/p&gt;
&lt;p&gt;If you are a software developer and you work on public facing web sites, here is the LinkedIn lesson:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Always use salt with your password hashing scheme&lt;/li&gt;
&lt;li&gt;Use slow hashing functions like &lt;a href="http://en.wikipedia.org/wiki/Bcrypt"&gt;bcrypt&lt;/a&gt; or &lt;a href="http://www.daemonology.net/blog/2009-05-09-scrypt-key-derivation.html"&gt;scrypt&lt;/a&gt; rather than faster hashing functions like MD5, SHA, etc.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;* Note on epigram:&lt;/strong&gt; Security nerds love to quote &lt;a href="http://en.wikipedia.org/wiki/Sun_Tzu" title="Sun Tzu is hawt"&gt;Sun Tzu&lt;/a&gt; and this was the only Sun Tzu quote I could find that had some salt in it.&lt;/p&gt;
&lt;p&gt;&lt;a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kelvinwong.ca%2F2012%2F06%2F07%2Flinkedin-now-with-less-salt%2F&amp;amp;title=LinkedIn%20now%20with%20%3Cstrike%3Eless%3C%2Fstrike%3E%20salt%21" id="wpa2a_2"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BongosCodeways/~4/gt6eVSK8dbQ" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.kelvinwong.ca/2012/06/07/linkedin-now-with-less-salt/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.kelvinwong.ca/2012/06/07/linkedin-now-with-less-salt/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.kelvinwong.ca/2012/06/07/linkedin-now-with-less-salt/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>kelvin.wong</name>
						<uri>http://</uri>
					</author>
		<title type="html"><![CDATA[Install secure Webmin 1.580 on Ubuntu 12.04 LTS Precise Pangolin]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BongosCodeways/~3/ZipP_ibqsmo/" />
		<id>http://www.kelvinwong.ca/?p=1028</id>
		<updated>2012-04-29T21:43:08Z</updated>
		<published>2012-04-29T21:43:08Z</published>
		<category scheme="http://www.kelvinwong.ca" term="ubuntu" /><category scheme="http://www.kelvinwong.ca" term="walkthroughs" /><category scheme="http://www.kelvinwong.ca" term="1.580" /><category scheme="http://www.kelvinwong.ca" term="apt-get" /><category scheme="http://www.kelvinwong.ca" term="apt-key" /><category scheme="http://www.kelvinwong.ca" term="openssl" /><category scheme="http://www.kelvinwong.ca" term="pangolin" /><category scheme="http://www.kelvinwong.ca" term="perl" /><category scheme="http://www.kelvinwong.ca" term="precise" /><category scheme="http://www.kelvinwong.ca" term="ssleay" /><category scheme="http://www.kelvinwong.ca" term="webmin" />		<summary type="html"><![CDATA[Installing Webmin on Ubuntu 12.04 LTS Precise Pangolin is quite simple. This article will walk you through the complete installation of Webmin 1.580 including the upgrading of the self-signed certificate to a 2048-bit key (a 512-bit key is the default). This is my system: $ uname -a Linux brasenose 3.2.0-24-generic-pae #37-Ubuntu SMP Wed Apr 25 [...]]]></summary>
		<content type="html" xml:base="http://www.kelvinwong.ca/2012/04/29/secure-your-webmin-install-on-ubuntu-12-04-lts/">&lt;p&gt;&lt;a href="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_works.jpg"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_works_inset.jpg" alt="Webmin welcome screen welcomes" title="Webmin welcome screen" width="473" height="447" class="aligncenter size-full wp-image-1082" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Installing &lt;a href="http://www.webmin.com/"&gt;Webmin&lt;/a&gt; on &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; 12.04 LTS Precise Pangolin is quite simple. This article will walk you through the complete installation of Webmin 1.580 including the upgrading of the self-signed certificate to a 2048-bit key (a 512-bit key is the default).&lt;/p&gt;
&lt;p&gt;This is my system:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;uname -a&lt;/b&gt;
Linux brasenose &lt;b style="color:green"&gt;3.2.0-24-generic-pae&lt;/b&gt; #37-Ubuntu SMP Wed Apr 25 10:47:59 UTC 2012 i686 i686 &lt;b style="color:green"&gt;i386&lt;/b&gt; GNU/Linux
$ &lt;b&gt;lsb_release -a&lt;/b&gt;
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	&lt;b style="color:green"&gt;Ubuntu 12.04 LTS&lt;/b&gt;
Release:	12.04
Codename:	precise
$ &lt;b&gt;openssl version&lt;/b&gt;
&lt;b style="color:green"&gt;OpenSSL 1.0.1&lt;/b&gt; 14 Mar 2012
&lt;/pre&gt;
&lt;p&gt;That last check is pretty important. If you don&amp;#8217;t have OpenSSL installed you are not going to be able to run Webmin over &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt; so make sure it is installed.&lt;/p&gt;
&lt;p&gt;My demonstration system is a minimal system with only a SSH Server installed and a static IP set-up.&lt;/p&gt;
&lt;h4&gt;Install Webmin&lt;/h4&gt;
&lt;p&gt;Things have come a long way in the Webmin world and some cranky &lt;a href="http://www.kelvinwong.ca/2010/05/22/installing-webmin-on-ubuntu-server-10-04-lts-lucid/"&gt;old Perl dependencies&lt;/a&gt; have now been flushed from the code. Unfortunately, there is no specialized Ubuntu version, so aficionados need to install the Debian version and make manual changes. Fortunately, installing the Debian package is simple. First we need to add the official Webmin repository to our list of software packages:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;sudo vi /etc/apt/sources.list&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;Add the following line to the bottom of the file:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;64
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;deb http:&lt;span style="color: #000000; font-weight: bold;"&gt;//&lt;/span&gt;download.webmin.com&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;download&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;repository sarge contrib&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This adds the Webmin Debian repository to your package list. Wondering why the repo release code name is &amp;#8216;Sarge&amp;#8217;? My guess is that it simply never got changed once Debian moved on to Etch in 2007 because it works fine. Sarge was an ancient &lt;a href="http://www.debian.org/releases/"&gt;Debian release&lt;/a&gt; from &lt;a href="http://en.wikipedia.org/wiki/Pleistocene"&gt;the late pleistocene&lt;/a&gt; and it hasn&amp;#8217;t been &amp;#8217;round these parts for many moons.&lt;/p&gt;
&lt;p&gt;Now we need to add Webmin author Jamie Cameron&amp;#8217;s public key to our keyring. Do this from your home directory:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;cd ~&lt;/b&gt;
$ &lt;b&gt;wget http://www.webmin.com/jcameron-key.asc&lt;/b&gt;
--2012-04-29 01:34:19--  http://www.webmin.com/jcameron-key.asc
Resolving www.webmin.com (www.webmin.com)... 216.34.181.97
Connecting to www.webmin.com (www.webmin.com)|216.34.181.97|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1320 (1.3K) [text/plain]
Saving to: `jcameron-key.asc'

100%[======================================&gt;] 1,320       --.-K/s   in 0s      

2012-04-29 01:34:19 (41.4 MB/s) - `jcameron-key.asc' saved [1320/1320]
$ &lt;b&gt;sudo apt-key add ~/jcameron-key.asc&lt;/b&gt;
[sudo] password for kelvin: 
OK
&lt;/pre&gt;
&lt;p&gt;Now we can install Webmin from the repo we added:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;sudo apt-get update&lt;/b&gt;
...
Fetched 12.6 MB in 37s (333 kB/s)                                              
Reading package lists... Done
$ &lt;b&gt;sudo apt-get install webmin&lt;/b&gt;
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl
  libnet-ssleay-perl
The following NEW packages will be installed:
  apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl
  libnet-ssleay-perl webmin
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 100 MB of additional disk space will be used.
Do you want to continue [Y/n]? &lt;b&gt;Y&lt;/b&gt;
Get:1 http://download.webmin.com/download/repository/ sarge/contrib webmin all 1.580 [15.8 MB]
Get:2 http://ca.archive.ubuntu.com/ubuntu/ precise/main libnet-ssleay-perl i386 1.42-1build1 [184 kB]
...
Setting up libnet-ssleay-perl (1.42-1build1) ...
Setting up libauthen-pam-perl (0.16-2build2) ...
Setting up libio-pty-perl (1:1.08-1build2) ...
Setting up libapt-pkg-perl (0.1.25build2) ...
Setting up apt-show-versions (0.17) ...
** initializing cache. This may take a while **
Setting up webmin (1.580) ...
Webmin install complete. You can now login to &lt;b&gt;https://brasenose:10000/&lt;/b&gt;
as root with your root password, or as &lt;b style="color:blue"&gt;any user who can use sudo
to run commands as root.&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_warn.jpg"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_warn_inset.jpg" alt="Webmin TLS certificate warning" title="Webmin TLS certificate warning details" width="361" height="109" class="aligncenter size-full wp-image-1085" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Webmin now is running on port 10000 but you can inspect the TLS properties and see that it is using a 512-bit key. Your browser may warn you of the weak default cryptographic key. That sort of thing is fine if you&amp;#8217;re living in North Korea, but we need to upgrade it to use a 2048-bit key like all the cool kids.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;
The username and password for Webmin is the same as any user that has sudo rights on the system. My username is therefore &amp;#8216;kelvin&amp;#8217; and my password is &amp;#8216;PASSWORD&amp;#8217;. LOL. No, I&amp;#8217;m not going to tell you my password&amp;#8230;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;h4&gt;Upgrade the self-signed SSL Certificate&lt;/h4&gt;
&lt;div id="attachment_1087" class="wp-caption aligncenter" style="width: 374px"&gt;&lt;a href="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_2048_warn.jpg"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_2048_warn_inset.jpg" alt="Webmin upgraded 2048-bit key warning" title="Webmin upgraded 2048-bit key warning details" width="364" height="69" class="aligncenter size-full wp-image-1088" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;Upgrading the Webmin certificate reduces TLS warnings&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;OpenSSL will be used to generate the needed keys and certificates. We are going to make a self-signed certificate which means that it will raise warnings, scary red flags, a &lt;a href="http://en.wikipedia.org/wiki/Cthulhu"&gt;Cthulhu&lt;/a&gt; and whoknowswhatelse in most browsers. So if this system will be used by easily frightened system admins (most are) then you might want to get a properly signed certificate from a &lt;a href="http://en.wikipedia.org/wiki/Certificate_authority" title="But you know those cost money"&gt;Certificate Authority&lt;/a&gt; instead. Having said that (and alienated most of my readership) let&amp;#8217;s get on with it.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The self-signed certificate will be valid for 1825 days or 5 years which is also how long your OS will be maintained by Canonical. Simply change the value after the &amp;#8216;days&amp;#8217; attribute in the command to meet your needs.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Use OpenSSL to make a private key and a self-signed certificate in one badass command:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;cd /etc/webmin&lt;/b&gt;
$ &lt;b&gt;sudo openssl req -newkey rsa:2048 -days 1825 -nodes -x509 -keyout server.key -out server.crt&lt;/b&gt;
[sudo] password for kelvin: 
Generating a 2048 bit RSA private key
.............................................................................................+++
.........+++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:&lt;b&gt;CA&lt;/b&gt;
State or Province Name (full name) [Some-State]:&lt;b&gt;British Columbia&lt;/b&gt;
Locality Name (eg, city) []:&lt;b&gt;Victoria&lt;/b&gt;
Organization Name (eg, company) [Internet Widgits Pty Ltd]:&lt;b&gt;Kelvin Wong Heavy Industries S.p.A.&lt;/b&gt;
Organizational Unit Name (eg, section) []:&lt;b&gt;Network Operations&lt;/b&gt;
Common Name (e.g. server FQDN or YOUR name) []:&lt;b&gt;brasenose.kelvinwong.ca&lt;/b&gt;
Email Address []:&lt;b&gt;postmaster@kelvinwong.ca&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Okay, so how cool was that?&lt;/strong&gt; Now you have to make your artifacts usable and safe. First, concatenate the private key and the certificate into a single PEM file that Webmin can understand (&lt;a href="http://en.wikipedia.org/wiki/Tee_(command)"&gt;tee&lt;/a&gt; used for piping because I&amp;#8217;m cool and I can read Wikipedia). Second, set the correct permissions and file ownership.&lt;/p&gt;
&lt;pre lang=""&gt;

$ &lt;b&gt;pwd&lt;/b&gt;
/etc/webmin
$ &lt;b&gt;cat server.crt server.key | sudo tee server.pem &gt; /dev/null&lt;/b&gt;
$ &lt;b&gt;sudo chmod 600 server.pem server.key server.crt&lt;/b&gt;
$ &lt;b&gt;sudo chown root:bin server.pem server.key server.crt&lt;/b&gt;
$ &lt;b&gt;ls -l server.*&lt;/b&gt;
-rw------- 1 root bin 1610 Apr 29 13:33 server.crt
-rw------- 1 root bin 1704 Apr 29 13:33 server.key
-rw------- 1 root bin 3314 Apr 29 13:45 server.pem
&lt;/pre&gt;
&lt;p&gt;Now you need to tell Webmin to use your new upgraded certificate.&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;sudo vi /etc/webmin/miniserv.conf&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;Change the certificate name:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;26
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #007800;"&gt;keyfile&lt;/span&gt;=&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;etc&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;webmin&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;server.pem&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Then restart Webmin:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;sudo invoke-rc.d webmin restart&lt;/b&gt;
Stopping Webmin server in /usr/share/webmin
Starting Webmin server in /usr/share/webmin
Pre-loaded WebminCore
&lt;/pre&gt;
&lt;p&gt;Your Webmin installation is now totally badass like &lt;a href="http://www.youtube.com/watch?v=4r7wHMg5Yjg"&gt;a Honey Badger&lt;/a&gt;.&lt;/p&gt;
&lt;div id="attachment_1090" class="wp-caption aligncenter" style="width: 392px"&gt;&lt;a href="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_2048_details.jpg"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/04/wmin_1580_tls_2048_details_inset.jpg" alt="Webmin 2048-bit key details" title="Webmin 2048-bit key details" width="382" height="133" class="aligncenter size-full wp-image-1091" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;Success upgrading Webmin TLS to 2048-bit key&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Question: What changes do you make to your Webmin configuration so that it runs well on Ubuntu?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kelvinwong.ca%2F2012%2F04%2F29%2Fsecure-your-webmin-install-on-ubuntu-12-04-lts%2F&amp;amp;title=Install%20secure%20Webmin%201.580%20on%20Ubuntu%2012.04%20LTS%20Precise%20Pangolin" id="wpa2a_4"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BongosCodeways/~4/ZipP_ibqsmo" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.kelvinwong.ca/2012/04/29/secure-your-webmin-install-on-ubuntu-12-04-lts/#comments" thr:count="8" />
		<link rel="replies" type="application/atom+xml" href="http://www.kelvinwong.ca/2012/04/29/secure-your-webmin-install-on-ubuntu-12-04-lts/feed/atom/" thr:count="8" />
		<thr:total>8</thr:total>
	<feedburner:origLink>http://www.kelvinwong.ca/2012/04/29/secure-your-webmin-install-on-ubuntu-12-04-lts/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>kelvin.wong</name>
						<uri>http://</uri>
					</author>
		<title type="html"><![CDATA[Github says: Please audit your SSH keys]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BongosCodeways/~3/cDNzp-BSE40/" />
		<id>http://www.kelvinwong.ca/?p=1018</id>
		<updated>2012-03-07T19:28:30Z</updated>
		<published>2012-03-07T19:28:30Z</published>
		<category scheme="http://www.kelvinwong.ca" term="etc" /><category scheme="http://www.kelvinwong.ca" term="walkthroughs" /><category scheme="http://www.kelvinwong.ca" term="&quot;ssh-keygen&quot;" /><category scheme="http://www.kelvinwong.ca" term="audit" /><category scheme="http://www.kelvinwong.ca" term="github" /><category scheme="http://www.kelvinwong.ca" term="hacked" /><category scheme="http://www.kelvinwong.ca" term="id_rsa" /><category scheme="http://www.kelvinwong.ca" term="ssh" />		<summary type="html"><![CDATA[I got the following from Github after their benign hacker incident: Please audit your SSH keys On Sunday March 4, 2012 a security vulnerability related to SSH keys (public keys) was discovered. For your protection and to prevent unauthorized access we have disabled your public keys until you approve them. They want me to audit [...]]]></summary>
		<content type="html" xml:base="http://www.kelvinwong.ca/2012/03/07/github-says-please-audit-your-ssh-keys/">&lt;p&gt;I got the following from Github after &lt;a href="https://github.com/blog/1068-public-key-security-vulnerability-and-mitigation"&gt;their benign hacker incident&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;b&gt;Please audit your SSH keys&lt;/b&gt;&lt;br /&gt;
On Sunday March 4, 2012 a security vulnerability related to SSH keys (public keys) was discovered. For your protection and to prevent unauthorized access we have disabled your public keys until you approve them.
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;They want me to audit my SSH keys (a simple process). First, find your public key that you use on GitHub (probably in your .ssh directory if you are using a Mac). Then get its fingerprint. Here&amp;#8217;s how you do that on a Mac:&lt;/p&gt;
&lt;pre lang=""&gt;
Trinity:~ kelvin$ &lt;b&gt;ls -l .ssh/id_rsa*&lt;/b&gt;
-rw-------  1 kelvin  staff  1743 Sep 11  2009 .ssh/id_rsa
-rw-r--r--  1 kelvin  staff   400 Sep 11  2009 .ssh/id_rsa.pub
Trinity:~ kelvin$ &lt;b&gt;ssh-keygen -lf .ssh/id_rsa&lt;/b&gt;
2048 &lt;b style="color:green"&gt;XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX&lt;/b&gt; .ssh/id_rsa.pub (RSA)
Trinity:~ kelvin$
&lt;/pre&gt;
&lt;p&gt;Using &lt;i&gt;ssh-keygen&lt;/i&gt; you can get the fingerprint from your private key filename (it will look for your public key for you). That long list of &amp;#8220;XX:XX&amp;#8221; things will be a &lt;a href="http://en.wikipedia.org/wiki/Hexadecimal"&gt;hexadecimal number&lt;/a&gt; that matches the key fingerprint at the bottom of &lt;a href="https://github.com/settings/ssh/audit"&gt;the GitHub SSH audit page&lt;/a&gt;. If it doesn&amp;#8217;t match then either &lt;a href="http://homakov.blogspot.com/2012/03/how-to.html" title="Unlikely that Egor hacked you really"&gt;Egor hacked you&lt;/a&gt; or you might have used a different key (keep looking!).&lt;/p&gt;
&lt;p&gt;&lt;a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kelvinwong.ca%2F2012%2F03%2F07%2Fgithub-says-please-audit-your-ssh-keys%2F&amp;amp;title=Github%20says%3A%20Please%20audit%20your%20SSH%20keys" id="wpa2a_6"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BongosCodeways/~4/cDNzp-BSE40" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.kelvinwong.ca/2012/03/07/github-says-please-audit-your-ssh-keys/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.kelvinwong.ca/2012/03/07/github-says-please-audit-your-ssh-keys/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.kelvinwong.ca/2012/03/07/github-says-please-audit-your-ssh-keys/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>kelvin.wong</name>
						<uri>http://</uri>
					</author>
		<title type="html"><![CDATA[HMCS Corner Brook rechristened HMCS Smiley]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BongosCodeways/~3/_zr091vMtxs/" />
		<id>http://www.kelvinwong.ca/?p=1009</id>
		<updated>2012-02-14T05:25:17Z</updated>
		<published>2012-02-14T05:25:17Z</published>
		<category scheme="http://www.kelvinwong.ca" term="etc" /><category scheme="http://www.kelvinwong.ca" term="accident" /><category scheme="http://www.kelvinwong.ca" term="hmcs corner brook" />		<summary type="html"><![CDATA[Offered without comment. Original here.]]></summary>
		<content type="html" xml:base="http://www.kelvinwong.ca/2012/02/13/hmcs-cornerbrook-as-smile/">&lt;p&gt;&lt;a href="http://www.kelvinwong.ca/wp-content/uploads/2012/02/hmcs_smiley_watermarked.jpg"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/uploads/2012/02/hmcs_smiley_inset.jpg" alt="HMCS Corner Brook as smiley" title="HMCS Smiley" width="450" height="380" class="aligncenter size-full wp-image-1012" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Offered without comment. Original &lt;a href="http://www.cbc.ca/news/canada/nova-scotia/story/2012/02/13/ns-hmcs-corner-brook-damage.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kelvinwong.ca%2F2012%2F02%2F13%2Fhmcs-cornerbrook-as-smile%2F&amp;amp;title=HMCS%20Corner%20Brook%20rechristened%20HMCS%20Smiley" id="wpa2a_8"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BongosCodeways/~4/_zr091vMtxs" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.kelvinwong.ca/2012/02/13/hmcs-cornerbrook-as-smile/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.kelvinwong.ca/2012/02/13/hmcs-cornerbrook-as-smile/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.kelvinwong.ca/2012/02/13/hmcs-cornerbrook-as-smile/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>kelvin.wong</name>
						<uri>http://</uri>
					</author>
		<title type="html"><![CDATA[Install webby Postgres 8.4 on CentOS 6.2]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BongosCodeways/~3/r0EbohAxzzA/" />
		<id>http://www.kelvinwong.ca/?p=972</id>
		<updated>2012-02-09T19:49:31Z</updated>
		<published>2012-02-09T19:47:34Z</published>
		<category scheme="http://www.kelvinwong.ca" term="centos" /><category scheme="http://www.kelvinwong.ca" term="postgres" /><category scheme="http://www.kelvinwong.ca" term="walkthroughs" /><category scheme="http://www.kelvinwong.ca" term="createdb" /><category scheme="http://www.kelvinwong.ca" term="createuser" /><category scheme="http://www.kelvinwong.ca" term="dropdb" /><category scheme="http://www.kelvinwong.ca" term="dropuser" /><category scheme="http://www.kelvinwong.ca" term="iptables" /><category scheme="http://www.kelvinwong.ca" term="pgbench" /><category scheme="http://www.kelvinwong.ca" term="pg_hba.conf" /><category scheme="http://www.kelvinwong.ca" term="postgresql" /><category scheme="http://www.kelvinwong.ca" term="postgresql-contrib" /><category scheme="http://www.kelvinwong.ca" term="postgresql-server" /><category scheme="http://www.kelvinwong.ca" term="postgresql.conf" />		<summary type="html"><![CDATA[At the end of this walkthrough you will have the PostgreSQL 8.4 database installed on CentOS 6.2 ready for use with your web projects. Postgres 8.4 is not the latest version, but it is stable and good enough for web development purposes. This set-up is &#8220;webby&#8221; in the sense that the it should be familiar [...]]]></summary>
		<content type="html" xml:base="http://www.kelvinwong.ca/2012/02/09/install-webby-postgres-8-4-on-centos-6-2/">&lt;p&gt;At the end of this walkthrough you will have the &lt;a href="http://www.postgresql.org/docs/8.4/static/intro-whatis.html"&gt;PostgreSQL 8.4 database&lt;/a&gt; installed on &lt;a href="http://en.wikipedia.org/wiki/CentOS"&gt;CentOS 6.2&lt;/a&gt; ready for use with your web projects. Postgres 8.4 is not the latest version, but it is stable and good enough for web development purposes. This set-up is &amp;#8220;webby&amp;#8221; in the sense that the it should be familiar to web developers.&lt;/p&gt;
&lt;h4&gt;Prerequisites&lt;/h4&gt;
&lt;p&gt;You need to be familiar with basic Linux system administration including editing configuration files with &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_text_editors"&gt;text-editors&lt;/a&gt; like &lt;i&gt;vi&lt;/i&gt; or &lt;i&gt;emacs&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;This is our system. It is a basic CentOS 6.2 installation with a static IP:&lt;/p&gt;
&lt;pre lang=""&gt;
$ &lt;b&gt;uname -a&lt;/b&gt;
Linux schettino.kelvinwong.ca 2.6.32-220.4.1.el6.i686 #1 SMP Mon Jan 23 22:37:12 GMT 2012 i686 i686 i386 GNU/Linux
$ &lt;b&gt;cat /etc/redhat-release&lt;/b&gt;
CentOS release 6.2 (Final)
&lt;/pre&gt;
&lt;h4&gt;Install Postgres&lt;/h4&gt;
&lt;p&gt;Installation of Postgres with yum is simple:&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;sudo yum install postgresql-server&lt;/b&gt;
[sudo] password for kelvin: 
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirror.its.sfu.ca
 * extras: mirror.its.sfu.ca
 * updates: mirror.its.sfu.ca
base                                                     | 3.7 kB     00:00     
extras                                                   | 3.5 kB     00:00     
updates                                                  | 3.5 kB     00:00     
Setting up Install Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package postgresql-server.i686 0:8.4.9-1.el6_1.1 will be installed
--&gt; Processing Dependency: postgresql-libs(x86-32) = 8.4.9-1.el6_1.1 for package: postgresql-server-8.4.9-1.el6_1.1.i686
--&gt; Processing Dependency: postgresql(x86-32) = 8.4.9-1.el6_1.1 for package: postgresql-server-8.4.9-1.el6_1.1.i686
--&gt; Processing Dependency: libpq.so.5 for package: postgresql-server-8.4.9-1.el6_1.1.i686
--&gt; Running transaction check
---&gt; Package postgresql.i686 0:8.4.9-1.el6_1.1 will be installed
---&gt; Package postgresql-libs.i686 0:8.4.9-1.el6_1.1 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                  Arch        Version                 Repository   Size
================================================================================
Installing:
 postgresql-server        i686        8.4.9-1.el6_1.1         base        3.3 M
Installing for dependencies:
 postgresql               i686        8.4.9-1.el6_1.1         base        2.7 M
 postgresql-libs          i686        8.4.9-1.el6_1.1         base        201 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 6.2 M
Installed size: 28 M
Is this ok [y/N]: &lt;span style="color:green;"&gt;y&lt;/span&gt;
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 6.2 M
(1/3): postgresql-8.4.9-1.el6_1.1.i686.rpm               | 2.7 MB     00:01     
(2/3): postgresql-libs-8.4.9-1.el6_1.1.i686.rpm          | 201 kB     00:00     
(3/3): postgresql-server-8.4.9-1.el6_1.1.i686.rpm        | 3.3 MB     00:01     
--------------------------------------------------------------------------------
Total                                           1.5 MB/s | 6.2 MB     00:04     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-libs-8.4.9-1.el6_1.1.i686                         1/3 
  Installing : postgresql-8.4.9-1.el6_1.1.i686                              2/3 
  Installing : postgresql-server-8.4.9-1.el6_1.1.i686                       3/3 

Installed:
  postgresql-server.i686 0:8.4.9-1.el6_1.1                                      

Dependency Installed:
  postgresql.i686 0:8.4.9-1.el6_1.1    postgresql-libs.i686 0:8.4.9-1.el6_1.1   

Complete!
[kelvin@schettino ~]$
&lt;/pre&gt;
&lt;p&gt;The server is installed along with the required client programs.&lt;/p&gt;
&lt;h4&gt;Configure Postgres &amp;#8211; Initialize and start service&lt;/h4&gt;
&lt;p&gt;After installing Postgres you will need to initialize the database (once only):&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;sudo service postgresql initdb&lt;/b&gt;
Initializing database:                                     [  &lt;span style="color:green;"&gt;OK&lt;/span&gt;  ]
&lt;/pre&gt;
&lt;p&gt;Set the server to restart on reboots and start the postmaster service:&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;sudo chkconfig postgresql on&lt;/b&gt;
[sudo] password for kelvin: 
[kelvin@schettino ~]$ &lt;b&gt;sudo service postgresql start&lt;/b&gt;
Starting postgresql service:                               [  &lt;span style="color:green;"&gt;OK&lt;/span&gt;  ]
&lt;/pre&gt;
&lt;h4&gt;Configure Postgres &amp;#8211; Set superuser password&lt;/h4&gt;
&lt;p&gt;Now let&amp;#8217;s set a password for the superuser (&lt;a href="http://www.postgresql.org/docs/8.4/static/postgres-user.html" title="The postgres user is the database superuser"&gt;the postgres user&lt;/a&gt;) using the PostgreSQL interactive terminal. Jump into the postgres user by using &lt;i&gt;su&lt;/i&gt; (with the dash to get a login shell):&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;su -&lt;/b&gt;
Password: 
[root@schettino ~]# &lt;b&gt;su - postgres&lt;/b&gt;
-bash-4.1$ &lt;b&gt;psql&lt;/b&gt;
psql (8.4.9)
Type "help" for help.

postgres=# &lt;b&gt;\password postgres&lt;/b&gt;
Enter new password: 
Enter it again:
postgres=# &lt;b&gt;\q&lt;/b&gt;
-bash-4.1$
&lt;/pre&gt;
&lt;h4&gt;Configure Postgres &amp;#8211; Activate password authentication&lt;/h4&gt;
&lt;p&gt;By default, the server uses &lt;a href="http://www.postgresql.org/docs/8.4/static/auth-methods.html#AUTH-IDENT"&gt;ident&lt;/a&gt; as defined in the &amp;#8220;PostgreSQL Client Authentication Configuration File&amp;#8221;. If you open up &lt;i&gt;pg_hba.conf&lt;/i&gt; you can see this default configuration:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;67
68
69
70
71
72
73
74
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #666666; font-style: italic;"&gt;# &amp;quot;local&amp;quot; is for Unix domain socket connections only&lt;/span&gt;
&lt;span style="color: #7a0874; font-weight: bold;"&gt;local&lt;/span&gt;   all         all                               ident
&lt;span style="color: #666666; font-style: italic;"&gt;# IPv4 local connections:&lt;/span&gt;
host    all         all         127.0.0.1&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;32&lt;/span&gt;          ident
&lt;span style="color: #666666; font-style: italic;"&gt;# IPv6 local connections:&lt;/span&gt;
host    all         all         ::&lt;span style="color: #000000;"&gt;1&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;128&lt;/span&gt;               ident&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Ident is a mapping of local system users (see &lt;i&gt;/etc/passwd&lt;/i&gt; for list of system users) to Postgres users. I have never found this authentication method useful for any of the web development work that I have done. I always change it to &amp;#8220;md5&amp;#8243; which allows you to create arbitrary users and passwords. Let&amp;#8217;s change the server&amp;#8217;s client configuration file (I assume you are still using the postgres user shell):&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;whoami&lt;/b&gt;
&lt;b style="color:green"&gt;postgres&lt;/b&gt;
-bash-4.1$ &lt;b&gt;vim /var/lib/pgsql/data/pg_hba.conf&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;Change the &amp;#8220;ident&amp;#8221; methods to &amp;#8220;md5&amp;#8243; methods at the bottom of the &lt;i&gt;pg_hba.conf&lt;/i&gt; file:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;67
68
69
70
71
72
73
74
75
76
77
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #666666; font-style: italic;"&gt;# &amp;quot;local&amp;quot; is for Unix domain socket connections only&lt;/span&gt;
&lt;span style="color: #7a0874; font-weight: bold;"&gt;local&lt;/span&gt;   all         all                               md5
&lt;span style="color: #666666; font-style: italic;"&gt;# IPv4 local connections:&lt;/span&gt;
host    all         all         127.0.0.1&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;32&lt;/span&gt;          md5
&lt;span style="color: #666666; font-style: italic;"&gt;# IPv6 local connections:&lt;/span&gt;
host    all         all         ::&lt;span style="color: #000000;"&gt;1&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;128&lt;/span&gt;               md5
&lt;span style="color: #666666; font-style: italic;"&gt;# If you don't want to open Postgres to the Internet&lt;/span&gt;
&lt;span style="color: #666666; font-style: italic;"&gt;# don't enable this line&lt;/span&gt;
host    all         all         0.0.0.0&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;             md5&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;By default, Postgres binds only to localhost and you will need to explicitly tell it to bind to your machine&amp;#8217;s IP address. The setting is in &lt;i&gt;postgres.conf&lt;/i&gt;. If you don&amp;#8217;t need remote access you can skip this.&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;vim /var/lib/pgsql/data/postgresql.conf&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;Change the &lt;i&gt;listen_addresses&lt;/i&gt; setting to an asterisk to listen to all available IP addresses:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;57
58
59
60
61
62
63
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;# - Connection Settings -&lt;/span&gt;
&amp;nbsp;
listen_addresses = &lt;span style="color: #ff0000;"&gt;'*'&lt;/span&gt;
&lt;span style="color: #666666; font-style: italic;"&gt;#listen_addresses = 'localhost'         # what IP address(es) to listen on;&lt;/span&gt;
                                        &lt;span style="color: #666666; font-style: italic;"&gt;# comma-separated list of addresses;&lt;/span&gt;
                                        &lt;span style="color: #666666; font-style: italic;"&gt;# defaults to 'localhost', '*' = all&lt;/span&gt;
                                        &lt;span style="color: #666666; font-style: italic;"&gt;# (change requires restart)&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Restart your postgres server (exit postgres user into the root shell):&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;exit&lt;/b&gt;
logout
[root@schettino ~]# &lt;b&gt;service postgresql restart&lt;/b&gt;
Stopping postgresql service:                               [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
Starting postgresql service:                               [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
[root@schettino ~]#
&lt;/pre&gt;
&lt;h4&gt;Open Firewall (optional)&lt;/h4&gt;
&lt;p&gt;If you want remote access to the server on Postgres port 5432 you will have to open a port on the firewall. If you still are the root user, type the following:&lt;/p&gt;
&lt;pre lang=""&gt;
[root@schettino ~]# &lt;b&gt;whoami&lt;/b&gt;
root
[root@schettino ~]# &lt;b&gt;vim /etc/sysconfig/iptables&lt;/b&gt;
&lt;/pre&gt;
&lt;p&gt;You can just copy the SSH port rule in iptables and modify the port number from 22 to 5432. Add the following rule just below the SSH port rule and above the rejection rule for the INPUT chain:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;10
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; state &lt;span style="color: #660033;"&gt;--state&lt;/span&gt; NEW &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;-p&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;--dport&lt;/span&gt; &lt;span style="color: #000000;"&gt;5432&lt;/span&gt; &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When changed, it should look like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;2
3
4
5
6
7
8
9
10
11
12
13
&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;*&lt;/span&gt;filter
:INPUT ACCEPT &lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;:&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#93;&lt;/span&gt;
:FORWARD ACCEPT &lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;:&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#93;&lt;/span&gt;
:OUTPUT ACCEPT &lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;:&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #7a0874; font-weight: bold;"&gt;&amp;#93;&lt;/span&gt;
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; state &lt;span style="color: #660033;"&gt;--state&lt;/span&gt; ESTABLISHED,RELATED &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-p&lt;/span&gt; icmp &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-i&lt;/span&gt; lo &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; state &lt;span style="color: #660033;"&gt;--state&lt;/span&gt; NEW &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;-p&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;--dport&lt;/span&gt; &lt;span style="color: #000000;"&gt;22&lt;/span&gt; &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; state &lt;span style="color: #660033;"&gt;--state&lt;/span&gt; NEW &lt;span style="color: #660033;"&gt;-m&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;-p&lt;/span&gt; tcp &lt;span style="color: #660033;"&gt;--dport&lt;/span&gt; &lt;span style="color: #000000;"&gt;5432&lt;/span&gt; &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; ACCEPT
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; INPUT &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; REJECT &lt;span style="color: #660033;"&gt;--reject-with&lt;/span&gt; icmp-host-prohibited
&lt;span style="color: #660033;"&gt;-A&lt;/span&gt; FORWARD &lt;span style="color: #660033;"&gt;-j&lt;/span&gt; REJECT &lt;span style="color: #660033;"&gt;--reject-with&lt;/span&gt; icmp-host-prohibited
COMMIT&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reload the rules:&lt;/p&gt;
&lt;pre lang=""&gt;
[root@schettino ~]# &lt;b&gt;service iptables restart&lt;/b&gt;
iptables: Flushing firewall rules:                         [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
iptables: Setting chains to policy ACCEPT: filter          [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
iptables: Unloading modules:                               [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
iptables: Applying firewall rules:                         [  &lt;span style="color:green"&gt;OK&lt;/span&gt;  ]
[root@schettino ~]# &lt;b&gt;exit&lt;/b&gt;
logout
[kelvin@schettino ~]$
&lt;/pre&gt;
&lt;h4&gt;Try it out with pgbench (optional)&lt;/h4&gt;
&lt;p&gt;To demonstrate the basic use of your new Postgres server, you can try out &lt;i&gt;pgbench&lt;/i&gt; which is in the &lt;i&gt;postgresql-contrib&lt;/i&gt; RPM. Let&amp;#8217;s install it, create a new user, create a new database and run &lt;i&gt;pgbench&lt;/i&gt; against it:&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;sudo yum install postgresql-contrib&lt;/b&gt;
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirror.its.sfu.ca
 * extras: mirror.its.sfu.ca
 * updates: mirror.its.sfu.ca
Setting up Install Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package postgresql-contrib.i686 0:8.4.9-1.el6_1.1 will be installed
--&gt; Processing Dependency: libxslt.so.1(LIBXML2_1.0.18) for package: postgresql-contrib-8.4.9-1.el6_1.1.i686
--&gt; Processing Dependency: libxslt.so.1(LIBXML2_1.0.11) for package: postgresql-contrib-8.4.9-1.el6_1.1.i686
--&gt; Processing Dependency: libxslt.so.1 for package: postgresql-contrib-8.4.9-1.el6_1.1.i686
--&gt; Processing Dependency: libossp-uuid.so.16 for package: postgresql-contrib-8.4.9-1.el6_1.1.i686
--&gt; Running transaction check
---&gt; Package libxslt.i686 0:1.1.26-2.el6 will be installed
---&gt; Package uuid.i686 0:1.6.1-10.el6 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch        Version                Repository   Size
================================================================================
Installing:
 postgresql-contrib        i686        8.4.9-1.el6_1.1        base        346 k
Installing for dependencies:
 libxslt                   i686        1.1.26-2.el6           base        448 k
 uuid                      i686        1.6.1-10.el6           base         54 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 848 k
Installed size: 3.3 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 848 k
(1/3): libxslt-1.1.26-2.el6.i686.rpm                     | 448 kB     00:00     
(2/3): postgresql-contrib-8.4.9-1.el6_1.1.i686.rpm       | 346 kB     00:00     
(3/3): uuid-1.6.1-10.el6.i686.rpm                        |  54 kB     00:00     
--------------------------------------------------------------------------------
Total                                           520 kB/s | 848 kB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : uuid-1.6.1-10.el6.i686                                       1/3 
  Installing : libxslt-1.1.26-2.el6.i686                                    2/3 
  Installing : postgresql-contrib-8.4.9-1.el6_1.1.i686                      3/3 

Installed:
  postgresql-contrib.i686 0:8.4.9-1.el6_1.1                                     

Dependency Installed:
  libxslt.i686 0:1.1.26-2.el6              uuid.i686 0:1.6.1-10.el6             

Complete!
[kelvin@schettino ~]$ &lt;b&gt;which pgbench&lt;/b&gt;
/usr/bin/pgbench
&lt;/pre&gt;
&lt;p&gt;Create a new Postgres user by using the &lt;i&gt;createuser&lt;/i&gt; wrapper (the P switch allows you to set a password for your new user):&lt;/p&gt;
&lt;pre lang=""&gt;
[kelvin@schettino ~]$ &lt;b&gt;su -&lt;/b&gt;
Password: 
[root@schettino ~]# &lt;b&gt;su - postgres&lt;/b&gt;
-bash-4.1$ &lt;b&gt;createuser -P francesco&lt;/b&gt;
Enter password for new role: [password for user francesco]
Enter it again: 
Shall the new role be a superuser? (y/n) &lt;b&gt;n&lt;/b&gt;
Shall the new role be allowed to create databases? (y/n) &lt;b&gt;n&lt;/b&gt;
Shall the new role be allowed to create more new roles? (y/n) &lt;b&gt;n&lt;/b&gt;
Password: [password for postgres]
-bash-4.1$
&lt;/pre&gt;
&lt;p&gt;Make a new database named &amp;#8220;winnings&amp;#8221; and change the owner to &amp;#8220;francesco&amp;#8221;:&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;createdb -O francesco winnings&lt;/b&gt;
Password: [password for postgres]
-bash-4.1$ 
&lt;/pre&gt;
&lt;p&gt;Now we can fill it up with &lt;i&gt;pgbench&lt;/i&gt;:&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;pgbench -i -U francesco winnings&lt;/b&gt;
Password: [password for user francesco]
NOTICE:  table "pgbench_branches" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_history" does not exist, skipping
creating tables...
10000 tuples done.
20000 tuples done.
30000 tuples done.
40000 tuples done.
50000 tuples done.
60000 tuples done.
70000 tuples done.
80000 tuples done.
90000 tuples done.
100000 tuples done.
set primary key...
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "pgbench_branches_pkey" for table "pgbench_branches"
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "pgbench_tellers_pkey" for table "pgbench_tellers"
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "pgbench_accounts_pkey" for table "pgbench_accounts"
vacuum...done.
-bash-4.1$ &lt;b&gt;pgbench -c 4 -S -t 2000 -U francesco winnings&lt;/b&gt;
Password: [password for user francesco]
starting vacuum...end.
transaction type: SELECT only
scaling factor: 1
query mode: simple
number of clients: 4
number of transactions per client: 2000
number of transactions actually processed: 8000/8000
tps = 4836.016718 (including connections establishing)
tps = 5052.773057 (excluding connections establishing)
-bash-4.1$ &lt;b&gt;pgbench -c 4 -t 2000 -U francesco winnings&lt;/b&gt;
Password: [password for user francesco]
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 4
number of transactions per client: 2000
number of transactions actually processed: 8000/8000
tps = 237.345234 (including connections establishing)
tps = 237.889294 (excluding connections establishing)
-bash-4.1$
&lt;/pre&gt;
&lt;p&gt;You can clean up the database by dropping the &amp;#8220;winnings&amp;#8221; database and dropping &amp;#8220;francesco&amp;#8221;:&lt;/p&gt;
&lt;pre lang=""&gt;
-bash-4.1$ &lt;b&gt;dropdb winnings&lt;/b&gt;
Password: [password for postgres]
-bash-4.1$ &lt;b&gt;dropuser francesco&lt;/b&gt;
Password: [password for postgres]
-bash-4.1$ 
&lt;/pre&gt;
&lt;p&gt;Enjoy your webby Postgres!&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;
Caveat! If you have an Apache/PHP5 server that wants to talk to your Postgres, you will have to set the appropriate SELinux boolean to allow the communication: &lt;i style="font-weight:bold;"&gt;setsebool -P httpd_can_network_connect_db 1&lt;/i&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kelvinwong.ca%2F2012%2F02%2F09%2Finstall-webby-postgres-8-4-on-centos-6-2%2F&amp;amp;title=Install%20webby%20Postgres%208.4%20on%20CentOS%206.2" id="wpa2a_10"&gt;&lt;img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BongosCodeways/~4/r0EbohAxzzA" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.kelvinwong.ca/2012/02/09/install-webby-postgres-8-4-on-centos-6-2/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.kelvinwong.ca/2012/02/09/install-webby-postgres-8-4-on-centos-6-2/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.kelvinwong.ca/2012/02/09/install-webby-postgres-8-4-on-centos-6-2/</feedburner:origLink></entry>
	</feed><!-- Dynamic Page Served (once) in 15.465 seconds --><!-- Cached page served by WP-Cache -->
