Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 11E31133655C for ; Wed, 22 Dec 2010 18:38:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 05690-10 for ; Wed, 22 Dec 2010 22:38:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mail.postgresql.org (Postfix) with ESMTP id 264EF133616B for ; Wed, 22 Dec 2010 18:38:49 -0400 (AST) Received: by wwf26 with SMTP id 26so5739543wwf.19 for ; Wed, 22 Dec 2010 14:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rSAfZt0AshdYZndLr638+M2kFiAdsD/E/qXco+vxlhw=; b=Xtfe8FlYO6ZNWTI9iGI+cFXl9jCEXSZP9tU+qLHddGpzjsJeSS63X8IeotrwcnESyM azLxaMy8QrT1xIjWKZiVpZmrZyXd+SIPHUhUrelkKEJ1sQG+06I5k8ABpj20x+Fdniw6 Rvh9/aGfmLJSvijbllCS4X18myI7MqKfbfxSI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=j+Myqfv2MIQZ3/bcljPA/qsmJxfk8E+6fBpp0v4QOMmnM6/L7cuDTMHR3bvEa3ng40 xxz5gpJUTN6W5sqz70ykTP+TXaXxfBTc0iMRdP6KrWS7z0rofWpDpEG/mtk4bB8Pmmyp XK+BPkhu31biNdyqFvOz3s4f++r6IrSM77zoE= MIME-Version: 1.0 Received: by 10.227.136.132 with SMTP id r4mr4607266wbt.38.1293057529185; Wed, 22 Dec 2010 14:38:49 -0800 (PST) Received: by 10.227.180.79 with HTTP; Wed, 22 Dec 2010 14:38:49 -0800 (PST) In-Reply-To: <4D1227A30200002500038A0C@gw.wicourts.gov> References: <4D122D10.7090805@saucetel.com> <4D1227A30200002500038A0C@gw.wicourts.gov> Date: Wed, 22 Dec 2010 15:38:49 -0700 Message-ID: Subject: Re: Securing a remotely accessible PostgreSQL server From: Scott Marlowe To: Kevin Grittner Cc: pgsql-admin@postgresql.org, Josh Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201012/170 X-Sequence-Number: 36399 On Wed, Dec 22, 2010 at 3:30 PM, Kevin Grittner wrote: > Josh wrote: > >> I am looking for suggestions on how best to secure a server that >> is accessible via the internet. Even account creation for the >> database is open to the world. Does anybody have any extra changes >> they would make to postgresql.conf or OS changes they would >> suggest? Perhaps some default permissions that would be best >> revoked? >> >> The system setup is currently a Linux box running PostgreSQL 8.4 >> My pg_hba.conf already limits remote connections to one database >> and one particular role. > > The role can create databases but not access them? =A0Odd. > > In no particular order, these come to mind: > > * Only allow SSL connections. > > * Use a non-standard port, to obscure what the service is. > > * Put the machine behind a firewall which only allows packets > through to the desired port. > > * Make sure you *don't* run the database service as root. > > * Make sure that the user which does run the database server doesn't > have access to anything more than it absolutely needs, directly or > through group membership. =A0(In particular, sudo rights should be > carefully limited or non-existent.) In fact, I'd chroot / jail the postgres server in this instance. If they get in, you just copy back over the chrooted directory and you're up and running in minutes.