<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Magnus Hagander's PostgreSQL blog (Entries tagged as security)</title>
    <link>http://blog.hagander.net/</link>
    <description></description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.6.2 - http://www.s9y.org/</generator>
    
    

<item>
    <title>About security updates and repository &quot;lockdown&quot;</title>
    <link>http://blog.hagander.net/archives/212-About-security-updates-and-repository-lockdown.html</link>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/212-About-security-updates-and-repository-lockdown.html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=212</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=212</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;I have received a lot of questions since the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/message-id/14040.1364490185@sss.pgh.pa.us&#039;]);&quot;  href=&quot;http://www.postgresql.org/message-id/14040.1364490185@sss.pgh.pa.us&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;announcement&lt;/a&gt; that we are temporarily shutting down the anonymous git mirror and commit messages. And we&#039;re also seeing quite a lot of media coverage.&lt;/p&gt;

&lt;p&gt;Let me start by clarifying exactly what we&#039;re doing:&lt;/p&gt;


&lt;ul&gt;
    &lt;li&gt;We are shutting down the mirror from our upstream git to our anonymous mirror&lt;/li&gt;
    &lt;li&gt;This also, indirectly, shuts down the mirror to github&lt;/li&gt;
    &lt;li&gt;We&#039;re temporarily placing a hold on all commit messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There has been some speculation in that we are going to shut down &lt;i&gt;all&lt;/i&gt; list traffic for a few days - that is completely wrong. All other channels in the project will operate just as usual. This of course also includes all developers working on separate git repositories (such as a personal fork on github).&lt;/p&gt;

&lt;p&gt;We are also not shutting down the repositories themselves. They will remain open, with the same content as today (including patches applied between now and Monday), they will just be frozen in time for a few days.&lt;/p&gt;

&lt;h3 id=&quot;toc0&quot;&gt;Why?&lt;/h3&gt;
&lt;p&gt;So why are we doing this? It&#039;s pretty simple - it takes a few days to prepare packages for all our supported platforms, to do testing on these, and get them ready for release. If we just committed the security fixes and then proceeded with the packaging, that would mean that anybody who was following our repository would be able to see those fixes a few days before the fixes were available to the majority of the users. That also means that anybody looking for the flaw would get a few days of time when the full details of the bug was in the open (since the fix was applied in public), but yet all the installations around the world would be unpatched and left wide open for exploit.&lt;/p&gt;

&lt;p&gt;By restricting access to view the patches until release time, we close this window. Yes, the vulnerability is still in the code that is out there today. But it has been in there for a few years, and nobody (that we know of) found it in that time. Hopefully, nobody will between now and release time. But by not explicitly showing the bug, we&#039;re at least keeping that risk as low as possible while still being able to warn our users that they will need to apply the patch as soon as it&#039;s out.&lt;/p&gt;

&lt;p&gt;We do realize that this will make some people look harder at the PostgreSQL code over the next couple of days trying to find this bug, and write an exploit for it.&lt;/p&gt;

&lt;h3 id=&quot;toc1&quot;&gt;But you&#039;re using git?&lt;/h3&gt;
&lt;p&gt;I&#039;ve seen a couple of comments along the line of &quot;isn&#039;t this where you should be using a DVCS like git you&#039;re using, letting the people building the security fixes do that in a separate repository and merge it once ready, not needing to shut down the central one&quot;.&lt;/p&gt;

&lt;p&gt;Turns out that is actually exactly what we are doing. The security fixes are mostly already developed, and as such are sitting somewhere else from the main repository. But we need at some point to merge these into the main repository, in order to let people build the packages. We only close down the repository mirroring right before this merge is done, and until the packages are ready to be released. It&#039;s not the work to &lt;i&gt;develop&lt;/i&gt; the patch that requires the shutdown of the mirroring, it&#039;s the work to build and release packages.&lt;/p&gt;

