Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glfN3-00056L-L9 for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 19:36:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glfN1-000432-Ic for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 19:36:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glfN0-000424-Hn for pgsql-general@lists.postgresql.org; Mon, 21 Jan 2019 19:36:31 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glfMx-0001PC-8S for pgsql-general@lists.postgresql.org; Mon, 21 Jan 2019 19:36:30 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7E60F2153B; Mon, 21 Jan 2019 14:36:25 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 21 Jan 2019 14:36:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=X j/hfrhdc/tugqD2p73TMmPn/0ST8FYCWmSQx2GiZtc=; b=t2vEUUl5JBu7IBQK/ AoaX434rWiKlnaod2X44OzPx66zj6RVVz7rrsYCZ7DQfFxW/Gioh+JKum5OWKxtj MVAtUD8sAEvRL58HaUwJP32fQcvRseM114IOQI4RpGkWguRP4bGpKrxpC4tYJVtv lS25tEQoMFFUQWkti0jH2WxNr3WI07TXHFe2cAtL0gc0L0Sl3JULBhGyX+lZy8UB WKCB1OhyKUMrGIukqAyg8IInwNLhP8LRFeCKGR9GAZe+2Abby4wupCWMAP8dq5xT fEPU9gMPTnYsw31TNtVN49U2EmICHSttSrQe0CSwSqDR1axKgTIobvjoKdU0tGIG tP3fw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Xj/hfrhdc/tugqD2p73TMmPn/0ST8FYCWmSQx2GiZ tc=; b=vHy9eW/+KPxMdrwlZC7M8r8+vmjYXErRAzs+pxzpKlHyq2bNMU5PvFkGj 7eTmEVu4blDg/dSrq997JT/necok7KcB1ANPNUMFlVFJR9kqlifuFB+wro3plK89 IP5ogaoUbRoB6cN+QhpWGuX5FbMEnfxiS1df7dFB/lIMR4xidzFIVojuAWorZmvp tYiwvcmk67BDlxQqeWmlPXPPDaAbtoKw1DrhfhlOMSkC7ngTfw5jE9193zE9BEku NGEbKlsltG73ybiw4qvbnHqHJjgaTxndCYTZFXTGX60Lt3JWd8HxnJCIu02vDuRh xbcoYzOclEMDmhXVHTvSXb29Ioy5A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrheeigddufedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeehtddrud eljedrkedtrddvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (50-197-80-2-static.hfc.comcastbusiness.net [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id A5D72100BB; Mon, 21 Jan 2019 14:36:24 -0500 (EST) Subject: Re: Manage PostgreSQL Database for GITLAB Application? To: "Hilbert, Karin" , Stephen Frost Cc: "pgsql-general@lists.postgresql.org" References: <20190121185300.GZ2528@tamriel.snowman.net> From: Adrian Klaver Message-ID: Date: Mon, 21 Jan 2019 11:36:23 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/21/19 11:23 AM, Hilbert, Karin wrote: > Thanks Stephen, > > > I'm under the gun to get this database restored & then tested with the > application. > > I'll try changing the schema back from public to the original schema > (the same as the application user account name).  If that doesn't work > for the application, then I'll try leaving the schema as public. Would it not be easier to ask the application developer what his permissions model is. I can see a game of Whack-a-Mole ahead otherwise. > > I'll definitely remove the statements revoking privileges from the > dbowner & change the grant statements back to the application account > instead of PUBLIC. > > > The only access to the database is from the gitlab application (I guess > that's what you mean by "I'd definitely have the database be dedicated > to gitlab.") > > > I make the developer have his application connect in with the > application user account for normal operations.  When his application > undergoes an upgrade, it needs to also be able to update the database. > I always made him connect with the dbowner account for this & then > switch the connection back the application user account when the upgrade > was done. > > > Thanks for confirming my thoughts about public.  I was starting to > second guess myself. > > > May I also ask your thoughts regarding something else for the gitlab > database? > > We have two instances; one for development & one for production.  When > we originally created the databases, we had separate names for the > database, schema & application user: > > > dbname_dev/dbname_prod > > sname/snamep > > username/usernamep > > > The other year, we had to restore the prod database backup to dev & that > changed the schema name.  I was thinking that it would be better have > the same names used for dev & prod so that restores from one environment > to another would be easier.  (That's a standard that our DBA team > employs for our SQL Server databases.)  Does it make sense to also > employ that standard for PostgreSQL databases?  Is there any reason to > keep the names different between the environments? > > > Thanks again for your help. > > Regards, > > Karin > > ------------------------------------------------------------------------ > *From:* Stephen Frost > *Sent:* Monday, January 21, 2019 1:53:00 PM > *To:* Hilbert, Karin > *Cc:* pgsql-general@lists.postgresql.org > *Subject:* Re: Manage PostgreSQL Database for GITLAB Application? > Greetings, > > * Hilbert, Karin (ioh1@psu.edu) wrote: >> Does anyone manage a PostgreSQL database for a GITLAB application? > > Yes. > >> I have PostgreSQL v9.6 installed on my server & we are trying to migrate a GITLAB database there. >> >> The developer says that we need to use the public schema instead of the schema of the same name as the application user. > > Not sure this is really required but it also shouldn't hurt anything > really- I'd definitely have the database be dedicated to gitlab. > >> The schema that he provided me to restore also is revoking all privileges from the database owner & instead granting all privileges to PUBLIC. > > That's terrible. > >> Has anyone else run across this?  I always thought that granting privileges to PUBLIC is a bad security thing to do? > > Yes, that's bad from a security perspective and shouldn't be necessary. > GRANT rights to the user(s) the application logs into, don't just grant > them to PUBLIC- that would allow anyone on the system to have access. > >> If anyone can offer any thoughts regarding this, it would be greatly appreciated. > > Is this developer the only one who is going to be using this gitlab > instance..?  Sounds like maybe they want direct database access which > would only make sense if they're the one running it and should have full > access- but even then, I'd create a role and grant access to that role > and then grant them that role, if that's the requirement.  GRANT'ing > things to public isn't a good idea if you're at all concerned about > security. > > Thanks! > > Stephen -- Adrian Klaver adrian.klaver@aklaver.com