Re: Supporting fallback RADIUS server(s)

Lists: pgsql-hackers
From: Marko Tiikkaja <marko(at)joh(dot)to>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Supporting fallback RADIUS server(s)
Date: 2015-08-20 00:12:04
Message-ID: 55D51B54.4050902@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

We use RADIUS authentication at $WORK, and it has one major flaw (well,
two, but I already fixed the other one this week): it only supports
specifying a single server, which as we might know, is bad for high
availability. So I'm developing a patch to fix this issue, but I'm not
exactly sure what the configuration should look like. I see multiple
options, but the one I like the best is the following:

Add two new HBA configuration options: radiusfallbackservers and
radiusfallbackports; both lists parsed with SplitIdentifierString (à la
listen_addresses). If radiusfallbackservers is set, it's the list of
servers to try after "radiusserver" has timed out (but ONLY if it timed
out, obviously). If radiusfallbackports is set, it must be of equal
length with radiusfallbackservers, and the corresponding port entry is
used for each fallback server. If it's not set, radiusport is used as
the port for all fallback servers, or finally the default port (1812) if
no port options have been specified in pg_hba.conf.

This interface is both flexible, simple to use in the common case (YMMV)
and fully backwards compatible.

I'm planning two submit two patches: one to refactor CheckRADIUSAuth() a
bit to make it easier to try the authentication against more than one
server, and then another one to add the two new configuration options.

Does anyone have a problem with this plan? Want to comment on the
interface or get anything else off their chest?

.m


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 00:29:50
Message-ID: 29205.1440030590@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Marko Tiikkaja <marko(at)joh(dot)to> writes:
> So I'm developing a patch to fix this issue, but I'm not
> exactly sure what the configuration should look like. I see multiple
> options, but the one I like the best is the following:

> Add two new HBA configuration options: radiusfallbackservers and
> radiusfallbackports; both lists parsed with SplitIdentifierString ( la
> listen_addresses).

Why add new GUCs for that? Can't we just redefine radiusserver as a list
of servers to try in sequence, and similarly split radiusport into a list?

Or maybe better, rename it radius_servers. But what you have here seems
weird, and it certainly doesn't follow the precedent of what we did when
we replaced listen_address with listen_addresses.

regards, tom lane


From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 00:36:33
Message-ID: 55D52111.1010206@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2015-08-20 02:29, Tom Lane wrote:
> Marko Tiikkaja <marko(at)joh(dot)to> writes:
>> So I'm developing a patch to fix this issue, but I'm not
>> exactly sure what the configuration should look like. I see multiple
>> options, but the one I like the best is the following:
>
>> Add two new HBA configuration options: radiusfallbackservers and
>> radiusfallbackports; both lists parsed with SplitIdentifierString (Ã la
>> listen_addresses).
>
> Why add new GUCs for that? Can't we just redefine radiusserver as a list
> of servers to try in sequence, and similarly split radiusport into a list?
>
> Or maybe better, rename it radius_servers. But what you have here seems
> weird, and it certainly doesn't follow the precedent of what we did when
> we replaced listen_address with listen_addresses.

If we were adding RADIUS support today, this would be the best option.
But seeing that we still only support one server today, this seems like
a backwards incompatibility which practically 100% of users won't
benefit from. But I don't care much either way. If we think breaking
compatibility here is acceptable, I'd say we go for radius_servers and
radius_ports.

.m


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 10:53:43
Message-ID: CABUevEys8kvUFdmXfvHMOmtUAqQxzs+AWp1d09kdPZYjrZm=Xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 20, 2015 at 2:36 AM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:

> On 2015-08-20 02:29, Tom Lane wrote:
>
>> Marko Tiikkaja <marko(at)joh(dot)to> writes:
>>
>>> So I'm developing a patch to fix this issue, but I'm not
>>> exactly sure what the configuration should look like. I see multiple
>>> options, but the one I like the best is the following:
>>>
>>
>> Add two new HBA configuration options: radiusfallbackservers and
>>> radiusfallbackports; both lists parsed with SplitIdentifierString (Ã la
>>> listen_addresses).
>>>
>>
>> Why add new GUCs for that? Can't we just redefine radiusserver as a list
>> of servers to try in sequence, and similarly split radiusport into a list?
>>
>> Or maybe better, rename it radius_servers. But what you have here seems
>> weird, and it certainly doesn't follow the precedent of what we did when
>> we replaced listen_address with listen_addresses.
>>
>
> If we were adding RADIUS support today, this would be the best option. But
> seeing that we still only support one server today, this seems like a
> backwards incompatibility which practically 100% of users won't benefit
> from. But I don't care much either way. If we think breaking
> compatibility here is acceptable, I'd say we go for radius_servers and
> radius_ports.

We could change it to radius_servers and radius_ports, and deprecate but
keep accepting the old parameters for a release or two. To make it easy, we
make sure that both parameter names accepts the same format parameter, so
it's easy enough to just replace it once deprecated.