&lt;p&gt;The other advantage of the fact that we are using a DVCS, is that development does not stop during this time. Anybody working on a patch can keep working on it in their local copy of the repository. It&#039;s only the merge (&quot;apply&quot;)  of the patch to the upstream master branch that&#039;s going to be delayed. And that affects a much smaller group of people. Of course, it is a bit of an extra annoyance since we are currently trying to close out the open patches for the next release, but it&#039;s not a huge difference for most developers.&lt;/p&gt;

&lt;h3 id=&quot;toc2&quot;&gt;Are you going to publish the fixes eventually?&lt;/h3&gt;
&lt;p&gt;Yes, &lt;i&gt;absolutely&lt;/i&gt;! We are not going to permanently hide any information, or try to obfuscate the contents of security patches (*cough*unlike some other players in the field).&lt;/p&gt;

&lt;p&gt;Once the new versions are released, the git mirroring will resume. This will immediately mirror all the individual commits, including detailed commit messages showing what the bugs were (and of course including the fix itself). And we are assigning public CVE numbers to all security related bugs. At this point, the commit messages held in the queue will also be released, and appear on the &lt;i&gt;pgsql-committers&lt;/i&gt; list for anybody who wants to read up on them. And of course, complete tarballs with the full release will be made available alongside the binary packages.&lt;/p&gt;

&lt;h3 id=&quot;toc3&quot;&gt;Bottom line&lt;/h3&gt;
&lt;p&gt;It&#039;s a difficult balance between keeping things open so that everybody can verify what&#039;s going on, and keep exploit information out of the hands of the bad guys. Our goal with what we did this time is to minimize exposure to our users for a potentially very bad exploit (depends on the scenario for each individual install, of course), while we work with downstream distributions to make sure our fixes can reach the users as quickly as possible.&lt;/p&gt;

&lt;p&gt;Is it the right way? We don&#039;t know. It&#039;s the first time we do this, and it&#039;s not something we plan to do as a general process. We&#039;ll of course have to evaluate whether it was successful once it&#039;s all done.&lt;/p&gt;

&lt;p&gt;Finally, for those of you who are our &lt;i&gt;users&lt;/i&gt;, a short repeat. A new release is planned next week, current schedule is release on April 4th. We advise all users to review the security announcement and apply the fix as quickly as possible if the vulnerability is targetable in your environment. The patch will require installation of new binaries and a restart of the database, but no further migration work than that.&lt;/p&gt;

&lt;p&gt;We take the security of our users seriously, and try our best to protect them as much as possible. It&#039;s out belief that the tradoffs we&#039;ve done here are in their best interest. The future will tell, of course, if that belief is correct.&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Fri, 29 Mar 2013 16:58:00 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/212-guid.html</guid>
    <category>git</category>
<category>postgresql</category>
<category>security</category>

</item>
<item>
    <title>Out with the old... PostgreSQL 8.3 reaches end-of-life.</title>
    <link>http://blog.hagander.net/archives/211-Out-with-the-old...-PostgreSQL-8.3-reaches-end-of-life..html</link>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/211-Out-with-the-old...-PostgreSQL-8.3-reaches-end-of-life..html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=211</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=211</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;As of todays &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/about/news/1446/&#039;]);&quot;  href=&quot;http://www.postgresql.org/about/news/1446/&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;release announcement&lt;/a&gt;, PostgreSQL 8.3 is no longer a &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/support/versioning/&#039;]);&quot;  href=&quot;http://www.postgresql.org/support/versioning/&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;supported version&lt;/a&gt;. PostgreSQL 8.3 is end of life in according with the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/support/versioning/&#039;]);&quot;  href=&quot;http://www.postgresql.org/support/versioning/&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;5-year support policy&lt;/a&gt; for all PostgreSQL major versions.&lt;/p&gt;

&lt;p&gt;If you are running on any of the 8.3 versions, you should upgrade your system to 8.4 or newer &lt;strong&gt;immediately&lt;/strong&gt;. If this cannot be done immediately, you should at least upgrade to 8.3.23 in the meantime. When upgrading, it&#039;s likely worth upgrading to 9.2 or at least 9.1, and not just to 8.4 which only has a bit over a year before it also goes end of life.&lt;/p&gt;

