Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohmpr-0000jc-O3 for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Oct 2022 07:04:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ohmpq-0006Fy-Ac for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Oct 2022 07:04:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohmpq-0006Fo-1v for pgsql-hackers@lists.postgresql.org; Mon, 10 Oct 2022 07:04:22 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ohmpn-0001uu-Mi for pgsql-hackers@lists.postgresql.org; Mon, 10 Oct 2022 07:04:21 +0000 Received: by mail-wr1-x434.google.com with SMTP id bv10so12028159wrb.4 for ; Mon, 10 Oct 2022 00:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=KcoszbvnWpm+aBpsfNi8ZQQa3/aJ13vDPXp+PBns1vc=; b=NaAH1j64pp0QItXqdeWyh9hJlhf07Q7b5ld4VurHPWR6LT1OYrBRTWPRRT8BJ/iqKk hcN03663GKOZ6zwcLWe4dJSotliVDm1KzMt1Lx7GPcaywBMkxBmrE+traoK9kIMGhrdR E+c8sJATRlTOfjFf8NwpvJiKfu5jm/SOf9SuQkEC0S00wu6qLUczH5noUlFYni0jln4y 5b+tnSJd6JFRlBh3v1YQxPROF9XVXBjV+YjF+1pvtGmIopnAfVEV1xkCn+wo7FWrbHZw kd4xyd5WOBZ5ZdPRBjcr9HVv0164N3tOux+N3RLkwCPwwk6TuTwRDf0nvGUqRe1pwu+/ RU5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KcoszbvnWpm+aBpsfNi8ZQQa3/aJ13vDPXp+PBns1vc=; b=JrEqtkvLP7xfpsqcrwGL2uVPJRAu7f8SPnna+KGc7e4dCYyGDFXX39fZTlj70NDPqO GxRs0uSeu/yTlPdVrM53lnW/CACOolkVDGz/GpDfkEZPhBkjQES0WZ3SjeNvfDksbvXQ +h6LX5AbSdZUiOsiTgiK6VRFHLM5AR88ms+SaL+/zJFTgD4aWAB7LDvXub9IbEjP2EHB XvRD3qiJUUrk77SjNoYx+c49G29zqqWqJa6bFOJRRPVxPu7opLVJ7GCJPI5GBL02vxak 5Ny55lgqtDcgSLOyLw+VRo+cE69t2DzgBs1219D/aN8s8okW9hrR986aeKFCj1atCnur 8ViA== X-Gm-Message-State: ACrzQf3S/ZoemxmuKrM9dzW5DjIkuRW/E3dGcIRCqju3IFQJ7ZclvlVp wtMzpcJi8fFIQ3T75iFbSjsnTkhe04KhXjMu X-Google-Smtp-Source: AMsMyM6GTedovki1Xq7t/57mHdheq/ip33VqV/36hgJL82jpYDhZJrvgGQwYOui6rgLDaSBmoOvRQg== X-Received: by 2002:adf:db42:0:b0:22e:386e:f6af with SMTP id f2-20020adfdb42000000b0022e386ef6afmr10162301wrj.400.1665385458098; Mon, 10 Oct 2022 00:04:18 -0700 (PDT) Received: from [192.168.7.69] ([54.239.6.184]) by smtp.gmail.com with ESMTPSA id iv14-20020a05600c548e00b003b4c40378casm16232550wmb.39.2022.10.10.00.04.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Oct 2022 00:04:17 -0700 (PDT) Message-ID: Date: Mon, 10 Oct 2022 09:04:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf Content-Language: en-US To: Michael Paquier Cc: Tom Lane , Jacob Champion , PostgreSQL Hackers References: <4177827.1662684400@sss.pgh.pa.us> <572017.1663646973@sss.pgh.pa.us> From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 10/6/22 2:53 AM, Michael Paquier wrote: > On Wed, Oct 05, 2022 at 03:32:20PM +0200, Drouvot, Bertrand wrote: >> On 10/5/22 9:24 AM, Michael Paquier wrote: >>> - test_role() -> test_conn() to be able to pass down a database name. >>> - reset_pg_hba() to control the host, db and user parts. The host >>> part does not really apply after moving the hosts checks to a more >>> secure location, so I guess that this had better be extended just for >>> the user and database, keeping host=local all the time. >>> I am planning to apply 0001 attached independently, >> >> 0001 looks good to me. > > Thanks. I have applied this refactoring, leaving the host part out of > the equation as we should rely only on local connections for this > part of the test. Thanks! >> Thanks! I'll look at it and the comments you just made up-thread. > > Cool, thanks. One thing that matters a lot IMO (that I forgot to > mention previously) is to preserve the order of the items parsed from > the configuration files. Fully agree, all the versions that have been submitted in this thread preserves the ordering. > > Also, I am wondering whether we'd better have some regression tests > where a regex includes a comma and a role name itself has a comma, > actually, just to stress more the parsing of individual items in the > HBA file. Good idea, it has been added in v5 just shared up-thread. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com