Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxcLO-0008Em-I7 for pgsql-general@arkaria.postgresql.org; Wed, 05 Sep 2018 18:15:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fxcLK-0000Tb-9A for pgsql-general@arkaria.postgresql.org; Wed, 05 Sep 2018 18:15:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxcLJ-0000TU-NU for pgsql-general@lists.postgresql.org; Wed, 05 Sep 2018 18:15:53 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxcLG-0001J2-3M for pgsql-general@lists.postgresql.org; Wed, 05 Sep 2018 18:15:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 40D0A21F01; Wed, 5 Sep 2018 14:15:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 05 Sep 2018 14:15:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=xwGD6Sx/XaD/K2Km98vj4HaMdee+todtA/dBJjetIOA=; b=FOxMQkTw DSWLCDU1msT6bA6tKmlcK7Vaw6QvG3AALIDskj/wRs6DZg7rvtTyuKPhaeCxiSC9 66V4uYwM0T1NASELyjDBdo99qkacFLVIX0WBd0EXKBHeSQVQa0nl/7FMeehO8euB Ztli7OllLO9BRT6pOJbfUpV8Sd6nsYYO6v8lU/6/tdtWDuLVlCnakSRLunjTF5wN Fo2wXIZEwptx2emXjLz+V8XozTcngMubsTo41G3/cnumf84VBMpWuHZAUI7Ql5WS hGjdCns/2u5tZAhmiRz4LYAuxwK6rl8ohdmPjr6rNcODZLm8PaBd3/T1g5T7KsOQ s2E44CB0EtwHoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=xwGD6Sx/XaD/K2Km98vj4HaMdee+t odtA/dBJjetIOA=; b=jTo7bdmSMMaTvVInAxN+3LkEy2iAcDnDncC+HUcDpE6ju Xh636lWbbOtmLflHrs3ye/1pqAjytO39boo7ufy0SWsuWFK3ad8Dv698lClQggWh HWmWwZaBJCURtWdu46ELhsFUQCFgxxaPgA1LQSXgrexFr55L04S6/JE0U6G8I9YH 5dd6/NaeI2sddZI6NYMjBybyC+Ce7c/AorBBmgeX1fkvEi6mQvGTTH2bPWciDnp6 xrha5/+lZ8N2etTQJ90hIZZe810ttHB+0HSY9r6dqTXmx02AjZ1NcA7G4pSdNjQa ngiOZd3DcvuGsELvUjanNGgcfu7L3/yLZQNgHuYSA== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (unknown [208.91.3.26]) by mail.messagingengine.com (Postfix) with ESMTPA id D5BA010293; Wed, 5 Sep 2018 14:15:47 -0400 (EDT) Date: Wed, 5 Sep 2018 11:15:45 -0700 From: Michael Paquier To: Alessandro Gherardi Cc: "pgsql-general@lists.postgresql.org" Subject: Re: scram-sha-256 authentication broken in FIPS mode Message-ID: <20180905181545.GC2726@paquier.xyz> References: <898098721.1290085.1536118171911.ref@mail.yahoo.com> <898098721.1290085.1536118171911@mail.yahoo.com> <20180905042717.GL20696@paquier.xyz> <767499000.1481233.1536153579656@mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VywGB/WGlW4DM4P8" Content-Disposition: inline In-Reply-To: <767499000.1481233.1536153579656@mail.yahoo.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --VywGB/WGlW4DM4P8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 05, 2018 at 01:19:39PM +0000, Alessandro Gherardi wrote: > Hi Michael,I'm actually running postgres on Windows. First you may want to avoid top-posting. This is not the style of the community lists and this breaks the logic of a thread. > I added code to fe-secure-openssl.c and be-secure-openssl.c that reads > the Windows "standard" FIPS registry entry, and if FIPS is enabled > calls FIPS_mode_set(1). This is to mimic to behavior of the .NET > framework. That's rather uncharted territory, as you are patching both the backend *and* the client. If we could prove that sha2-openssl.c is actually unreliable even if FIPS is enabled system-wide with either SCRAM authentication or any of the other hashing functions, then I would be ready to accept a patch. Now, as far as I can see and heard from other folks for at least Linux, if FIPS is enabled at the OS level, then Postgres would use it automatically and SCRAM is able to work. I have yet to hear that this part is broken. As far as I know from companies within the community which worked on STIG requirements, the thing works. > Below is the code I added to fe-secure-openssl.c, the code in > be-secure-openssl.c is similar:=20 > Thoughts? I can try to fix the scram-sha-256 issue by using EVP and > send you a merge request for the patch and the code below if you think > my approach is correct. That's a bit unreadable I am afraid :) You may want to attach a patch after producing it with for example "git format-patch -1". -- Michael --VywGB/WGlW4DM4P8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluQHVEACgkQnvQgOdby QH2hgxAAhs+7VdNAyqfa0J8l4Hgqv9x8Cll6JWsQnv6bdWm4U6ANPGO3lfRmkhS8 CeNyTA0EhKAmuhR/3BbDe0RTXMzKAA1rfFR5H4oA8CIDgDi7hXBPISRFl4kBCVrr Abh0+iaw1OhwYUlQTO2IqYzJW2LK2i1inFOZWkTMHYi9aAlIEjoMbYSgF43csXeI wSyj+pFnTi68bNOmdrOeuLOpP4NAZdedBj9mXINYhuR+62mLhhRFs/zPM1t6IMZl 3vaVRp30O2eimcq8JofHLgnvz1ZtwQe6gODgw68r+RCALZs8glevULfpEW4P3SJw rsM28xR4euMBwNBKnEF0ZdtQJ7puL5zG5vvigkLGUG9/j8gDulMkGRhMoqMNCvJ/ P6RGsvKhghF0GoNZiZvAlWN12y9dOYUd4zUSE7fo7c+Cc/45nYQIQHEs5dsMZ9fL HgtTby6WmacNVlUgaKagvrqJjV9aXjWOgTvvbcnZQdZ7nh/Mhi+joaYYwahmwYIK Z4ThdfBqZkVw14ntlJgz72y1GoBPZsmsF2BMgH+wbU3xPLHRpanOVS16yWTxqUTY myyqJYuSHPOLHSqsDAH+1bArlDlEb26tVSZMhSaOolFzqfgltMuD8CZy+sqMHPcb lBjNMp9K/R+9UTr8R/3ZtHB3UtPIOYpxKru1UqjlOBTmaBEfCN4= =G270 -----END PGP SIGNATURE----- --VywGB/WGlW4DM4P8--