&lt;p&gt;Any users of PostgreSQL 9.2, 9.1, 9.0 or 8.4 should still look at upgrading their systems to the latest minor release as of todays updates, since they contain both security and stability fixes. Minor version upgrades are, as always, just a matter of replacing your binaries and restarting the database. Automatic updates should also be out on the yum and apt repositories shortly.&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Thu, 07 Feb 2013 12:31:00 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/211-guid.html</guid>
    <category>postgresql</category>
<category>release</category>
<category>security</category>
<category>update</category>

</item>
<item>
    <title>Integrating django authentication with PostgreSQL</title>
    <link>http://blog.hagander.net/archives/161-Integrating-django-authentication-with-PostgreSQL.html</link>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/161-Integrating-django-authentication-with-PostgreSQL.html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=161</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=161</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;If you&#039;ve been to any of my &lt;i&gt;pgcrypto&lt;/i&gt; talks, you know I&#039;m a fan of exposing a login interface in the database. It&#039;s a great way to allow multiple systems to use the same authentication system, without being limited to a single framework. However, it can often be nice and easy to  be able to use the account management system in said framework, because it&#039;s already there.&lt;/p&gt;

&lt;p&gt;When I go to frameworks, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.djangoproject.com/&#039;]);&quot;  href=&quot;http://www.djangoproject.com/&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;django&lt;/a&gt; is my current favorite, and I do like the ability to use it&#039;s integrated admin system to edit users. For this reason, I wanted to add the ability to use a database function to authenticate other systems using the django user tables. Thanks to the fact that django choose a nicely readable text format for their hashes, and that PostgreSQL has the awesome &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/docs/current/static/pgcrypto.html&#039;]);&quot;  href=&quot;http://www.postgresql.org/docs/current/static/pgcrypto.html&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;pgcrypto&lt;/a&gt; library, this is pretty simple. Here&#039;s a function that will simply return true if authentication was successful, and false if not.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&lt;div class=&quot;geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REPLACE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt; django_login &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_username text, _password text&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;RETURNS &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BOOLEAN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; $$&lt;br /&gt;BEGIN&lt;br /&gt;&amp;#160; &amp;#160;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IF&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;EXISTS&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; * &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; auth_user &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; username=_username&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; THEN&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;RETURN&lt;/span&gt; encode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;pgcrypto.digest&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;split_part&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;password, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;$&#039;&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; || _password, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;sha1&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;hex&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;split_part&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;password, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;$&#039;&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; auth_user &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; username=_username;&lt;br /&gt;&amp;#160; &amp;#160;ELSE&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;RETURN&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;f&#039;&lt;/span&gt;;&lt;br /&gt;&amp;#160; &amp;#160;END &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IF&lt;/span&gt;;&lt;br /&gt;END;&lt;br /&gt;$$&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LANGUAGE&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;plpgsql&#039;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This assumes you have installed &lt;i&gt;pgcrypto&lt;/i&gt; in it&#039;s own schema, something I always recommend. If you haven&#039;t, just remove the schema specifier in the query.&lt;/p&gt;

&lt;p&gt;Finally, if you use this type of authentication, remember to &lt;strong&gt;use SSL&lt;/strong&gt;. And don&#039;t enable query logging...&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Tue, 12 Jan 2010 20:50:00 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/161-guid.html</guid>
    <category>django</category>
<category>pgcrypto</category>
<category>postgresql</category>
<category>security</category>

</item>
<item>
    <title>PostgreSQL security releases out</title>
    <link>http://blog.hagander.net/archives/159-PostgreSQL-security-releases-out.html</link>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/159-PostgreSQL-security-releases-out.html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=159</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=159</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;As you can &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/about/news.1170&#039;]);&quot;  href=&quot;http://www.postgresql.org/about/news.1170&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;see&lt;/a&gt;, PostgreSQL has just released new updated versions, which include security fixes. They also contain other critical bug fixes, so even if you are not directly affected by the security issues, &lt;strong&gt;plan an upgrade as soon as possible&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;One of the security issues that have been patched deal with NULL prefixes in SSL certificate names, a vulnerability that is basically the same one that have surfaced in a lot of different products this autumn, for example in the Mozilla suite of products. There is not really space enough to properly discuss the implications this has in a PostgreSQL environment in the release notes, so I&#039;ll try to elaborate some here - given that I wrote the fix for it.&lt;/p&gt;