And we could consider throwing a WARNING or at least a LOG when the old
name is used, indicating that it's deprecated.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 10:55:40
Message-ID: 55D5B22C.4060005@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 8/20/15 12:53 PM, Magnus Hagander wrote:
> We could change it to radius_servers and radius_ports, and deprecate but
> keep accepting the old parameters for a release or two.

That's one option..

> To make it easy, we
> make sure that both parameter names accepts the same format parameter, so
> it's easy enough to just replace it once deprecated.

I'm not sure I understand what you mean by this.

.m


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 10:57:31
Message-ID: CABUevEwp=X1b00Lq-G13cC48bOMsWjkM-AO_GOcoFKLYWp7hWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 20, 2015 at 12:55 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:

> On 8/20/15 12:53 PM, Magnus Hagander wrote:
>
>> We could change it to radius_servers and radius_ports, and deprecate but
>> keep accepting the old parameters for a release or two.
>>
>
> That's one option..
>
> To make it easy, we
>> make sure that both parameter names accepts the same format parameter, so
>> it's easy enough to just replace it once deprecated.
>>
>
> I'm not sure I understand what you mean by this.

I mean that you could write radius_server=foo or radius_servers=foo as well
as radius_server=foo,bar and radius_servers=foo,bar. As long as you don't
specify both radius_server and radius_servers, either one of them should
accept either one server or multiple servers.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 11:01:02
Message-ID: 55D5B36E.8010507@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 8/20/15 12:57 PM, Magnus Hagander wrote:
> I mean that you could write radius_server=foo or radius_servers=foo as well
> as radius_server=foo,bar and radius_servers=foo,bar. As long as you don't
> specify both radius_server and radius_servers, either one of them should
> accept either one server or multiple servers.

I think if we do it this way, I'd prefer if "radiusserver" was kept
fully backwards compatible. So either specify "radiusserver" or
"radius_servers", but only the second one accepts a list.

.m


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 14:16:12
Message-ID: 17866.1440080172@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Thu, Aug 20, 2015 at 2:36 AM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
>> On 2015-08-20 02:29, Tom Lane wrote:
>>> Why add new GUCs for that? Can't we just redefine radiusserver as a list
>>> of servers to try in sequence, and similarly split radiusport into a list?

> We could change it to radius_servers and radius_ports, and deprecate but
> keep accepting the old parameters for a release or two. To make it easy, we
> make sure that both parameter names accepts the same format parameter, so
> it's easy enough to just replace it once deprecated.

Considering that we did no such thing for listen_address, which is of
concern to probably two or three orders-of-magnitude more users than
radiusserver, I don't really see why we'd do it for the RADIUS settings.

Our expectations about forward compatibility for postgresql.conf entries
have always been pretty low; even more so for not-widely-used settings.

In any case, wouldn't what you describe simply put off the pain for awhile
(replacing it with confusion in the short term)? Eventually we're going
to break it.

regards, tom lane


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 14:25:27
Message-ID: CABUevEx002-SPxrjxyFvbE0HW37-4BFPcJBLu+Gg7bMQcvQSaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Aug 20, 2015 4:16 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
> > On Thu, Aug 20, 2015 at 2:36 AM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
> >> On 2015-08-20 02:29, Tom Lane wrote:
> >>> Why add new GUCs for that? Can't we just redefine radiusserver as a
list
> >>> of servers to try in sequence, and similarly split radiusport into a
list?
>
> > We could change it to radius_servers and radius_ports, and deprecate but
> > keep accepting the old parameters for a release or two. To make it
easy, we
> > make sure that both parameter names accepts the same format parameter,
so
> > it's easy enough to just replace it once deprecated.
>
> Considering that we did no such thing for listen_address, which is of
> concern to probably two or three orders-of-magnitude more users than
> radiusserver, I don't really see why we'd do it for the RADIUS settings.
>
> Our expectations about forward compatibility for postgresql.conf entries
> have always been pretty low; even more so for not-widely-used settings.
>
> In any case, wouldn't what you describe simply put off the pain for awhile
> (replacing it with confusion in the short term)? Eventually we're going
> to break it.
>

Well, that's true of any depreciation. And if we throw a log message then
people will know about it...

That said, I'm not against a clean break with compatibility either. As long
as it's clean - like renaming the parameters.

/Magnus


From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting fallback RADIUS server(s)
Date: 2015-08-20 14:28:16
Message-ID: 55D5E400.4090506@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 8/20/15 4:25 PM, Magnus Hagander wrote:
> On Aug 20, 2015 4:16 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Our expectations about forward compatibility for postgresql.conf entries
>> have always been pretty low; even more so for not-widely-used settings.
>>
>> In any case, wouldn't what you describe simply put off the pain for awhile
>> (replacing it with confusion in the short term)? Eventually we're going
>> to break it.
>>
>
> Well, that's true of any depreciation. And if we throw a log message then
> people will know about it...
>
> That said, I'm not against a clean break with compatibility either. As long
> as it's clean - like renaming the parameters.

All right. I'll submit a patch for that.

Thanks for the input, both.

.m