&lt;p&gt;First of all, a quick explanation of what the problem is. PostgreSQL uses OpenSSL to deal with certificates. Prior to the fixed version, we just asked OpenSSL for the name of the certificate, got back a string, and used this one. Now, if you know C coding, you know that a string is terminated by a NULL character. The bug in PostgreSQL is that we did not check the return value from this function, and make sure it returned the same value as the length of the returned string. This means that somebody could embed a NULL value in the certificate, and we would incorrectly parse and validate only the part that was &lt;strong&gt;before&lt;/strong&gt; the NULL value. For example, if someone managed to get a certificate with the common name set to &quot;postgresql.bank.com\0attacker.com&quot;, PostgreSQL would match this certificate against &quot;postgresql.bank.com&quot; (or &quot;*.bank.com&quot;), which is not correct. With the fix, the certificate will be &lt;strong&gt;rejected&lt;/strong&gt; completely.&lt;/p&gt;

&lt;p&gt;It is important to know that in order to make use of this vulnerability, the attacker needs to convince a &lt;strong&gt;trusted CA&lt;/strong&gt; to sign such a certificate - which is quite obviously malicious. If the attacker cannot get the CA to hand this out, PostgreSQL will reject the certificate before we even get this far. It is arguably also a &lt;strong&gt;bug in the CA handling&lt;/strong&gt; (technical or procedural) to even hand out such a certificate, and that bug need to be exploited &lt;strong&gt;before&lt;/strong&gt; the one in PostgreSQL can be.&lt;/p&gt;

&lt;p&gt;In the vast majority of cases, if not all, where PostgreSQL is deployed and actually using certificate validation, the certificates will be handed out by a trusted &lt;strong&gt;local CA&lt;/strong&gt;. In which case, exploiting this vulnerability becomes much harder. This scenario is significantly different from the original scenario this bug was discovered in, which is the web browser. In the web browser case, the browser already trusts a large number of external CAs by default. PostgreSQL will trust &lt;strong&gt;no&lt;/strong&gt; CAs by default (unless you are doing a debian install, in which case they put some default CAs in there - this is another reason why this is a really bad idea from a security perspective). PostgreSQL also does not prompt the user with a potentially incorrect name field on the certificate asking if this is ok or not - it will just reject the certificate if it doesn&#039;t match (correctly or incorrectly), closing another attack venue. So the bug is really only significant if you can&#039;t trust your CA - but the whole point of the CA is that it is a trusted entity...&lt;/p&gt;

&lt;p&gt;PostgreSQL 8.4 is the first version to properly support &lt;i&gt;certificate name validation&lt;/i&gt;, and also the first version to support &lt;i&gt;client certificate authentication&lt;/i&gt;, both of which are vulnerable to this bug, &lt;strong&gt;neither&lt;/strong&gt; of which is enabled by default. However, previous versions are also indirectly vulnerable, because they exposed the CN field of the certificate to the application for further validation. So you could have a stored procedure checking the client certificate, or just the libpq application checking the server certificate, even in earlier versions. And given the API structure, there was no way for these outside processes to know if they were being fooled or not. So if you are using an application that makes use of this on previous versions of PostgreSQL, you still need the patch - there is no way to fix the bug from the application.&lt;/p&gt;

&lt;p&gt;The summary of this post is that this vulnerability is a &lt;strong&gt;lot less serious&lt;/strong&gt; in PostgreSQL than in many other systems that had the issue. That doesn&#039;t mean it&#039;s not there, and that it should be (and have been) fixed. But it means that this vulnerability alone is likely not reason enough to rush an upgrade on your production systems - most likely you&#039;re not affected by it. On the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/support/security&#039;]);&quot;  href=&quot;http://www.postgresql.org/support/security&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;PostgreSQL security page&lt;/a&gt; it is tagged with classification &lt;strong&gt;A&lt;/strong&gt;, which is the highest. This is more an indication that the system we&#039;re using for classification really doesn&#039;t take these things into consideration - something we will look into for the future.&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Mon, 14 Dec 2009 15:38:00 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/159-guid.html</guid>
    <category>postgresql</category>
<category>security</category>

</item>
<item>
    <title>pgcon, 1st talk day</title>
    <link>http://blog.hagander.net/archives/144-pgcon,-1st-talk-day.html</link>
            <category>Conferences</category>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/144-pgcon,-1st-talk-day.html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=144</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=144</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;We&#039;re now up to the third day of pgcon, the first one of the actual conference - the previous ones being dedicated to tutorials. The day started with &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.chesnok.com/daily/&#039;]);&quot;  href=&quot;http://www.chesnok.com/daily/&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Selena&lt;/a&gt;, me and &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/pgsnake.blogspot.com/2009/05/pgcon-2009-day-1.html&#039;]);&quot;  href=&quot;http://pgsnake.blogspot.com/2009/05/pgcon-2009-day-1.html&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Dave&lt;/a&gt; doing a semi-improvised keynote. Well, it started with Dan saying welcome and going through some details, but he doesn&#039;t count... I doubt we actually spread any knowledge with that talk, but at least we got to plug some interesting talks at the conference, and show pictures of elephants.&lt;/p&gt;

&lt;p&gt;Missed the start of the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.asterdata.com/index.php&#039;]);&quot;  href=&quot;http://www.asterdata.com/index.php&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Aster&lt;/a&gt; talk on Petabyte databases using standard PostgreSQL, but the parts I caught sounded very interesting. I&#039;m especially excited to hear they are planning to contribute a whole set of very interesting features back to core PostgreSQL. This makes a lot of sense since they&#039;re building their scaling on standard PostgreSQL and not a heavily modified one like some other players in the area, and it&#039;s very nice to see that they are realizing this.&lt;/p&gt;

&lt;p&gt;After this talk, it was time for my own talk on &lt;i&gt;PostgreSQL Encryption&lt;/i&gt;. I had a hard time deciding the split between pgcrypto and SSL when I made the talk, but I think it came out fairly well. Had a number of very good questions at the end, so clearly some people were interested. Perhaps even &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/momjian.us/main/blogs/pgblog.html&#039;]);&quot;  href=&quot;http://momjian.us/main/blogs/pgblog.html&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Bruce&lt;/a&gt; managed to learn something...&lt;/p&gt;

&lt;p&gt;After this we had lunch, and I&#039;m now sitting in Greg Smiths talk about benchmarking hardware. This is some very low level stuff compared to what you usually see around database benchmarking, but since this is what sits underneath the database, it&#039;s important stuff. And very interesting.&lt;/p&gt;

&lt;p&gt;The rest of the day has a lineup of some very nice talks, I think. So there&#039;ll be no sitting around in the hallway! And in the evening there is the EnterpriseDB party, of course!&lt;/p&gt;

&lt;p&gt;Yesterday had the developer meeting, where a bunch (~20) of the most active developers that are here in Ottawa sat down together for the whole day to discuss topics around the next version of PostgreSQL, and how our development model works. Got some very important discussions started, and actually managed to get agreement on a couple of issues that have previously been going in circles. All in all, a very useful day.&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Thu, 21 May 2009 17:37:39 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/144-guid.html</guid>
    <category>conferences</category>
<category>encryption</category>
<category>keynote</category>
<category>pgcon</category>
<category>pgcrypto</category>
<category>postgresql</category>
<category>security</category>
<category>ssl</category>
<category>talk</category>

</item>
<item>
    <title>Why are you not logging your DDL?</title>
    <link>http://blog.hagander.net/archives/142-Why-are-you-not-logging-your-DDL.html</link>
            <category>PostgreSQL</category>
    
    <comments>http://blog.hagander.net/archives/142-Why-are-you-not-logging-your-DDL.html#comments</comments>
    <wfw:comment>http://blog.hagander.net/wfwcomment.php?cid=142</wfw:comment>

    <slash:comments>5</slash:comments>
    <wfw:commentRss>http://blog.hagander.net/rss.php?version=2.0&amp;type=comments&amp;cid=142</wfw:commentRss>
    

    <author>nospam@example.com (Magnus Hagander)</author>
    <content:encoded>
    &lt;p&gt;Last week I had yet another customer issue where &quot;someone&quot; had been issuing DDL statements in the database. And nobody knew who. Or why. But (surprise!) it broke things (and they weren&#039;t even running &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.slony.info&#039;]);&quot;  href=&quot;http://www.slony.info&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Slony&lt;/a&gt;!). There are two simple lessons to be learned from this:&lt;/p&gt;

&lt;p&gt;In a production environment, &lt;i&gt;arbitrary DDL&lt;/i&gt; statements are normally not run. If they are, you really need to look over your application design, because it&#039;s broken. Note that this does not include temporary tables. Also things like automating the creation of new partitions are also pretty normal. But the important thing there is that it&#039;s controlled and scheduled work, not &lt;i&gt;arbitrary statements&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;So, you&#039;ll want to keep track of your DDL. PostgreSQL provides a very simple and good way to do this. Set the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.postgresql.org/docs/8.3/static/runtime-config-logging.html#GUC-LOG-STATEMENT&#039;]);&quot;  href=&quot;http://www.postgresql.org/docs/8.3/static/runtime-config-logging.html#GUC-LOG-STATEMENT&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;configuration parameter&lt;/a&gt; &lt;strong&gt;log_statement=&#039;ddl&#039;&lt;/strong&gt;. The default value for this parameter is &lt;strong&gt;none&lt;/strong&gt;, and there are also options for logging all DML and all statements period. But for a production environment, I find the &lt;strong&gt;ddl&lt;/strong&gt; option to be very useful. So useful, in fact, that I&#039;d consider it an installation bug in most environments if it&#039;s &lt;strong&gt;not&lt;/strong&gt; set. So if this parameter is not set in your production environment, now is a good time to reconsider that decision.&lt;/p&gt;

&lt;p&gt;The second thing to learn comes from the fact that once we tracked it down, it turned out that the DDL was issued from the &lt;i&gt;application server&lt;/i&gt;. Which was running with &lt;i&gt;superuser privileges&lt;/i&gt;. Now that&#039;s a much larger bug in the deployment, and a failure waiting to happen. There&#039;s a &lt;i&gt;very&lt;/i&gt; simple lesson to learn from this: &lt;strong&gt;the application server should never run with superuser privileges&lt;/strong&gt;. It should also not run with a user that &lt;i&gt;has permissions to issue any DDL&lt;/i&gt;. This is simply the &lt;i&gt;principle of least privilege&lt;/i&gt; - or at least &lt;i&gt;principle of not insanely high privileges&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;Yes, there are a number of application servers and frameworks that issue their own DDL as part of their ORM. The best way to handle them is, IMHO, to have them generate the SQL output and then manually apply that using a high privilege account. Because DDL should only be issued as part of upgrades and similar things, this should not be an issue. If the application server does not support this, a workaround is to give the application server DDL permissions &lt;i&gt;during the upgrade only&lt;/i&gt;, and then take them away as soon as the upgrade is completed.&lt;/p&gt;

&lt;p&gt;And yes, you should do this on your developer systems as well, and not just in production. Because if you only do it in production, you won&#039;t notice your bugs until you have deployed. It may seem like a lot of extra work to begin with, but it really is only a little extra work once you have got the procedures in place. And it can save you a &lt;strong&gt;lot&lt;/strong&gt; of forensics work once something has happened.&lt;/p&gt;

 
    </content:encoded>

    <pubDate>Mon, 04 May 2009 12:26:00 +0000</pubDate>
    <guid isPermaLink="false">http://blog.hagander.net/archives/142-guid.html</guid>
    <category>ddl</category>
<category>logging</category>
<category>postgresql</category>
<category>security</category>

</item>

</channel>
</rss>